GitHub Copilot CLI — شيت شيت 📋

"الورقة اللي تطبعها وتعلقها جنب الشاشة"

Sectionالتركيب و الإعداد

bash
# macOS / Linux
curl-fsSLhttps://gh.io/copilot-install|bash

# Homebrew
brewinstallcopilot-cli

# Windows
wingetinstallGitHub.Copilot

# npm (كل المنصات)
npminstall-g@github/copilot

# أول تشغيل
copilot# يفتح interactive session
/login# يوثق حسابك على GitHub
/model# يختار الـAI model
تثبيت وتفعيل Copilot CLI
➜ ~ npm install -g @githubnext/github-copilot-cli
✓ Installed @githubnext/github-copilot-cli@0.1.74
➜ ~ github-copilot-cli auth
⠋ Authenticating with GitHub...
✓ Signed in as yourusername
➜ ~⏎ نفّذ · ⌫ امسح

SectionProgrammatic Mode — للـCI/CD والأتمتة

bash
copilot-p"Summarize recent commits"# سؤال سريع
copilot-p"Fix tests"--allow-tool='shell(npm test)'# مع تحديد الأدوات
copilot--modeautopilot-p"Refactor auth"# autopilot
copilot--continue# يكمل آخر session
copilot--resumemy-session# يكمل session بالاسم
copilot--agent"Security Auditor"-p"Review code"# agent مخصص
copilot--share# يحفظ كـmarkdown
copilot--share-gist# يحفظ كـGitHub gist

Sectionالأوضاع (Modes)

الوضعازاي تدخلهبيعمل إيه
Interactivecopilotيقترح وينفذ مع سؤال قبل كل أداة
PlanShift+Tab أو --mode planيبني خطة تنفيذ من غير كود
AutopilotShift+Tab مرتين أو --autopilotيكمل لحد ما المهمة تخلص

Sectionإدارة الجلسات

الأمربيعمل إيه بالظبطإمتى تستخدمهليه مهم
/loginيوثق حسابك على GitHub عبر OAuth أو PATأول مرة أو لما تنتهي الـsessionمش هتقدر تستخدم Copilot من غير توثيق
/logoutيخرجك من GitHubلما تبغي تبدل حسابعشان تبدل بين حسابات مختلفة
/modelيفتح model picker أو يبدل الـmodel بالاسملما تبغي تغير الـAI modelكل model له نقاط قوة مختلفة
/clearيمسح تاريخ المحادثة ويبدأ من الصفرلما تبغي تبدأ موضوع جديدcontext نضيف = نتائج أحسن
/resumeيكمل session سابقة (picker تفاعلي)لما تبغي ترجع لشغل قديمبيوفر الوقت — مش محتاج تبدأ من الصفر
/forkيعمل نسخة مستقلة من الـsessionلما تبغي تجرب حاجة من غير تضيع الأصلآمن للتجريب
/sessionإدارة الجلسات (info, rename, delete)لما تبغي تنظم الجلسات/session id يديك الـID
/compactيضغط الـcontext windowلما تقرب تمتلي الـcontextبيوفر tokens وبيمسك المهم
/askسؤال سريع من غير ما يتأثر في المحادثةلما تبغي تسأل سؤال بسيطمش بيتأثر في الـcontext
/shareيحفظ الـsession كـmarkdown أو gistلما تبغي تشارك المحادثة/share html يديك HTML

Sectionالتنفيذ و الـAgent

الأمربيعمل إيه بالظبطإمتى تستخدمهليه مهم
/agentيفتح picker لاختيار أو إنشاء custom agentلما تبغي تستخدم agent مخصصكل agent ليه model وأدوات مختلفة
/delegateيفوض مهمة للـcloud coding agentلما تبغي الـagent يشتغل في الخلفيةبيعمل branch وPR ويكمل في background
/tasksيعرض background tasksلما تبغي تشوف إيه بيشتغلتقدر تـkill أو تـmonitor
/autopilotيبدل autopilot modeلما تبغي الـagent يكمل لوحدهبحد 5 continuation messages
/goalalias لـ /autopilot <objective>نفس اللي فوقأسرع في الكتابة
/planيدخل plan modeلما تبغي تعمل خطة أولبيمسك سوء الفهم قبل الكود
/rubber-duckيطلب نقد مستقل من agent تانيلما تبغي رأي تاني على الحلAI بيراجع AI — حاجة فريدة
&<prompt>تفويض مباشر للخلفيةلما تبغي delegate بسرعةاختصار لـ /delegate

Sectionالملفات و المراجعة

