Skip to content

Commit 2400a2c

Browse files
RoyLinRoyLin
authored andcommitted
chore: bump version to 1.3.4
- Fix permission wildcard matching for MCP tools - Add support for mcp__longvt__* pattern in deny rules - Update all SDK versions to 1.3.4 ## Changes - Modified: core/src/permissions.rs - Add wildcard support to matches_tool_name - Added: core/tests/test_subagent_permissions.rs - Integration tests (5 tests) - Added: core/examples/permission_control.rs - Demo program - Added: core/examples/test_scenario1.rs - Scenario test ## Tests - Unit tests: 50/50 passed - Integration tests: 5/5 passed - Scenario tests: 10/10 passed
1 parent 07289c9 commit 2400a2c

13 files changed

Lines changed: 856 additions & 7 deletions

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

RELEASE_CHECKLIST.md

Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
# Release Checklist for a3s-code v1.3.4
2+
3+
## Pre-Release Checks
4+
5+
### 1. Code Changes
6+
- [x] Bug fix: Permission wildcard matching for MCP tools
7+
- [x] Added tests: 2 new unit tests, 5 integration tests
8+
- [x] All tests passing: 65/65 ✅
9+
10+
### 2. Version Alignment
11+
Current: 1.3.3 → Target: 1.3.4
12+
13+
Files to update:
14+
- [ ] `core/Cargo.toml`
15+
- [ ] `sdk/node/Cargo.toml`
16+
- [ ] `sdk/node/package.json`
17+
- [ ] `sdk/python/Cargo.toml`
18+
- [ ] `sdk/python/pyproject.toml`
19+
- [ ] `Cargo.lock` (via `cargo check`)
20+
21+
### 3. Testing
22+
- [x] Unit tests: `cargo test --lib permissions::tests` (50/50)
23+
- [x] Integration tests: `cargo test --test test_subagent_permissions` (5/5)
24+
- [x] Scenario tests: `cargo run --example test_scenario1` (10/10)
25+
- [ ] Format check: `cargo fmt --all -- --check`
26+
- [ ] Clippy: `cargo clippy --workspace -- -D warnings`
27+
28+
### 4. Documentation
29+
- [x] TEST_RESULT.md created
30+
- [x] TEST_REPORT.md created
31+
- [ ] CHANGELOG.md updated (if exists)
32+
- [ ] README.md updated (if needed)
33+
34+
### 5. Git Operations
35+
- [ ] Commit changes with descriptive message
36+
- [ ] Create tag: `v1.3.4`
37+
- [ ] Push to origin: `git push origin main`
38+
- [ ] Push tag: `git push origin v1.3.4`
39+
40+
### 6. GitHub Actions
41+
After pushing tag, verify:
42+
- [ ] CI checks pass (Linux)
43+
- [ ] CI checks pass (Windows)
44+
- [ ] Publish to crates.io succeeds
45+
- [ ] Node SDK publish succeeds
46+
- [ ] Python SDK publish succeeds
47+
- [ ] GitHub Release created
48+
49+
## Release Commands
50+
51+
### Option 1: Automated (Recommended)
52+
```bash
53+
cd /Users/roylin/Desktop/code/a3s/crates/code
54+
./release.sh 1.3.4
55+
```
56+
57+
### Option 2: Manual
58+
```bash
59+
cd /Users/roylin/Desktop/code/a3s/crates/code
60+
61+
# 1. Check version alignment
62+
./check-version.sh
63+
64+
# 2. Update versions manually
65+
# Edit: core/Cargo.toml, sdk/*/Cargo.toml, sdk/node/package.json, sdk/python/pyproject.toml
66+
67+
# 3. Update Cargo.lock
68+
cargo check --workspace
69+
70+
# 4. Run tests
71+
cargo test --lib permissions::tests
72+
cargo test --test test_subagent_permissions
73+
74+
# 5. Format code
75+
cargo fmt --all
76+
77+
# 6. Commit and tag
78+
git add -A
79+
git commit -m "chore: bump version to 1.3.4"
80+
git tag -a v1.3.4 -m "Release v1.3.4"
81+
82+
# 7. Push
83+
git push origin main
84+
git push origin v1.3.4
85+
```
86+
87+
## Release Notes (v1.3.4)
88+
89+
### 🐛 Bug Fixes
90+
- **Permission System**: Fix wildcard matching for MCP tool names
91+
- `mcp__longvt__*` now correctly matches all longvt tools
92+
- `mcp__*` now correctly matches all MCP tools
93+
- `permissive_deny` parameter now works as expected
94+
- Agent .md deny rules now work with permissive mode
95+
96+
### ✨ Features
97+
- Add wildcard support to `matches_tool_name` function
98+
- Support `*` and `?` wildcards in tool name patterns
99+
100+
### 🧪 Tests
101+
- Add 2 new unit tests for wildcard matching
102+
- Add 5 integration tests for SubAgent permissions
103+
- Add scenario test program
104+
- All 65 tests passing
105+
106+
### 📝 Documentation
107+
- Add comprehensive test report
108+
- Add permission control demo program
109+
- Add test agent definition example
110+
111+
### 🔧 Technical Details
112+
- Modified: `core/src/permissions.rs:134-150`
113+
- Added: `core/tests/test_subagent_permissions.rs`
114+
- Added: `core/examples/permission_control.rs`
115+
- Added: `core/examples/test_scenario1.rs`
116+
117+
## Post-Release Verification
118+
119+
After release completes:
120+
1. [ ] Check crates.io: https://crates.io/crates/a3s-code-core
121+
2. [ ] Check npm: https://www.npmjs.com/package/@a3s-lab/code
122+
3. [ ] Check PyPI: https://pypi.org/project/a3s-code/
123+
4. [ ] Check GitHub Release: https://github.com/A3S-Lab/Code/releases/tag/v1.3.4
124+
5. [ ] Test installation:
125+
```bash
126+
# Rust
127+
cargo add a3s-code-core@1.3.4
128+
129+
# Node
130+
npm install @a3s-lab/code@1.3.4
131+
132+
# Python
133+
pip install a3s-code==1.3.4
134+
```
135+
136+
## Rollback Plan
137+
138+
If release fails:
139+
```bash
140+
# Delete tag locally
141+
git tag -d v1.3.4
142+
143+
# Delete tag remotely
144+
git push origin :refs/tags/v1.3.4
145+
146+
# Revert commit
147+
git revert HEAD
148+
git push origin main
149+
```
150+
151+
## Notes
152+
- This is a bug fix release (patch version bump)
153+
- No breaking changes
154+
- Backward compatible with 1.3.x
155+
- All existing tests continue to pass

