Skip to content

feat(tool): add shell command build-in tool#270

Merged
AlbumenJ merged 22 commits intoagentscope-ai:mainfrom
fang-tech:fang-tech/feat-shell-cmd-tool
Dec 25, 2025
Merged

feat(tool): add shell command build-in tool#270
AlbumenJ merged 22 commits intoagentscope-ai:mainfrom
fang-tech:fang-tech/feat-shell-cmd-tool

Conversation

@fang-tech
Copy link
Contributor

AgentScope-Java Version

1.0.4-SNAPSHOT

Description

relate to #92, This is the built-in tool that enables the complete functionality of the skill and allows the execution of resources.

Checklist

Please check the following items before code is ready to be reviewed.

  • Code has been formatted with mvn spotless:apply
  • All tests are passing (mvn test)
  • Javadoc comments are complete and follow project conventions
  • Related documentation has been updated (e.g. links, examples, etc.)
  • Code is ready for review

@fang-tech fang-tech requested a review from a team December 21, 2025 05:29
@codecov
Copy link

codecov bot commented Dec 21, 2025

Copilot AI review requested due to automatic review settings December 25, 2025 05:21
@fang-tech fang-tech force-pushed the fang-tech/feat-shell-cmd-tool branch from b0e2775 to d84e521 Compare December 25, 2025 05:21
@fang-tech fang-tech force-pushed the fang-tech/feat-shell-cmd-tool branch from d84e521 to fa2aaa7 Compare December 25, 2025 05:31
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces a new built-in Shell Command Tool that enables agents to execute shell commands with comprehensive security features and cross-platform support. The implementation includes command whitelisting, user approval callbacks, timeout management, and platform-specific validators for Windows and Unix-like systems.

Key changes:

  • Added ShellCommandTool with security validation, timeout control, and cross-platform command execution
  • Implemented platform-specific validators (UnixCommandValidator and WindowsCommandValidator) to handle OS-specific command separators and patterns
  • Added comprehensive test coverage with 1,284 lines of tests covering various scenarios including timeouts, security validation, and edge cases
  • Updated documentation in both English and Chinese with detailed usage examples, security warnings, and feature descriptions

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 17 comments.

Show a summary per file
File Description
docs/zh/task/tool.md Added comprehensive Chinese documentation for the Shell Command Tool, including usage examples, security features, and configuration options
docs/en/task/tool.md Added English documentation for the Shell Command Tool with security notices and usage examples
agentscope-core/src/main/java/io/agentscope/core/tool/coding/ShellCommandTool.java Core implementation of the shell command execution tool with security validation, timeout handling, and cross-platform support
agentscope-core/src/main/java/io/agentscope/core/tool/coding/CommandValidator.java Interface defining the contract for command validation with ValidationResult inner class
agentscope-core/src/main/java/io/agentscope/core/tool/coding/UnixCommandValidator.java Unix/Linux/macOS-specific command validator implementing whitelist checking and multiple command detection
agentscope-core/src/main/java/io/agentscope/core/tool/coding/WindowsCommandValidator.java Windows-specific command validator with Windows path and extension handling (.exe, .bat, .cmd)
agentscope-core/src/test/java/io/agentscope/core/tool/coding/ShellCommandToolTest.java Comprehensive test suite with 1,284 lines covering command execution, security validation, timeouts, and cross-platform scenarios
agentscope-core/src/test/java/io/agentscope/core/tool/coding/WindowsCommandValidatorTest.java Detailed tests for Windows command validator covering executable extraction, extension handling, and validation logic

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@fang-tech fang-tech requested a review from AlbumenJ December 25, 2025 11:32
@AlbumenJ AlbumenJ merged commit ff5906d into agentscope-ai:main Dec 25, 2025
4 checks passed
@fang-tech fang-tech deleted the fang-tech/feat-shell-cmd-tool branch December 25, 2025 12:33
JGoP-L pushed a commit to JGoP-L/agentscope-java that referenced this pull request Dec 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants