Add files via upload

This commit is contained in:
公明
2025-11-18 23:51:51 +08:00
committed by GitHub
parent 9325060e42
commit 0ce3364635
2 changed files with 73 additions and 16 deletions

View File

@@ -1,8 +1,33 @@
name: "execute-python-script"
command: "python3"
args: ["-c"]
command: "/bin/bash"
args:
- "-c"
- |
set -euo pipefail
SCRIPT_CONTENT="$1"
ENV_NAME="${2:-default}"
ADDITIONAL_ARGS="${3:-}"
BASE_DIR="${HOME}/.cyberstrike/venvs"
ENV_DIR="${BASE_DIR}/${ENV_NAME}"
mkdir -p "$BASE_DIR"
if [ ! -d "$ENV_DIR" ]; then
python3 -m venv "$ENV_DIR"
fi
# shellcheck disable=SC1090
source "$ENV_DIR/bin/activate"
if [ -n "$ADDITIONAL_ARGS" ]; then
python3 $ADDITIONAL_ARGS -c "$SCRIPT_CONTENT"
else
python3 -c "$SCRIPT_CONTENT"
fi
- "_"
enabled: true
short_description: "执行Python脚本工具"
short_description: "在指定虚拟环境中编写并执行Python脚本"
description: |
在虚拟环境中执行Python脚本。
@@ -29,6 +54,13 @@ parameters:
required: true
position: 0
format: "positional"
- name: "env_name"
type: "string"
description: "虚拟环境名称默认default"
required: false
default: "default"
position: 1
format: "positional"
- name: "additional_args"
type: "string"
description: |
@@ -43,3 +75,4 @@ parameters:
- 此参数会直接追加到命令末尾
required: false
format: "positional"
default: ""

View File

@@ -1,22 +1,45 @@
name: "install-python-package"
command: "pip"
command: "/bin/bash"
args:
- "-c"
- |
set -euo pipefail
PACKAGE="$1"
ENV_NAME="${2:-default}"
ADDITIONAL_ARGS="${3:-}"
BASE_DIR="${HOME}/.cyberstrike/venvs"
ENV_DIR="${BASE_DIR}/${ENV_NAME}"
mkdir -p "$BASE_DIR"
if [ ! -d "$ENV_DIR" ]; then
python3 -m venv "$ENV_DIR"
fi
# shellcheck disable=SC1090
source "$ENV_DIR/bin/activate"
if [ -n "$ADDITIONAL_ARGS" ]; then
pip install "$PACKAGE" $ADDITIONAL_ARGS
else
pip install "$PACKAGE"
fi
- "_"
enabled: true
short_description: "安装Python包工具"
short_description: "在指定虚拟环境中创建/激活并安装Python依赖"
description: |
在虚拟环境中安装Python包。
**主要功能:**
- 安装Python包
- 虚拟环境支持
- 依赖管理
**使用场景:**
- 环境配置
- 依赖安装
- 工具安装
parameters:
- name: "package"
type: "string"
@@ -24,24 +47,25 @@ parameters:
required: true
position: 0
format: "positional"
- name: "env_name"
type: "string"
description: "虚拟环境名称"
description: "虚拟环境名称默认default"
required: false
default: "default"
position: 1
format: "positional"
- name: "additional_args"
type: "string"
description: |
额外的install-python-package参数。用于传递未在参数列表中定义的install-python-package选项。
**示例值:**
- 根据工具特性添加常用参数示例
**注意事项:**
- 多个参数用空格分隔
- 确保参数格式正确,避免命令注入
- 此参数会直接追加到命令末尾
required: false
format: "positional"
format: "positional"
default: ""