الأوضاع المخصصة
يمكنك إنشاء أوضاع مخصصة لتخصيص سلوك Bob لمهام أو سير عمل محددة. تعمل الأوضاع المخصصة في Bob Shell بشكل مشابه لأوضاع Bob IDE.
لماذا تستخدم الأوضاع المخصصة في Bob Shell
- سير عمل مُحسَّن للشل: أنشئ أوضاعًا مصممة خصيصًا لمهام التطوير المعتمدة على الطرفية
- أمان سطر الأوامر: قيّد الأوضاع بعمليات آمنة عند العمل في بيئات الإنتاج
- سلوك خاص بالبيئة: اضبط أوضاعًا تتكيف مع بيئات شل مختلفة
- صديق للأتمتة: صمّم أوضاعًا تعمل بسلاسة في الجلسات التفاعلية وغير التفاعلية
- توحيد الفريق: شارك أوضاعًا خاصة بالشل عبر فريقك لسير عمل متسق
ما يتضمنه الوضع المخصص
تستخدم الأوضاع المخصصة في Bob Shell نفس البنية الأساسية لأوضاع Bob IDE:
| الخاصية | الوصف | اعتبارات خاصة بالشل |
|---|---|---|
slug | معرف داخلي فريد | يُستخدم في وسيطات سطر الأوامر:bob --mode my-mode |
name | الاسم المعروض في واجهة المستخدم | يظهر في محدد الوضع بالوضع التفاعلي |
description | وصف قصير يظهر في محدد الوضع | اشرح غرض وضعك بإيجاز |
roleDefinition | الهوية الأساسية والخبرة | يجب مراعاة سياق الشل وسير عمل سطر الأوامر |
groups | مجموعات الأدوات المسموحة والوصول للملفات | أذونات تشغيل الأوامر حاسمة في بيئات الشل |
whenToUse | إرشادات اختيار الوضع | تساعد Bob Shell في اختيار الأوضاع المناسبة للمهام |
customInstructions | إرشادات سلوكية محددة أو قواعد للوضع | يمكن الإشارة إلى أنماط تطوير Bob Shell |
الأدوات المتاحة
مجموعات الأدوات المتاحة
read: قراءة الملفات والمجلداتedit: تعديل الملفات (يمكن تقييدها بـfileRegex)execute: تنفيذ أوامر الطرفية (يُقبَلcommandكاسم بديل قديم)browser: جلب صفحات الويب العامة (تجريبي؛ يتطلبexperiments.webFetch)mcp: الوصول إلى خوادم MCPskill: تفعيل المهاراتtodo: تحديث قائمة المهامsubagent: إنشاء subagentsmode: تبديل الأوضاع
إنشاء الأوضاع المخصصة
ملفات الإعداد
يستخدم Bob Shell نفس تنسيق الإعداد كـ Bob IDE، مع دعم تنسيقَي YAML (المفضل) وJSON.
الأوضاع العامة
أنشئ أو عدّل ~/.bob/settings/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
- execute
- 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
- executeاختيار الوضع من سطر الأوامر
حدد وضعًا عند بدء Bob Shell:
# Start Bob Shell in a specific mode
bob --mode shell-debug
# Combine with other options
bob --mode deploy-helper --max-turns 20التبديل التفاعلي بين الأوضاع
في الوضع التفاعلي، اكتب /mode لفتح محدد الوضع، ثم اختر وضعك المخصص. تظهر الأوضاع المخصصة في المحدد إلى جانب الأوضاع المدمجة Agent وPlan وAsk.
الإعدادات الخاصة بالشل
وضع أمان الإنتاج
أنشئ وضعًا مُركَّزًا على الأمان لبيئات الإنتاج:
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 execute 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
- executeأذونات تشغيل الأوامر
تقييد الوصول للأوامر
تحكم في ما إذا كان بإمكان وضع ما تشغيل الأوامر بحذف مجموعة execute:
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 execute or edit groups - read-only modeالسماح بأوامر محددة
للموافقة التلقائية على أوامر محددة، أضف "execute" إلى approval.allowed_permissions واسرد الأوامر في approval.allowedExecutors لأداة execute_command في ~/.bob/settings/settings.json:
{
"approval": {
"allowed_permissions": ["read", "execute"],
"allowedExecutors": [
{
"toolId": "execute_command",
"approvedCommands": ["git status", "git log", "git diff"],
"deniedCommands": []
}
]
}
}يؤدي تعيين allowedExecutors إلى استبدال القائمة الافتراضية للأوامر المعتمدة، لذا أدرج أي أوامر افتراضية تريد الاحتفاظ بها. لمزيد من التفاصيل، راجع إعدادات الموافقة.
السلوك التفاعلي وغير التفاعلي
التصميم للوضعين معًا
أنشئ أوضاعًا تعمل بشكل جيد في الجلسات التفاعلية وغير التفاعلية:
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
- executeالاستخدام غير التفاعلي
استخدم الأوضاع في الوضع غير التفاعلي:
# Use a mode designed for automation
bob run --mode test-runner "Run the test suite and report failures"
# Combine with output processing
bob run --mode test-runner --format json "Run tests" > results.jsonتعليمات خاصة بالوضع عبر الملفات
التعليمات القائمة على المجلدات
أنشئ ملفات تعليمات خاصة بالوضع في .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أولوية الإعداد
إذا تشارك وضعان نفس الـ slug، يستخدم Bob Shell أول وضع يجده، بهذا الترتيب:
- الأوضاع المدمجة (
agentوplanوask) - الأوضاع على مستوى المستخدم (
~/.bob/settings/custom_modes.yaml) - الأوضاع على مستوى المشروع (
.bob/custom_modes.yaml)
استخدم slug فريدًا لكل وضع مخصص. علامة --mode تحدد فقط الوضع الذي تبدأ به.
ترحيل الأوضاع من Bob IDE
الاختلافات الرئيسية
عند ترحيل الأوضاع المخصصة من Bob IDE إلى Bob Shell:
| الجانب | Bob IDE | Bob Shell |
|---|---|---|
| تفاعل واجهة المستخدم | واجهة مرئية بلوحات | واجهة قائمة على الطرفية |
| تحرير الملفات | فروق وعروض معاينة في المحرر | عرض فروق CLI أو محرر خارجي |
| تشغيل الأوامر | طرفية متكاملة | تشغيل مباشر في الشل |
| تبديل الوضع | القائمة المنسدلة لمحدد الوضع | محدد /mode أو علامة CLI --mode |
| الإعداد | واجهة إعدادات + ملفات | ملفات إعداد فقط |
قائمة التكيف
عند تكييف أوضاع Bob IDE لـ Bob Shell:
- راجع
roleDefinitionللسياق الخاص بالشل - حدّث
customInstructionsللإشارة إلى سير عمل سطر الأوامر - ضع في الاعتبار أمان تشغيل الأوامر في إعداد
groups - اختبر الوضع في كل من الجلسات التفاعلية وغير التفاعلية
- تحقق من أن معالجة مسارات الملفات تعمل في سياق الشل
مثال على الترحيل
وضع 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
- execute # Added for git operations
- browser