脚本 Git 管理器:脚本的自动化 Git 版本控制 - Openclaw Skills

作者:互联网

2026-03-30

AI教程

什么是 脚本 Git 管理器?

脚本 Git 管理器是一个专门的技能,旨在为脚本开发实施严谨且确定性的工作流程。通过利用 Git 作为权威的状态记忆,它确保创建或修改的每个脚本都在其独立的仓库中进行跟踪。对于使用 Openclaw Skills 并需要高可靠性和清晰变更审计追踪的开发者来说,这种方法至关重要。

除了版本控制外,该技能还通过专门的虚拟环境管理 Python 依赖项,防止与系统级软件包发生冲突。其核心理念围绕透明度和安全性展开,在执行任何文件操作之前都需要用户明确确认,从而防止意外覆盖或不受控制的重构。

下载入口:https://github.com/openclaw/skills/tree/main/skills/cadot-eu/script-creator

安装与下载

1. ClawHub CLI

从源直接安装技能的最快方式。

npx clawhub@latest install script-creator

2. 手动安装

将技能文件夹复制到以下位置之一

全局模式 ~/.openclaw/skills/ 工作区 /skills/

优先级:工作区 > 本地 > 内置

3. 提示词安装

将此提示词复制到 OpenClaw 即可自动安装。

请帮我使用 Clawhub 安装 script-creator。如果尚未安装 Clawhub,请先安装(npm i -g clawhub)。

脚本 Git 管理器 应用场景

  • 使用自动初始化的 Git 仓库创建新的自动化脚本。
  • 修改现有逻辑,同时确保在历史记录中捕获更改前的检查点。
  • 在共享工作区内为不同项目隔离 Python 依赖项。
  • 维护结构化的开发环境,将每个脚本封装在自己的目录中。
脚本 Git 管理器 工作原理
  1. 该技能根据目录结构检测用户创建新脚本或修改现有脚本的意图。
  2. 它会生成一份全面的执行计划,详细说明目标目录、语言和必要的依赖项。
  3. 用户必须提供明确的确认才能继续执行提议的计划。
  4. 对于新脚本,它会创建目录、初始化 Git 仓库并设置文件模板。
  5. 对于修改,它会创建一个“检查点”Git 提交,以便在应用更新前保存当前状态。
  6. 它按顺序执行步骤,在每个动作后报告进度,并以 Git 状态和文件位置的摘要结束流程。

脚本 Git 管理器 配置指南

为了有效地利用此技能,请确保基础工作区和虚拟环境已准备就绪。运行以下命令来初始化所需的环境:

mkdir -p ~/.nanobot/workspace/test
python3 -m venv ~/.nanobot/workspace/venv

该技能将自动在这些路径中管理包安装和脚本执行。

脚本 Git 管理器 数据架构与分类体系

脚本 Git 管理器遵循严格的组织分类法以确保数据完整性。每个脚本项目按如下方式隔离:

组件 路径 / 详情
根目录 ~/.nanobot/workspace/test/
项目结构 [根目录]/[脚本名称]/[脚本名称].[后缀]
版本控制 每个项目目录内的 .git/ 文件夹
Python 环境 ~/.nanobot/workspace/venv/
提交标准 初始提交和修改检查点是强制性的
name: script-git-manager
description: >
  Create and modify scripts in ~/.nanobot/workspace/test with strict Git versioning.
  Each script lives in its own directory with an isolated git repository.
  Always confirms creation plan before execution and reports progress at each step.
  Uses ~/.nanobot/workspace/venv for Python environment and package management.

Script Git Manager Skill

This skill enforces a strict, deterministic workflow for creating and modifying scripts, using Git as the sole state memory. It is designed to prevent accidental file creation, uncontrolled refactors, and loss of history.


Scope

  • Base directory: ~/.nanobot/workspace/test
  • Python virtual environment: ~/.nanobot/workspace/venv
  • One script = one directory = one git repository
  • Git is mandatory and authoritative

Python Environment

All Python-related operations (pip install, script execution) must use the virtual environment:

# Activate virtual environment
source ~/.nanobot/workspace/venv/bin/activate

