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
11 changes: 11 additions & 0 deletions .githooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env bash
set -e

echo "Running cargo fmt check..."
cargo fmt --all -- --check
if [ $? -ne 0 ]; then
echo ""
echo "Commit rejected: code is not formatted."
echo "Run 'cargo fmt --all' to fix formatting, then try again."
exit 1
fi
31 changes: 31 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@

name: Bug Report
description: Report a problem with the MACP runtime
title: "[BUG] "
labels: ["bug"]
body:
- type: textarea
id: description
attributes:
label: Description
description: Describe the issue clearly.
validations:
required: true

- type: textarea
id: reproduction
attributes:
label: Reproduction Steps
description: Steps or example envelope/client code that demonstrates the issue.

- type: textarea
id: expected
attributes:
label: Expected Behavior
description: What should happen according to the protocol?

- type: textarea
id: environment
attributes:
label: Environment
description: Rust version, OS, protoc version, etc.
31 changes: 31 additions & 0 deletions .github/ISSUE_TEMPLATE/rfc_proposal.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@

name: RFC / Enhancement Proposal
description: Propose a change or extension to the MACP runtime
title: "[RFC] "
labels: ["enhancement"]
body:
- type: textarea
id: summary
attributes:
label: Summary
description: High-level overview of the proposal.
validations:
required: true

- type: textarea
id: motivation
attributes:
label: Motivation
description: Why is this needed?

- type: textarea
id: specification
attributes:
label: Proposed Changes
description: Detailed specification changes.

- type: textarea
id: compatibility
attributes:
label: Backward Compatibility
description: Does this introduce breaking changes?
24 changes: 24 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@

## Summary

Describe the changes introduced by this pull request.

## Type of Change

- [ ] New feature
- [ ] Bug fix
- [ ] Refactoring
- [ ] New mode implementation
- [ ] Proto schema change
- [ ] Documentation improvement
- [ ] CI / tooling change

## Checklist

- [ ] `cargo test` passes
- [ ] `cargo clippy` has no warnings
- [ ] `cargo fmt` has been run
- [ ] Protobuf definitions compile successfully
- [ ] New modes implement the `Mode` trait correctly (if applicable)
- [ ] Error variants added to `MacpError` (if applicable)
- [ ] This change preserves MACP Core invariants
187 changes: 187 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
name: MACP Runtime CI

on:
pull_request:
push:
branches: [ main ]

env:
CARGO_TERM_COLOR: always

jobs:
check:
name: Check
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable

- name: Cache cargo registry and build
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-

- name: Install protoc
run: |
sudo apt-get update
sudo apt-get install -y protobuf-compiler

- name: Cargo check
run: cargo check --all-targets

fmt:
name: Format
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt

- name: Check formatting
run: cargo fmt --all -- --check

clippy:
name: Clippy
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: clippy

- name: Cache cargo registry and build
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-

- name: Install protoc
run: |
sudo apt-get update
sudo apt-get install -y protobuf-compiler

- name: Run clippy
run: cargo clippy --all-targets -- -D warnings

test:
name: Test
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable

- name: Cache cargo registry and build
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-

- name: Install protoc
run: |
sudo apt-get update
sudo apt-get install -y protobuf-compiler

- name: Run tests
run: cargo test --all-targets

build:
name: Build
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable

- name: Cache cargo registry and build
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-

- name: Install protoc
run: |
sudo apt-get update
sudo apt-get install -y protobuf-compiler

- name: Build release
run: cargo build --release

lint-protobuf:
name: Lint Protocol Buffers
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install buf
uses: bufbuild/buf-setup-action@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}

- name: Lint protobuf with buf
run: buf lint proto

- name: Check for breaking changes
if: github.event_name == 'pull_request'
run: |
git fetch origin main
# Skip if main branch doesn't have a buf module yet
if git show origin/main:proto/buf.yaml > /dev/null 2>&1; then
buf breaking proto --against '.git#branch=origin/main,subdir=proto'
else
echo "No buf module found on main branch, skipping breaking change check"
fi

ci-pass:
name: All Checks Passed
runs-on: ubuntu-latest
needs: [check, fmt, clippy, test, build, lint-protobuf]

steps:
- name: Summary
run: |
echo "All checks passed successfully"
echo " - cargo check"
echo " - cargo fmt"
echo " - cargo clippy"
echo " - cargo test"
echo " - cargo build --release"
echo " - protobuf lint"
26 changes: 26 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Rust
/target/
**/*.rs.bk
*.pdb
Cargo.lock

# Build artifacts
/out/

# IDE / Editor
.vscode/
.idea/
*.swp
*.swo
*~

# Claude Code
.claude/
CLAUDE.md
/plans/
/tmp/
/temp/

# OS
.DS_Store
Thumbs.db
18 changes: 18 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[package]
name = "macp-runtime"
version = "0.1.0"
edition = "2021"

[dependencies]
tokio = { version = "1", features = ["full"] }
tonic = "0.11"
prost = "0.12"
prost-types = "0.12"
uuid = { version = "1", features = ["v4"] }
thiserror = "1"
chrono = "0.4"
serde = { version = "1", features = ["derive"] }
serde_json = "1"

[build-dependencies]
tonic-build = "0.11"
20 changes: 20 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
.PHONY: setup build test fmt clippy check

## First-time setup: configure git hooks
setup:
git config core.hooksPath .githooks
@echo "Git hooks configured."

build:
cargo build

test:
cargo test

fmt:
cargo fmt --all

clippy:
cargo clippy --all-targets -- -D warnings

check: fmt clippy test
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# macp-runtime v0.1

Minimal Coordination Runtime (MCR)

## Run

Install protoc first.

Then:

cargo build
cargo run

Server runs on 127.0.0.1:50051

Send SessionStart, then Message.
If payload == "resolve", session transitions to RESOLVED.
6 changes: 6 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
fn main() -> Result<(), Box<dyn std::error::Error>> {
tonic_build::configure()
.build_server(true)
.compile(&["macp/v1/macp.proto"], &["proto"])?;
Ok(())
}
Loading