Skip to content

Commit 07b2ec9

Browse files
Alex Holmbergclaude
authored andcommitted
feat: add CI workflow, trust badges, and fix Bedrock extended thinking
- Add GitHub Actions CI workflow with cross-platform testing, clippy, format checks, and security audit - Add trust badges to README: CI status, docs.rs, GitHub stars, last commit, MSRV (Rust 1.85+), platform support - Fix extended thinking + tool use error for Bedrock by ensuring Reasoning blocks are sorted first in assistant messages (satisfies AWS API requirement that thinking blocks precede tool_use blocks) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 467885c commit 07b2ec9

3 files changed

Lines changed: 101 additions & 11 deletions

File tree

.github/workflows/ci.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main, develop]
6+
pull_request:
7+
branches: [main, develop]
8+
9+
env:
10+
CARGO_TERM_COLOR: always
11+
RUST_BACKTRACE: 1
12+
13+
jobs:
14+
build:
15+
name: Build & Test
16+
runs-on: ${{ matrix.os }}
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
os: [ubuntu-latest, macos-latest, windows-latest]
21+
rust: [stable]
22+
23+
steps:
24+
- uses: actions/checkout@v4
25+
26+
- name: Install Rust toolchain
27+
uses: dtolnay/rust-toolchain@master
28+
with:
29+
toolchain: ${{ matrix.rust }}
30+
components: clippy, rustfmt
31+
32+
- name: Cache cargo registry
33+
uses: actions/cache@v4
34+
with:
35+
path: |
36+
~/.cargo/registry
37+
~/.cargo/git
38+
target
39+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
40+
restore-keys: |
41+
${{ runner.os }}-cargo-
42+
43+
- name: Check formatting
44+
if: matrix.os == 'ubuntu-latest'
45+
run: cargo fmt --all -- --check
46+
47+
- name: Build
48+
run: cargo build --verbose
49+
50+
- name: Run tests
51+
run: cargo test --verbose
52+
53+
- name: Clippy
54+
if: matrix.os == 'ubuntu-latest'
55+
run: cargo clippy -- -D warnings
56+
57+
# Security audit
58+
security:
59+
name: Security Audit
60+
runs-on: ubuntu-latest
61+
steps:
62+
- uses: actions/checkout@v4
63+
- uses: rustsec/audit-check@v2
64+
with:
65+
token: ${{ secrets.GITHUB_TOKEN }}

README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,20 @@
99
</p>
1010

1111
<p align="center">
12+
<!-- Build & Quality -->
13+
<a href="https://github.com/syncable-dev/syncable-cli/actions/workflows/ci.yml"><img src="https://img.shields.io/github/actions/workflow/status/syncable-dev/syncable-cli/ci.yml?branch=main&style=flat-square&label=CI" alt="CI Status"></a>
1214
<a href="https://crates.io/crates/syncable-cli"><img src="https://img.shields.io/crates/v/syncable-cli?style=flat-square&color=blue" alt="Crates.io"></a>
15+
<a href="https://docs.rs/syncable-cli"><img src="https://img.shields.io/docsrs/syncable-cli?style=flat-square&label=docs.rs" alt="docs.rs"></a>
16+
<br>
17+
<!-- Downloads & Community -->
1318
<a href="https://crates.io/crates/syncable-cli"><img src="https://img.shields.io/crates/d/syncable-cli?style=flat-square" alt="Downloads"></a>
19+
<a href="https://github.com/syncable-dev/syncable-cli/stargazers"><img src="https://img.shields.io/github/stars/syncable-dev/syncable-cli?style=flat-square" alt="GitHub Stars"></a>
20+
<a href="https://github.com/syncable-dev/syncable-cli/commits/main"><img src="https://img.shields.io/github/last-commit/syncable-dev/syncable-cli?style=flat-square" alt="Last Commit"></a>
21+
<br>
22+
<!-- Tech Stack -->
1423
<a href="https://www.gnu.org/licenses/gpl-3.0"><img src="https://img.shields.io/badge/License-GPL%20v3-blue.svg?style=flat-square" alt="License"></a>
15-
<a href="https://www.rust-lang.org/"><img src="https://img.shields.io/badge/Built%20with-Rust-orange?style=flat-square" alt="Rust"></a>
24+
<a href="https://www.rust-lang.org/"><img src="https://img.shields.io/badge/Rust-1.85+-orange?style=flat-square&logo=rust" alt="Rust 1.85+"></a>
25+
<a href="https://github.com/syncable-dev/syncable-cli"><img src="https://img.shields.io/badge/Platform-Linux%20%7C%20macOS%20%7C%20Windows-lightgrey?style=flat-square" alt="Platform"></a>
1626
</p>
1727

1828
<p align="center">

vendor/rig-bedrock/src/types/message.rs

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,31 @@ impl TryFrom<RigMessage> for aws_bedrock::Message {
2929
.build()
3030
.map_err(|e| CompletionError::RequestError(Box::new(e)))?
3131
}
32-
Message::Assistant { content, .. } => aws_bedrock::Message::builder()
33-
.role(aws_bedrock::ConversationRole::Assistant)
34-
.set_content(Some(
35-
content
36-
.into_iter()
37-
.map(|content| RigAssistantContent(content).try_into())
38-
.collect::<Result<Vec<aws_bedrock::ContentBlock>, _>>()?,
39-
))
40-
.build()
41-
.map_err(|e| CompletionError::RequestError(Box::new(e)))?,
32+
Message::Assistant { content, .. } => {
33+
// Convert all content blocks
34+
let mut content_blocks: Vec<aws_bedrock::ContentBlock> = content
35+
.into_iter()
36+
.map(|content| RigAssistantContent(content).try_into())
37+
.collect::<Result<Vec<aws_bedrock::ContentBlock>, _>>()?;
38+
39+
// CRITICAL: Sort to put Reasoning blocks FIRST
40+
// AWS Bedrock requires assistant messages to start with thinking blocks
41+
// when extended thinking is enabled. Without this, multi-turn conversations
42+
// with tool use fail with: "Expected `thinking` or `redacted_thinking`,
43+
// but found `tool_use`"
44+
content_blocks.sort_by_key(|block| match block {
45+
aws_bedrock::ContentBlock::ReasoningContent(_) => 0, // First
46+
aws_bedrock::ContentBlock::Text(_) => 1, // Second
47+
aws_bedrock::ContentBlock::ToolUse(_) => 2, // Last
48+
_ => 3,
49+
});
50+
51+
aws_bedrock::Message::builder()
52+
.role(aws_bedrock::ConversationRole::Assistant)
53+
.set_content(Some(content_blocks))
54+
.build()
55+
.map_err(|e| CompletionError::RequestError(Box::new(e)))?
56+
}
4257
};
4358
Ok(result)
4459
}

0 commit comments

Comments
 (0)