مرجع
CLI
يتحدث الأمر qi إلى API نفسه الذي تستخدمه اللوحة. يصلح لشخص أو لمهمة cron أو لخط CI.
التثبيت
تثبّت الحزمة @sumeria.ai/qi الأمرين qi وqi-mcp. تتطلب Node 20 أو أحدث.
npm install -g @sumeria.ai/qi # the qi and qi-mcp commands, Node 20+
qi --helpبيانات الاعتماد
يسأل qi auth login أولًا أين تعمل — مؤسستك، أو البحث عنها ببريدك الإلكتروني، أو حساب شخصي (Free أو Pro) — ثم يفتح المتصفح لتوافق على هذا الجهاز: يُنشأ المفتاح ويُحفظ في مجلدك الشخصي، ولا يقرؤه غيرك. لاستخدام مفتاح من API Keys بدلًا من ذلك، شغّل qi auth login --key؛ لا يظهر أثناء الكتابة. تأتي المفاتيح بالشكل sk_live_tenant.… وتحمل المستأجر الخاص بها، فلا حاجة لكتابة مستأجر أو عنوان URL.
qi auth login
# Where do you work? your organization / find it by email / personal account (Free, Pro)
# The browser opens: approve this computer and the key is created and saved for you
qi auth status # account, branch and key in use (the key is masked)
qi auth login --tenant acme # skip the question: your organization's name
qi auth login --key # paste a key from API Keys instead (not echoed)
qi auth switch # sign in to another account; keeps the current one if it fails
qi auth switch --branch # another branch of your organization
qi auth logout # forget the key on this machineفي CI تتقدم البيئة على الملف: لا يُكتب شيء على القرص.
# CI: the key comes from the pipeline's secrets, never from a file or a flag.
# GitHub Actions, for example:
env:
QI_API_KEY: ${{ secrets.QI_API_KEY }}
# QI_TENANT only for older keys (sk_live_<hex>) that do not carry their tenant
# QI_BASE_URL advanced: point at another environmentلا يوجد خيار لمفتاح API، عن قصد: فالوسيط ينتهي في سجل الصدفة (shell) وفي قائمة العمليات التي يقرؤها كل مستخدم على الجهاز أثناء تشغيل العملية.
متغيرات البيئة
| المتغير | الغرض |
|---|---|
QI_API_KEY | المفتاح السري. |
QI_TENANT | فقط للمفاتيح القديمة (sk_live_ متبوعًا بسلسلة سداسية عشرية) التي لا تحمل المستأجر. |
QI_BASE_URL | متقدم: يشير إلى بيئة أخرى. لا حاجة إليه عادةً. |
QI_CONFIG_PATH | اختياري: ينقل ملف الإعدادات (وstate.json بجانبه). |
QI_STATE_PATH | اختياري: ينقل ملف حالة qi watch. |
QI_LANG | اختياري: لغة CLI (en وes …). |
الأوامر
qi auth login # sign in from the browser and save the key
qi auth status # which account and key are in use (masked)
qi auth switch [--branch] # another account, or another branch
qi auth logout # forget the key on this machine
qi doctor # config, API, plan, modules, name rules, ffmpeg
qi usage # plan, QI tokens used, period end
qi lang [code] # CLI language: en es zh pt fr de ja
qi upload audio <file|folder...> # recordings (Speech Analytics)
qi upload text <file|folder...> # conversations (Text Analytics)
qi upload bot <file|folder...> --bot <p> # bot conversations (Bot Analytics)
qi validate <file|folder...> # check names against the tenant's rules
qi rename <file|folder...> [--apply] # rename local files with --prefix/--suffix/--key
qi convert <file|folder...> --to <fmt> # convert audio with the system's ffmpeg
qi forms list [--type audio|text|bot] # forms and the key uploads use
qi bots list # bot profiles (plans with Bot Analytics)
qi interactions list [--all] # analysed conversations
qi interactions get <id> # status, dialogue, answers
qi interactions wait <id> # until processing finishes
qi interactions export --format csv|json # [--with-answers]
qi watch <folder...> # upload new files as they appear
qi schedule print --every <cron> -- ... # print a cron line or a schtasks commandتُقسَّم قوائم الملفات الطويلة تلقائيًا إلى دفعات من 10، ولا يُفشل ملف مرفوض واحد بقية الملفات: يُستبعد وتُعاد الدفعة.
الرفع الناجح يعني أن الملفات قُبلت ووُضعت في الطابور. يستغرق التفريغ والتحليل دقائق: يتوقف qi interactions wait حتى تستقر كل المراحل.
الخيارات
العرض والتصدير
| الخيار | الغرض |
|---|---|
--limit <n> --page <n> | حجم الصفحة (200 كحد أقصى) والصفحة، من 0. |
--from <date> --to <date> | تواريخ ISO، دائمًا معًا. |
--type <audio|text> | audio أو text. الافتراضي audio. |
--agent-type <human|bot> | human أو bot: من أجاب. |
--form <id> | التفاعلات المقيَّمة بذلك النموذج فقط (المعرّف). |
--all | كل الصفحات، لا صفحة واحدة فقط. |
--format <csv|json> --out <file> | التصدير: csv أو json، إلى ملف أو إلى الإخراج القياسي. |
--with-answers | التصدير: إضافة إجابات كل تفاعل. |
--timeout <s> --interval <s> | توقيت wait وwatch، بالثواني. |
--json | إخراج JSON، للسكربتات. |
الملفات والأسماء
| الخيار | الغرض |
|---|---|
-r, --recursive | النزول إلى المجلدات الفرعية. |
--include <glob> --exclude <glob> | قابل للتكرار، يُطابَق على اسم الملف. |
--prefix <p> --suffix <s> | الرفع (أو إعادة التسمية) باسم مختلف؛ والملف على القرص لا يُمس. |
--key <KEY> --key-from-folder | مفتاح النموذج يُلحق بصيغة _KEY (مستأجر مشترك)، أو اسم المجلد. |
--company <c> | مستأجر خاص: تحقق أيضًا من مقطع الشركة. |
الرفع
| الخيار | الغرض |
|---|---|
--form <key|id> | النموذج بالمفتاح أو المعرّف. |
--analysis <full|transcript> | مستأجر مشترك: full أو transcript. |
--bot <bot_id|name> | الملف الشخصي للروبوت بـ bot_id أو الاسم (upload bot). |
--concurrency <n> | طلبات من 10 ملفات قيد التنفيذ. الافتراضي 2. |
--retries <n> | إعادة المحاولة عند 429 و5xx، بتراجع أسّي. الافتراضي 3. |
--dry-run | اطبع الأسماء النهائية وما سيُرفض؛ لا ترسل شيئًا. |
--convert <mp3|wav|…> | حوّل باستخدام ffmpeg قبل الرفع. |
-i, --interactive | اختر النموذج والروبوت والتحليل من قائمة. |
التحويل
| الخيار | الغرض |
|---|---|
--to <mp3|wav|flac|ogg|m4a> | صيغة الإخراج: mp3 أو wav أو flac أو ogg أو m4a. |
--bitrate <64k> --mono --sample-rate <hz> --trim-silence --normalize | إعدادات الصوت المحوَّل. |
--out-dir <dir> | مجلد الإخراج. |
-y, --yes | ثبّت ffmpeg دون سؤال. وبدون طرفية يطبع CLI الأمر فقط: لا يثبّت أبدًا بصمت. |
المراقبة والجدولة
| الخيار | الغرض |
|---|---|
--type <audio|text|bot> | قناة watch: audio أو text أو bot. |
--interval <s> | كم مرة يُفحص المجلد، بالثواني. الافتراضي 60. |
--settle <s> | عدد الثواني التي يجب أن يثبت فيها حجم الملف قبل أخذه. الافتراضي 2. |
--done-dir <dir> | انقل ما أُرسل إلى هناك. |
--once | جولة واحدة فقط، لجدولة المهام. |
--every "<cron>" | تعبير cron للأمر schedule print. |
--platform <linux|darwin|win32> | لأي نظام يُطبع الأمر. |
--name <task> | اسم المهمة المجدولة. |
وصفات
رفع مجلد
انزل في المجلدات الفرعية، وصفِّ بنمط، واختر النموذج للدفعة كلها.
# A folder, recursively, only .mp3, evaluated against the form VENTAS
qi upload audio ./grabaciones -r --include "*.mp3" --form VENTAS
# Shared tenants: transcript only, no evaluation
qi upload audio ./grabaciones --analysis transcript
# Choose form, bot and analysis from a menu
qi upload audio ./grabaciones -iالبادئة واللاحقة والمفتاح
تغيّر الاسم الذي يُرسل به كل ملف، لا الملف نفسه. جرّب --dry-run أولًا؛ وqi rename --apply وحده يعيد التسمية على القرص.
# Preview the names files would be sent under; nothing is uploaded
qi upload audio ./grabaciones --prefix dev_ --suffix _lote2 --key VENTAS --dry-run
# Every reason a name is refused, per file (exit 1 if any is bad)
qi validate ./grabaciones
# Rename on disk: preview first, then --apply
qi rename ./grabaciones --prefix acme_
qi rename ./grabaciones --prefix acme_ --applyالتحويل قبل الرفع
يستخدم ffmpeg المثبّت بالفعل. وإن لم يوجد، يسأل في الطرفية قبل تثبيته (winget أو brew أو apt أو dnf، بحسب النظام).
# Convert, then upload the result (system ffmpeg, into a temporary folder)
qi upload audio ./wav --convert mp3
# Only convert
qi convert ./wav --to mp3 --bitrate 64k --mono --sample-rate 16000 --trim-silence --normalize
qi convert ./wav --to mp3 --out-dir ./mp3مراقبة مجلد
يتذكر ما أرسله في ~/.qi/state.json (المسار والحجم ووقت التعديل): يُرسل الملف مرة واحدة، ومرة أخرى فقط إذا تغيّر. ويُعاد إرسال الفاشل في الجولة التالية.
# Upload what lands in ./inbox, every 60 s, and move it to ./sent
qi watch ./inbox --interval 60 --done-dir ./sent --form VENTAS
# One round only, for a scheduler
qi watch ./inbox --onceالجدولة باستخدام cron أو Task Scheduler
يطبع qi schedule print سطر crontab أو الأمر schtasks /Create، بمسارات مطلقة إلى node وCLI. لا يثبّت شيئًا: تضيف السطر بنفسك.
# Linux / macOS: prints the crontab line
qi schedule print --every "0 2 * * *" -- upload audio /var/recordings --form VENTAS
# Windows: prints the schtasks /Create command (daily, weekly, hourly or every N minutes)
qi schedule print --every "0 2 * * *" --platform win32 --name qi-nightly -- upload audio D:\grabacionesقراءة النتائج وتصديرها
يتبع CSV المعيار RFC 4180، والنص الذي يبدأ بـ = أو + أو - أو @ يُسبق بفاصلة عليا ليعرضه جدول البيانات بدل أن ينفّذه.
qi interactions list --limit 25 --from 2026-09-01 --to 2026-09-08
qi interactions list --all --agent-type bot --json
qi interactions export --format csv --out week.csv --from 2026-09-01 --to 2026-09-08 --with-answers
qi interactions export --format json --with-answers > all.jsonرموز الخروج
| الرمز | المعنى |
|---|---|
0 | سليم. |
1 | فشل الطلب: السبب في stderr. |
2 | الأمر خاطئ. |
مصمم لـ cron وCI. الرفع الجزئي يخرج بالرمز 1 ويشرح السبب لكل ملف:
FAILED 1 accepted · 1 rejected · 0 failed
├─ SUCCEEDED call-001.mp3
└─ REJECTED notas.mp3 missingFields: 1 fields, 7 required: tenant_company_YYYYMMDD_HHMMSS_callId_clientId_agentId# Nightly upload, alerting only when it actually breaks
qi upload audio /var/recordings/$(date +%F) || notify-team "QI upload failed"موجِّه للوكلاء
الصق هذا في وكيل برمجة (Claude Code أو Cursor …) ليربط CLI بمشروعك.
You are integrating the Sumeria Quality Intelligence CLI (@sumeria.ai/qi) into this project.
1. Install: npm install -g @sumeria.ai/qi (or add it as a dev dependency for CI). Node 20+.
2. Authenticate once with "qi auth login": it asks where the user works and approves the
computer in the browser; the key is stored outside the repo. In CI, provide QI_API_KEY
from the pipeline's secrets instead — never as a command-line flag or in a file that
could get committed. QI_TENANT is only needed for older keys (sk_live_<hex>).
3. Use "qi upload audio <path>" and "qi upload text <path>" to send files or folders; they
go in requests of 10 and are retried on 429/5xx.
4. A successful upload only means the files were accepted and queued — use
"qi interactions wait <id>" or poll "qi interactions list" to see when they were analysed.
5. Exit codes: 0 fine, 1 the request failed (reason on stderr), 2 the command was wrong.
6. Wire this into our build/release process: <tell the agent where the files to upload
live in this repo, and when the command should run>.
Ask before writing any credential to a file that could be committed.