الأمربيعمل إيه بالظبطإمتى تستخدمهليه مهم
/diffيعرض التعديلات بـvim-style (j/k, w/W, g/G)لما تبغي تشوف إيه اتغيربيعرض inline diffs مع syntax highlighting
/reviewمراجعة أمنية للتغييراتلما تبغي تتأكد مفيش ثغراتبيفحص الكود للـsecurity vulnerabilities
/rewindيرجع لـcheckpoint سابق في gitلما الـagent يعمل حاجة غلطبيشيل تعديلات الـagent بس
/cwdيغير الـworking directoryلما تبغي تشتغل في folder تانيمش محتاج تخرج وترجع
/add-dirيضيف directory موثوقلما تبغي تدي الـagent access لمكانLocation-based permission persistence
/worktreeيعمل git worktree ويتحول ليهلما تبغي تشتغل على feature منفصلalias: /move

Sectionالسياق و الإعداد

الأمربيعمل إيه بالظبطإمتى تستخدمه
/contextيعرض token usage, context window, والـcontext المحمللما تبغي تفهم إيه في الـcontext
/envيعرض البيئة المحملة (instructions, MCP, skills, agents, hooks)لما تبغي تتأكد إن كل حاجة شغالة
/settingsمحرر إعدادات تفاعليلما تبغي تغير configuration
/memory on/off/showيدير الذاكرة المستمرة عبر الجلساتلما تبغي الـagent يتذكر حاجة
/initيعمل copilot instructions للمشروعلما تبدأ مشروع جديد
/lspحالة LSP servers (show, test, reload)لما تبغي تشوف language servers
/statuslineتخصيص شريط الحالة في الـfooterلما تبغي تشوف model, branch, tokens
/themeاختيار الثيم (GitHub Dark/Light)لما تبغي تبدل مظهر الـCLI
/userتبديل الحساباتلما تبغي تبدل بين حسابات GitHub

SectionالـMCP و الـExtensions

الأمربيعمل إيه بالظبطإمتى تستخدمه
/mcpيدير MCP serversلما تبغي تضيف أو تشوف MCP
/mcp show <name>يعرض تفاصيل server وأدواته المتاحةلما تبغي تفهم server بيعمل إيه
/mcp searchيبحث في MCP server registry ويثبتلما تبغي تضيف MCP server جديد
/plugin installيثبت plugin من GitHub repo أو URLلما تبغي تضيف plugin
/plugin update --allيحدّث كل الـplugins المثبتةلما تبغي تحدّث
/plugin marketplaceيتصفح ويثبت plugins من المجتمعلما تبغي تكتشف plugins جديدة

SectionالـSkills — أوامر مخصصة

الأمربيعمل إيهإمتى تستخدمه
/skillsيعرض skills المتاحة ويديرهالما تبغي تشوف إيه skills محملة
/skills add <path>يضيف skill من directoryلما تبغي تضيف skill مخصص
/skills remove <name>يشيل skillلما تبغي تشيل skill مش محتاجه
/skill-nameينفذ skill بالاسماختصار لاستدعاء skill

Sectionالجدولة — الـSecret Weapon

الأمربيعمل إيه بالظبطمثال عملي
/every <interval>يكرر أمر على فترات/every 1h Run frontend tests and report failures
/after <delay>ينفذ أمر مرة واحدة بعد تأخير/after 30m Check if the build passed
/keep-aliveيمنع النظام من النوملما تبغي الـCLI يفضل شغال

ده معناه إنك تقدر تعمل monitoring تلقائي من جوه الترمنال — من غير cron jobs منفصلة.

Sectionالتصحيح و المعلومات

الأمربيعمل إيه بالظبطإمتى تستخدمه
/usageيعرض استهلاك tokens, credits, session statsلما تبغي تشوف إيه قدر استهلكت
/chronicleتاريخ الجلسة (standup, search, cost-tips)لما تبغي تلخص إيه اتعمل
/chronicle cost-tipsنصائح لتقليل التكلفةلما تبغي تقلل token usage
/feedbackيبعت feedback سري لـGitHubلما تبغي تبلغ عن مشكلة
/changelogيعرض ملاحظات الإصدارلما تبغي تشوف إيه جديد
/helpيعرض المساعدةلما تبغي تعرف الأوامر
/versionيعرض رقم الإصدارلما تبغي تتأكد من النسخة
/updateيثبت أحدث إصدارلما تبغي تحدث

Sectionالأذونات (Permissions)

الـTriad: Allow / Ask / Deny

