control-cli
ما الذي تفعله
تتيح للمساعد أن يشغّل برنامج طرفية تفاعلياً، ويرسل إليه ضغطات المفاتيح، ويسجل ما يعرضه. وهي للمطورين الذين يختبرون سلوك سطر الأوامر وتطبيقات الطرفية.
متى تستخدمها
- ✓عندما يحمل تطبيق سطر أوامر أو طرفية خطأً تحتاج إلى إعادة إنتاجه بثبات.
- ✓عندما تريد فحص تدفقات لوحة المفاتيح أو المطالبات أو تخطيط الطرفية.
- ✓عندما تحتاج إلى قياس وقت بدء التشغيل أو التوقف أو نمو الذاكرة في تطبيق سطر أوامر.
رابط المهارة
https://github.com/cursor/plugins/blob/main/cursor-team-kit/skills/control-cli/SKILL.mdانسخه والصقه في الذكاء الاصطناعي الذي تستخدمه (Claude أو ChatGPT أو Cursor) واطلب منه اتباع التعليمات.
طريقة الاستخدام
أسهل طريقة: انسخ الرسالة والصقها في الذكاء الاصطناعي الذي تستخدمه. سيقرأ المهارة وينفّذ تعليماتها.
رسالة جاهزة للصق
لـ Claude Code أو Codex أو Cursor: شغّله داخل مجلد مشروعك وستُثبَّت المهارة.
نزّل ملف SKILL.md وضعه في مجلد مهارات وكيلك.
مثال على ما تطلبه من الذكاء الاصطناعي
“شغّل سطر الأوامر لدينا، وتجاوز مطالبة تسجيل الدخول بمدخلات اختبار، واحفظ نصاً لكل الشاشات.”
5 مهارات جديدة كل أسبوع. قراءة في دقيقة واحدة.
كيف تعمل
يعيد المساعد استخدام أداة الاختبار أو العرض الخاصة بالمستودع إن وُجدت. وإلا يبدأ البرنامج في طرفية معزولة، ويرسل إجراءً واحداً في كل مرة، وينتظر ظهور النص المتوقع على الشاشة، ثم يحفظ النص.
المحتوى التقني (ملف SKILL.md الأصلي)
النص الأصلي من المؤلف، مباشرة من GitHub.
Control CLI
Use a repeatable local harness to exercise an interactive CLI instead of poking at it manually. First reuse the repo's own test/demo harness if it exists; otherwise assemble a temporary harness from standard local tools.
What It Is Used For
- Reproducing CLI/TUI bugs with deterministic input.
- Verifying keyboard flows, prompts, interrupts, resize behavior, and terminal layout.
- Capturing before/after transcripts for bug fixes.
- Profiling startup time, slow operations, hangs, or memory growth.
- Recording a short terminal demo when output is easier to show than explain.
Harness Loop
- Identify the command under test and the smallest reproducible workspace.
- Discover existing local harnesses: package scripts, e2e tests, demo recorders, expect scripts, or PTY helpers.
- If no harness exists, launch the CLI in an isolated terminal session with deterministic env vars.
- Capture the current screen before interacting.
- Send one action at a time: text, Enter, arrows, Escape, Ctrl-C, resize.
- Wait for a concrete screen pattern or prompt before the next action.
- Save the transcript and any profile artifacts.
- Kill the session cleanly.
Harness Options
- Repo-native harness: prefer checked-in scripts because they know the app's startup, env, and prompts.
tmux: managed sessions,capture-pane,send-keys, attach/detach.- PTY probe: use a short Python, Node, or Expect script when tmux is unavailable.
- Runtime inspector: use Node or Bun inspector for CPU profiles, heap snapshots, and live evaluation.
- Terminal recorder: use repo-local demo tools or asciinema-compatible tools when the user asks for a demo.
Minimal tmux Harness
SESSION="cli-harness-$(date +%s)"
tmux new-session -d -s "$SESSION" -- <command-under-test>
tmux capture-pane -pt "$SESSION"
tmux send-keys -t "$SESSION" "help" Enter
tmux capture-pane -pt "$SESSION"
tmux kill-session -t "$SESSION"
For Node CLIs:
NODE_OPTIONS="--inspect=127.0.0.1:0" tmux new-session -d -s "$SESSION" -- <node-cli-command>
Read the terminal output to find the inspector URL, then use Chrome DevTools-compatible tooling if profiling is needed.
Minimal PTY Harness
Use a PTY script when you need deterministic waits in a repo that does not have tmux or a demo harness. Keep it temporary unless the user asks to add a reusable test.
import os
import pty
import select
import subprocess
import time
master_fd, slave_fd = pty.openpty()
proc = subprocess.Popen(
["<command>", "<arg>"],
stdin=slave_fd,
stdout=slave_fd,
stderr=slave_fd,
close_fds=True,
)
os.close(slave_fd)
deadline = time.time() + 30
buffer = b""
while time.time() < deadline:
ready, _, _ = select.select([master_fd], [], [], 0.25)
if not ready:
continue
chunk = os.read(master_fd, 4096)
buffer += chunk
if b"<ready text>" in buffer:
os.write(master_fd, b"help\n")
break
print(buffer.decode(errors="replace"))
proc.terminate()
os.close(master_fd)
If the CLI needs richer terminal control, use pty.fork() or an existing PTY library.
Profiling Recipes
- Startup regression: capture baseline and treatment startup timings under the same machine, env, and command.
- Slow operation: start a CPU profile, perform the operation, stop the profile, and compare top self-time functions.
- Memory leak: force GC if available, take a heap snapshot, perform the operation repeatedly, force GC again, and take another snapshot.
- Hang: capture the screen, active handles/resources, and a stack/CPU sample before interrupting.
Guardrails
- Prefer deterministic waits over sleeps. If you must sleep, explain why.
- Do not send credentials or destructive commands into a controlled session.
- Keep the harness in
/tmpunless the repo already has a testing/demo harness. - Do not hard-code paths from another repository. Adapt commands to the current repo's scripts and runtime.
- Clean up tmux sessions, temp dirs, inspector processes, and demo artifacts unless the user asks to keep them.
الأسئلة الشائعة
هل يحتاج إلى خدمة خارجية؟
لا. تعمل الأداة محلياً باستخدام أدوات قياسية مثل جلسة الطرفية.
هل يستطيع تسجيل عرض توضيحي؟
نعم. يمكن تسجيل عروض الطرفية عندما يكون عرض المخرجات أسهل من شرحها.
ماذا لو كانت أدوات الاختبار موجودة في المستودع؟
يستخدم المساعد الأداة الموجودة أولاً، لأنها تعرف خطوات البدء والمطالبات.
التفاصيل
الوصف الأصلي من المؤلف
Build or adapt a local harness to drive, inspect, and profile an interactive CLI or TUI without external services. Use for CLI UX checks, startup regressions, memory leaks, hangs, prompt flows, or terminal demos.
repo: cursor/plugins
الشعبية
- نجوم GitHub
- 15k
- الترتيب
- #10931
- الترخيص
- —
- آخر تحديث
- 31/10/2026
التعليقات
- …
المزيد من المهارات من هذا المستودع
advisor
15kيتيح لوكيلك استشارة نموذج ثانٍ أقوى عند نقاط مفصلية، مثل قبل قرار كبير أو عند تعثره في خطأ، إذا فعّلت ذلك.
check-agent-compatibility
15kيُجري فحصاً شاملاً لمدى قدرة وكلاء البرمجة بالذكاء الاصطناعي على تشغيل المستودع والتحقق منه وتوثيقه، ويعيد درجة توافق واحدة مع أهم المشكلات.
cli-for-agents
15kيعلّم وكيلك تصميم أدوات سطر الأوامر أو مراجعتها، حتى يستطيع وكلاء الذكاء الاصطناعي تشغيلها دون مطالبات، مع نصوص مساعدة واضحة وأمثلة.
continual-learning
15kيحافظ على ملاحظاتك في AGENTS.md محدّثة، بتسليم مهمة مراجعة المحادثات السابقة إلى مُحدِّث ذاكرة مخصص.
مهارات مشابهة
test-driven-development
311kيعلّم وكيلك كتابة اختبار فاشل أولًا، ثم رؤيته يفشل، ثم كتابة أصغر شيفرة تنجحه، قبل بناء أي ميزة أو إصلاح.
verification-before-completion
311kيعلّم وكيلك تشغيل فحوصات حقيقية وقراءة نتائجها قبل أن يقول إن المهمة أو الإصلاح أو البناء مكتمل أو ناجح.
migrate-to-shoehorn
310kيستبدل تأكيدات النوع الخطرة في ملفات الاختبار بمكتبة shoehorn، حتى تتمكن الاختبارات من استخدام بيانات جزئية وتجتاز فحوص الأنواع.