أمثلة الاستخدام
أمثلة عملية توضح كيفية استخدام Bob Shell لتصحيح الأخطاء وتحسين الكود وإنشاء الملفات وتوليد التوثيق وتعلم مفاهيم جديدة.
إصلاح أخطاء أوامر الشل
عندما تواجه أخطاء في أوامر الشل، يمكن لـ Bob Shell مساعدتك في تشخيصها وإصلاحها:
# Navigate to your project directory
cd your-project/
# Start Bob Shell
bob chat
# Switch to shell mode
> !
# Type in the command that's causing an error
> make build
# When you see an error message like 'No rule to make target `xxx', needed by `yyy'.'
# Press ESC or enter '!' again to exit shell mode
# Ask Bob Shell for help
> Help me to fix the errorشرح الكود وتحسينه
يمكن لـ Bob Shell مساعدتك على فهم الكود الموجود وتحسينه:
# Start Bob Shell in your project directory
bob chat
# Ask for an explanation of a specific file
> Explain what @src/utils.js does and how it works
# Request improvements to your code
> Review @src/api.js and suggest improvements for error handlingإنشاء ملفات وميزات جديدة
استخدم Bob Shell لمساعدتك في إنشاء مكونات أو ميزات جديدة:
# Start Bob Shell in your project directory
bob chat
# Ask for help creating a new component
> Create a React component for a user profile page that displays name, email, and avatar
# Generate a utility function
> Write a utility function that formats dates in YYYY-MM-DD formatالمساعدة في تصحيح الأخطاء
يمكن لـ Bob Shell مساعدتك في تصحيح المشكلات في كودك:
# Start Bob Shell in your project directory
bob chat
# Share error logs with Bob Shell
> I'm getting this error when running my app: "TypeError: Cannot read property 'map' of undefined". Here's the relevant code: @src/components/List.js
# Or pipe error output directly to Bob Shell
# In your terminal (not in Bob Shell)
npm run start 2>&1 | bob run "Help me understand and fix this error"توليد التوثيق
أنشئ توثيقًا لكودك باستخدام Bob Shell:
# Start Bob Shell in your project directory
bob chat
# Generate documentation for a specific file
> Create JSDoc comments for all functions in @src/helpers.js
# Generate a README for your project
> Create a README.md file for my project based on the code in @src/index.jsتعلم مفاهيم جديدة
استخدم Bob Shell لتعلم تقنيات أو مفاهيم جديدة:
# Start Bob Shell
bob chat
# Ask about a specific technology
> Explain how React hooks work and give me examples of useState and useEffect
# Learn about design patterns
> Explain the Observer pattern and how I might implement it in JavaScriptبدء جلسة غير تفاعلية
تتيح لك الجلسات غير التفاعلية استخدام Bob Shell مباشرةً من سطر الأوامر، من دون الدخول إلى جلسة تفاعلية. استخدمها للأتمتة والسكريبتات والمعالجة الدُفعية.
الأدوات
تعرّف على كيفية استخدام Bob Shell لأدوات متخصصة لقراءة الملفات وتحرير الكود وتشغيل الأوامر والتفاعل مع بيئة التطوير من سطر الأوامر.