الحالةمعناهامثال عملي
ALLOWينفذ من غير سؤالgit status * — آمن 100%
ASKيسأل المستخدم الأولrm -rf node_modules — خطر محتمل
DENYيرفض التنفيذأوامر ضارة أو محظورة
bash
# أوامر الأذونات السريعة
/allow-all# يوافق على كل حاجة (خطر!)
/yolo# نفس /allow-all
--allow-tool='shell(git)'# يسمح بأداة معينة
--allow-all-paths# يسمح بالوصول لكل المسارات
--allow-all-urls# يسمح بالوصول لكل URLs
--excluded-tools# يمنع أدوات معينة

⚠️ تحذير: --allow-all-tools يعطي Copilot نفس صلاحياتك — يقدر يشغل أي أمر ويعدل أي ملف.

SectionالـConfiguration

ملفات الإعداد

الملفالغرض
~/.copilot/settings.jsonإعدادات المستخدم
~/.copilot/config.jsonالحالة الداخلية (تلقائي)
~/.copilot/mcp-config.jsonMCP servers
~/.copilot/lsp-config.jsonLSP servers
~/.copilot/instructions/**/*.mdتعليمات المستخدم
.github/copilot/settings.jsonإعدادات المشروع
.github/instructions/*.mdتعليمات المشروع (بـapplyTo patterns)
.github/agents/*.mdتعريف agents مخصصة
.mcp.jsonإعداد MCP للمشروع

MCP Server Config

json
{
  "mcpServers": {
    "slack": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-slack"],
      "env": {"SLACK_BOT_TOKEN": "${SLACK_BOT_TOKEN}"}
    }
  }
}

Custom Agent Config

yaml
# .github/agents/security-auditor.md
---
name: Security Auditor
description: Reviews code for security vulnerabilities
model: claude-opus-4.7
tools: [view, grep, glob]
skills: [security-review]
deferred-tool-loading: true
---
You are a security auditor. Review all code changes for...

LSP Config

json
{
  "lspServers": {
    "typescript": {
      "command": "typescript-language-server",
      "args": ["--stdio"],
      "fileExtensions": {".ts": "typescript", ".tsx": "typescript"}
    }
  }
}

SectionModels المتاحة

Modelالاستخدام المثالي
Autoيختار تلقائياً (default لبعض الخطط)
Claude Sonnet 4.5الـdefault — توازن بين السرعة والجودة
Claude Sonnet 4أسرع، أقل عمق — مهام بسيطة
Claude Opus 4.7أعمق تحليل — مهام معقدة
Claude Opus 4.8أحدث إصدار
Claude Fable 5تجريبي
GPT-5 / 5.2نموذج OpenAI
GPT-5.4 / 5.5subagents العامة
Haiku 4.5سريع وبسيط — مهام خفيفة

SectionKeyboard Shortcuts

الاختصارالوظيفة
Shift+Tabيبدل بين الأوضاع (Interactive → Plan → Autopilot)
Ctrl+Cيلغي العملية الحالية
Esc Escيتراجع عن التعديلات (undo)
Ctrl+Lيمسح الشاشة (keep session)
Ctrl+Oيوسع آخر timeline entries
Ctrl+Eيوسع كل timeline
Ctrl+Sيحفظ ويسترجع الـprompt
Ctrl+Tيبدل reasoning summaries
Ctrl+Yيقبل الاقتراح المحدد
Ctrl+X → Bينقل مهمة للخلفية
Ctrl+X → /ينفذ slash command
Ctrl+Dيضيف slash command للطابور
Tabيقبل completion / navigate picker
@إكمال مسار ملف
#إشارة لـissue
/قائمة slash commands
!تنفيذ shell command
&تفويض مهمة للخلفية
j/kتنقل vim-style
wإخفاء whitespace في diff

SectionQuick Decision Guide

السيناريوابدأ هنا
أول مرة تستخدم Copilot CLIcopilot/login
عايز تشوف إيه اتعمل في الـsession/diff
عايز يكمل لوحده/autopilot أو Shift+Tab مرتين
عايز يبني خطة الأول/plan أو Shift+Tab
عايز يشتغل على issueFix issue #42 — الـMCP هيلاقيه
عايز يشوف tokens/context و /usage
عايز تضيف MCP server/mcp search
عايز تعرف agent مخصص/agent → Create New
عايز تضيف skill/skills add /path/to/skill
عايز مراجعة أمنية/review أو /security-review
عايز تابع في الخلفية/delegate Fix all tests أو &Fix all tests
عايز يتذكر حاجة/memory on ثم قوله المعلومة
عايز تكرر أمر/every 1h Run tests
عايز يرجع لـcheckpoint/rewind