check-version.sh

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/bin/bash
2+
# Check version alignment across all SDK files
3+
4+
echo "=========================================="
5+
echo "Version Alignment Check"
6+
echo "=========================================="
7+
echo ""
8+
9+
# Extract versions
10+
CORE_VERSION=$(grep '^version = ' core/Cargo.toml | head -1 | sed 's/version = "\(.*\)"/\1/')
11+
NODE_CARGO_VERSION=$(grep '^version = ' sdk/node/Cargo.toml | head -1 | sed 's/version = "\(.*\)"/\1/')
12+
NODE_PKG_VERSION=$(grep '"version":' sdk/node/package.json | sed 's/.*"version": "\(.*\)".*/\1/')
13+
PYTHON_CARGO_VERSION=$(grep '^version = ' sdk/python/Cargo.toml | head -1 | sed 's/version = "\(.*\)"/\1/')
14+
PYTHON_PYPROJECT_VERSION=$(grep '^version = ' sdk/python/pyproject.toml | head -1 | sed 's/version = "\(.*\)"/\1/')
15+
16+
echo "Current versions:"
17+
echo " core/Cargo.toml: ${CORE_VERSION}"
18+
echo " sdk/node/Cargo.toml: ${NODE_CARGO_VERSION}"
19+
echo " sdk/node/package.json: ${NODE_PKG_VERSION}"
20+
echo " sdk/python/Cargo.toml: ${PYTHON_CARGO_VERSION}"
21+
echo " sdk/python/pyproject.toml: ${PYTHON_PYPROJECT_VERSION}"
22+
echo ""
23+
24+
# Check alignment
25+
if [ "$CORE_VERSION" = "$NODE_CARGO_VERSION" ] && \
26+
[ "$CORE_VERSION" = "$NODE_PKG_VERSION" ] && \
27+
[ "$CORE_VERSION" = "$PYTHON_CARGO_VERSION" ] && \
28+
[ "$CORE_VERSION" = "$PYTHON_PYPROJECT_VERSION" ]; then
29+
echo "✅ All versions aligned: ${CORE_VERSION}"
30+
exit 0
31+
else
32+
echo "❌ Version mismatch detected!"
33+
echo ""
34+
echo "Expected: ${CORE_VERSION}"
35+
echo "Mismatches:"
36+
[ "$CORE_VERSION" != "$NODE_CARGO_VERSION" ] && echo " - sdk/node/Cargo.toml: ${NODE_CARGO_VERSION}"
37+
[ "$CORE_VERSION" != "$NODE_PKG_VERSION" ] && echo " - sdk/node/package.json: ${NODE_PKG_VERSION}"
38+
[ "$CORE_VERSION" != "$PYTHON_CARGO_VERSION" ] && echo " - sdk/python/Cargo.toml: ${PYTHON_CARGO_VERSION}"
39+
[ "$CORE_VERSION" != "$PYTHON_PYPROJECT_VERSION" ] && echo " - sdk/python/pyproject.toml: ${PYTHON_PYPROJECT_VERSION}"
40+
exit 1
41+
fi

