الأوضاع المخصصة
يمكنك إنشاء أوضاع مخصصة لتخصيص سلوك Bob لمهام أو سير عمل محددة. تعمل الأوضاع المخصصة في Bob Shell بشكل مشابه لأوضاع Bob IDE.
لماذا تستخدم الأوضاع المخصصة في Bob Shell
- سير عمل مُحسَّن للشل: أنشئ أوضاعًا مصممة خصيصًا لمهام التطوير المعتمدة على الطرفية
- أمان سطر الأوامر: قيّد الأوضاع بعمليات آمنة عند العمل في بيئات الإنتاج
- سلوك خاص بالبيئة: اضبط أوضاعًا تتكيف مع بيئات شل مختلفة
- صديق للأتمتة: صمّم أوضاعًا تعمل بسلاسة في الجلسات التفاعلية وغير التفاعلية
- توحيد الفريق: شارك أوضاعًا خاصة بالشل عبر فريقك لسير عمل متسق
ما يتضمنه الوضع المخصص
تستخدم الأوضاع المخصصة في Bob Shell نفس البنية الأساسية لأوضاع Bob IDE:
| الخاصية | الوصف | اعتبارات خاصة بالشل |
|---|---|---|
slug | معرف داخلي فريد | يُستخدم في وسيطات سطر الأوامر:bob --chat-mode=my-mode |
name | الاسم المعروض في واجهة المستخدم | يظهر في محدد الوضع بالوضع التفاعلي |
description | وصف قصير يظهر في محدد الوضع | اشرح غرض وضعك بإيجاز |
roleDefinition | الهوية الأساسية والخبرة | يجب مراعاة سياق الشل وسير عمل سطر الأوامر |
groups | مجموعات الأدوات المسموحة والوصول للملفات | أذونات تشغيل الأوامر حاسمة في بيئات الشل |
whenToUse | إرشادات اختيار الوضع | تساعد Bob Shell في اختيار الأوضاع المناسبة للمهام |
customInstructions | إرشادات سلوكية محددة أو قواعد للوضع | يمكن الإشارة إلى أنماط تطوير Bob Shell |
الأدوات المتاحة
مجموعات الأدوات المتاحة
read: قراءة الملفات والمجلداتedit: تعديل الملفات (يمكن تقييدها بـfileRegex)browser: استخدام أتمتة المتصفحcommand: تنفيذ أوامر الطرفيةmcp: الوصول إلى خوادم MCP
إنشاء الأوضاع المخصصة
ملفات الإعداد
يستخدم Bob Shell نفس تنسيق الإعداد كـ Bob IDE، مع دعم تنسيقَي YAML (المفضل) وJSON.
الأوضاع العامة
أنشئ أو عدّل ~/.bob/custom_modes.yaml للأوضاع المتاحة عبر جميع المشاريع:
customModes:
- slug: shell-debug
name: 🐛 Shell Debugger
roleDefinition: >-
You are a debugging specialist focused on command-line troubleshooting.
You excel at analyzing shell output, environment variables, and system logs.
whenToUse: Use for debugging shell scripts, command failures, and environment issues.
customInstructions: |-
When debugging:
- Always check environment variables first
- Examine command exit codes
- Review relevant log files
- Test commands in isolation before suggesting fixes
groups:
- read
- command
- browserالأوضاع الخاصة بالمشروع
أنشئ أو عدّل .bob/custom_modes.yaml في جذر مشروعك:
customModes:
- slug: deploy-helper
name: 🚀 Deployment Assistant
roleDefinition: You are a deployment specialist for this project's infrastructure.
whenToUse: Use for deployment tasks, infrastructure changes, and release management.
customInstructions: |-
Deployment guidelines:
- Always verify the target environment before running commands
- Check for running processes that might be affected
- Validate configuration files before applying changes
- Create backups before destructive operations
groups:
- read
- - edit
- fileRegex: \.(yaml|yml|sh|env)$
description: Configuration and script files only
- commandاختيار الوضع من سطر الأوامر
حدد وضعًا عند بدء Bob Shell:
# Start Bob Shell in a specific mode
bob --chat-mode=shell-debug
# Combine with other options
bob --chat-mode=deploy-helper --sandboxالتبديل التفاعلي بين الأوضاع
في الوضع التفاعلي، بدّل بين الأوضاع باستخدام أوامر slash:
# Switch to a custom mode
/mode shell-debug
# Or use the mode's slug directly
/shell-debugالإعدادات الخاصة بالشل
وضع أمان الإنتاج
أنشئ وضعًا مُركَّزًا على الأمان لبيئات الإنتاج:
customModes:
- slug: prod-ops
name: 🔒 Production Operations
roleDefinition: >-
You are a production operations specialist with a strong focus on safety.
You never run destructive commands without explicit confirmation.
whenToUse: Use when working with production systems or sensitive environments.
customInstructions: |-
Production safety rules:
- NEVER run destructive commands without explicit user confirmation
- Always verify the target environment before any operation
- Suggest dry-run options when available
- Check for active connections or processes before changes
- Recommend backup procedures before modifications
groups:
- read
- browser
# Note: No edit or command groups for maximum safetyوضع تطوير السكريبتات
أنشئ وضعًا لتطوير سكريبتات الشل:
customModes:
- slug: script-dev
name: 📜 Script Developer
roleDefinition: >-
You are a shell scripting expert specializing in bash, zsh, and POSIX-compliant scripts.
whenToUse: Use for creating, debugging, or improving shell scripts.
customInstructions: |-
Shell scripting best practices:
- Use shellcheck-compliant syntax
- Include proper error handling with set -e and set -u
- Add usage documentation at the top of scripts
- Quote variables to prevent word splitting
- Provide exit codes for different error conditions
groups:
- read
- - edit
- fileRegex: \.(sh|bash|zsh)$
description: Shell script files only
- commandأذونات تشغيل الأوامر
تقييد الوصول للأوامر
تحكم في الأوامر التي يمكن لوضع ما تشغيلها بحذف مجموعة command:
customModes:
- slug: safe-reviewer
name: 👀 Safe Code Reviewer
roleDefinition: You are a code reviewer focused on analysis, not modification.
whenToUse: Use for code reviews and analysis without making changes.
groups:
- read
- browser
# No command or edit groups - read-only modeالسماح بأوامر محددة
استخدم إعداد أدوات allowed في Bob Shell مع الأوضاع المخصصة في ملف إعداداتك:
{
"tools": {
"allowed": [
"run_shell_command(git status)",
"run_shell_command(git log)",
"run_shell_command(git diff)"
]
}
}السلوك التفاعلي وغير التفاعلي
التصميم للوضعين معًا
أنشئ أوضاعًا تعمل بشكل جيد في الجلسات التفاعلية وغير التفاعلية:
customModes:
- slug: test-runner
name: 🧪 Test Runner
roleDefinition: >-
You are a testing specialist who runs and analyzes test suites.
You adapt your output based on the running context.
whenToUse: Use for running tests, analyzing test results, and debugging test failures.
customInstructions: |-
Testing guidelines:
- In interactive mode: Provide detailed explanations and suggestions
- In non-interactive mode: Focus on concise, actionable output
- Always report test results clearly
- Suggest fixes for failing tests
groups:
- read
- commandالاستخدام غير التفاعلي
استخدم الأوضاع في الوضع غير التفاعلي:
# Use a mode designed for automation
bob --chat-mode=test-runner -p "Run the test suite and report failures"
# Combine with output processing
bob --chat-mode=test-runner -p "Run tests" --hide-intermediary-output > results.txtتعليمات خاصة بالوضع عبر الملفات
التعليمات القائمة على المجلدات
أنشئ ملفات تعليمات خاصة بالوضع في .bob/rules-{mode-slug}/:
مثال على ملف التعليمات (.bob/rules-shell-debug/01-environment-checks.md):
# Environment Debugging Checklist
When debugging shell issues, always check:
1. **Environment Variables**: PATH, SHELL, TERM, and application-specific variables
2. **Shell Configuration**: .bashrc, .zshrc, .profile files
3. **System State**: Current working directory, file permissions, disk space
4. **Command Availability**: Use `command -v <cmd>` to verify commands existتعليمات ملف واحد (بديل)
بدلاً من ذلك، استخدم ملفًا واحدًا .bobrules-{mode-slug} في جذر مساحة عملك.
أولوية الإعداد
تُطبَّق إعدادات الوضع بهذا الترتيب:
- وسيطات سطر الأوامر (
--chat-mode=mode-slug) - الأوضاع على مستوى المشروع (
.bob/custom_modes.yaml - الأوضاع على مستوى المستخدم (
~/.bob/custom_modes.yaml) - الأوضاع على مستوى النظام (مواقع خاصة بالمنصة)
- الأوضاع الافتراضية
العزل مع الأوضاع المخصصة
ادمج الأوضاع المخصصة مع ميزة sandbox في Bob Shell للتجريب الآمن:
# Start a custom mode in sandbox
bob --chat-mode=script-dev --sandbox
# Use with Docker sandbox
bob --chat-mode=deploy-helper --sandboxترحيل الأوضاع من Bob IDE
الاختلافات الرئيسية
عند ترحيل الأوضاع المخصصة من Bob IDE إلى Bob Shell:
| الجانب | Bob IDE | Bob Shell |
|---|---|---|
| تفاعل واجهة المستخدم | واجهة مرئية بلوحات | واجهة قائمة على الطرفية |
| تحرير الملفات | فروق وعروض معاينة في المحرر | عرض فروق CLI أو محرر خارجي |
| تشغيل الأوامر | طرفية متكاملة | تشغيل مباشر في الشل |
| تبديل الوضع | قائمة منسدلة في واجهة المستخدم أو أوامر slash | أوامر slash أو وسيطات CLI |
| الإعداد | واجهة إعدادات + ملفات | ملفات إعداد فقط |
قائمة التكيف
عند تكييف أوضاع Bob IDE لـ Bob Shell:
- راجع
roleDefinitionللسياق الخاص بالشل - حدّث
customInstructionsللإشارة إلى سير عمل سطر الأوامر - ضع في الاعتبار أمان تشغيل الأوامر في إعداد
groups - اختبر الوضع في كل من الجلسات التفاعلية وغير التفاعلية
- تحقق من أن معالجة مسارات الملفات تعمل في سياق الشل
- اختبر مع وضع sandbox إذا أمكن
مثال على الترحيل
وضع Bob IDE الأصلي:
customModes:
- slug: code-reviewer
name: 👀 Code Reviewer
roleDefinition: You are a code reviewer who provides detailed feedback.
groups:
- read
- browserمُكيَّف لـ Bob Shell:
customModes:
- slug: code-reviewer
name: 👀 Code Reviewer
roleDefinition: >-
You are a code reviewer who provides detailed feedback.
You work efficiently in terminal environments and provide clear, actionable suggestions.
whenToUse: Use for code reviews, pull request analysis, and code quality checks.
customInstructions: |-
Code review guidelines:
- Provide feedback in a structured format suitable for terminal output
- Reference specific line numbers and file paths
- Suggest concrete improvements with examples
- Format output for easy parsing if used in non-interactive mode
groups:
- read
- command # Added for git operations
- browserخطافات دورة الحياة
شغّل أوامر shell تلقائيًا في نقاط رئيسية من جلسة Bob Shell لتسجيل النشاط أو إضافة السياق أو حظر الإجراءات وفقًا لمنطقك.
شخصيات الوكلاء
أنشئ ملفات شخصية قابلة لإعادة الاستخدام تحدد دور الوكيل الفرعي وتركيزه ووصوله إلى الأدوات، وتحدد ما الذي يبحث عنه وكيف ينسق مخرجاته وما لا يُسمح له بفعله.