# Install packages
pip install 

# Execute Python scripts
python 

# Deactivate when done
deactivate

Always activate the venv before any pip or python command.


Creation Workflow

Use this skill only when the user explicitly asks to create a new script.

Phase 1: Plan Confirmation

Before creating anything, present a detailed creation plan to the user:

?? Script Creation Plan for: 

Directory: ~/.nanobot/workspace/test/
File: .
Language: 
Dependencies: 

Steps to execute:
1. Create directory ~/.nanobot/workspace/test/
2. Initialize Git repository
3. Create script file .
4. [If Python with dependencies] Activate venv and install: 
5. Write script content
6. Create initial Git commit

Proceed with this plan? (yes/no)

Wait for explicit user confirmation before proceeding.

Phase 2: Step-by-Step Execution

Execute each step sequentially and report progress after each one:

Step 1: Create directory

cd ~/.nanobot/workspace/test
mkdir 

Output: ? Created directory: ~/.nanobot/workspace/test/

Step 2: Initialize Git

cd 
git init

Output: ? Initialized Git repository

Step 3: Create script file

touch .

Output: ? Created file: .

Step 4: Install dependencies (if Python with dependencies)

source ~/.nanobot/workspace/venv/bin/activate
pip install   ...
deactivate

Output: ? Installed Python packages:

Step 5: Write script content

# Write the actual script code to the file

Output: ? Script content written ( lines)

Step 6: Create initial commit

git add .
git commit -m "Initial commit: "

Output: ? Initial Git commit created

Final summary:

? Script created successfully!

Location: ~/.nanobot/workspace/test//.
Git status: Clean (1 commit)
[If Python] Virtual environment: ~/.nanobot/workspace/venv

Modification Workflow

Use this skill only when the user asks to modify an existing script.

Phase 1: Plan Confirmation

Before modifying, present the modification plan:

?? Script Modification Plan for: 

Location: ~/.nanobot/workspace/test//
Changes requested: 

Steps to execute:
1. Enter script directory
2. Create checkpoint commit (current state)
3. Apply modifications: 
4. [If new Python dependencies] Install via venv: 
5. Commit changes with message: ""

Proceed with this plan? (yes/no)

Wait for explicit user confirmation before proceeding.

Phase 2: Step-by-Step Execution

Step 1: Enter directory

cd ~/.nanobot/workspace/test/

Output: ? Entered script directory

Step 2: Create checkpoint

git add .
git commit -m "Checkpoint before modification"

Output: ? Checkpoint commit created

Step 3: Apply modifications

# Modify the script file as requested

Output: ? Modifications applied to

Step 4: Install new dependencies (if applicable)

source ~/.nanobot/workspace/venv/bin/activate
pip install 
deactivate

Output: ? Installed new packages:

Step 5: Commit changes

git add .
git commit -m ""

Output: ? Changes committed: ""

Final summary:

? Script modified successfully!

Location: ~/.nanobot/workspace/test//
Changes: 
Git commits: 2 new commits (checkpoint + modification)

Hard Constraints (Must Never Be Violated)

  • Never create a new script unless explicitly instructed
  • Never proceed without user confirmation of the plan
  • Never skip progress reporting after each step
  • Never create additional files unless explicitly instructed
  • Never skip the pre-modification git commit
  • Never modify files outside the target script
  • Never rewrite git history
  • Never use system Python - always use ~/.nanobot/workspace/venv
  • Never assume missing intent

Decision Rules

  • If the script directory does not exist → creation workflow
  • If the script directory exists → modification workflow
  • If intent is ambiguous → ask for clarification, do nothing
  • If plan is not confirmed → stop and wait for confirmation

Progress Reporting Format

Use these symbols for consistency:

  • ?? Plan presentation
  • ? Successful step completion
  • ? Final success summary
  • ?? Warning or clarification needed
  • ? Error or failure

Each step output should be concise (1-2 lines) but informative.


Philosophy

Git is the memory.
The filesystem is the contract.
Confirmation prevents mistakes.
Transparency builds trust.
The venv isolates dependencies.