core/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "a3s-code-core"
3-
version = "1.3.3"
3+
version = "1.3.4"
44
edition = "2021"
55
authors = ["A3S Lab Team"]
66
license = "MIT"
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
/// Example: SubAgent permission fine-grained control
2+
///
3+
/// Demonstrates how to use permissive mode with deny rules to control
4+
/// which tools a subagent can access.
5+
///
6+
/// Run with: cargo run --example permission_control
7+
use a3s_code_core::permissions::{PermissionDecision, PermissionPolicy};
8+
use serde_json::json;
9+
10+
fn main() {
11+
println!("\n{}", "=".repeat(60));
12+
println!("SubAgent Permission Fine-Grained Control Demo");
13+
println!("{}\n", "=".repeat(60));
14+
15+
// Example 1: Permissive mode with wildcard deny
16+
println!("Example 1: Permissive + Deny mcp__longvt__*");
17+
println!("{}", "-".repeat(60));
18+
19+
let policy = PermissionPolicy::permissive().deny("mcp__longvt__*");
20+
21+
test_tool(&policy, "mcp__longvt__search", json!({}));
22+
test_tool(&policy, "mcp__longvt__create_memory", json!({}));
23+
test_tool(&policy, "mcp__pencil__draw", json!({}));
24+
test_tool(&policy, "read", json!({"file_path": "test.txt"}));
25+
test_tool(&policy, "bash", json!({"command": "ls"}));
26+
27+
// Example 2: Multiple deny patterns
28+
println!("\n\nExample 2: Multiple Deny Patterns");
29+
println!("{}", "-".repeat(60));
30+
31+
let policy = PermissionPolicy::permissive()
32+
.deny("mcp__longvt__*")
33+
.deny("mcp__dangerous__*")
34+
.deny("bash");
35+
36+
test_tool(&policy, "mcp__longvt__search", json!({}));
37+
test_tool(&policy, "mcp__dangerous__execute", json!({}));
38+
test_tool(&policy, "bash", json!({"command": "rm -rf /"}));
39+
test_tool(&policy, "read", json!({"file_path": "test.txt"}));
40+
test_tool(&policy, "mcp__pencil__draw", json!({}));
41+
42+
// Example 3: Deny all MCP tools
43+
println!("\n\nExample 3: Deny All MCP Tools");
44+
println!("{}", "-".repeat(60));
45+
46+
let policy = PermissionPolicy::permissive().deny("mcp__*");
47+
48+
test_tool(&policy, "mcp__longvt__search", json!({}));
49+
test_tool(&policy, "mcp__pencil__draw", json!({}));
50+
test_tool(&policy, "mcp__any__tool", json!({}));
51+
test_tool(&policy, "read", json!({"file_path": "test.txt"}));
52+
test_tool(&policy, "bash", json!({"command": "ls"}));
53+
54+
// Example 4: Agent definition permissions
55+
println!("\n\nExample 4: Agent Definition Permissions");
56+
println!("{}", "-".repeat(60));
57+
println!("In agent .md file:");
58+
println!("---");
59+
println!("permissions:");
60+
println!(" allow:");
61+
println!(" - read");
62+
println!(" - grep");
63+
println!(" deny:");
64+
println!(" - mcp__longvt__*");
65+
println!("---");
66+
println!("\nWhen spawned with permissive=true:");
67+
println!(" - Agent deny rules are STILL enforced");
68+
println!(" - Other tools are allowed (permissive default)");
69+
70+
println!("\n{}", "=".repeat(60));
71+
println!("✅ Demo completed");
72+
println!("{}\n", "=".repeat(60));
73+
}
74+
75+
fn test_tool(policy: &PermissionPolicy, tool_name: &str, args: serde_json::Value) {
76+
let decision = policy.check(tool_name, &args);
77+
let icon = match decision {
78+
PermissionDecision::Allow => "✅",
79+
PermissionDecision::Deny => "❌",
80+
PermissionDecision::Ask => "❓",
81+
};
82+
println!(" {} {:30} → {:?}", icon, tool_name, decision);
83+
}

0 commit comments

Comments
 (0)