import { Command } from "@oclif/core"; import type { Profile } from "./profiles/types.js"; /** * AR: عقد رموز الخروج، معروضًا في مساعدة كل أمر (017/FR-032، T075). ليس تفصيلًا داخليًا: سكربت * بوّابة يفرّق به بين «المنفذ محجوز» و«التشخيص وجد عائقًا» دون أن يحلّل نصًّا إنجليزيًا. * EN: The exit-code contract, shown in every command's help (017/FR-032, T075). Not an internal * detail: a gate script uses it to tell "the port was busy" from "diagnosis found a blocker" * without parsing English prose. */ export declare const EXIT_CODE_HELP: string; export interface UpdateGateOptions { /** ‎--no-update-check‎ يُطفئها. */ enabled: boolean; product?: string; /** يُمرَّر إلى ‎update‎ فيستنتج نفس الجهاز الذي عُرض على المالك. */ profile?: string; /** ‎--json‎ مخرَجٌ للآلات: لا محثّ فيه ولا سطر إعلان. */ json?: boolean; } export declare abstract class BaseCommand extends Command { static baseFlags: { profile: import("@oclif/core/interfaces").OptionFlag; json: import("@oclif/core/interfaces").BooleanFlag; /** * AR: أيّ منتجٍ يقصد هذا الأمر؟ (٠٢٦) * * **يُستنتَج عند الوحدة ويُطلَب عند التعدّد.** أمرُ إيقافٍ يصيب الجهاز الخطأ في استراحةٍ * تعمل أسوأ من أمرٍ يسأل — ولذلك لا تخمين هنا، والرفض يعدّد الأسماء بدل أن يقول «حدّد». * * وموضعه في الأساس لا في كل أمر: سطرٌ يُكرَّر في ستّةٍ وثلاثين ملفًّا يُنسى في السابع * والثلاثين، فيصير أمرٌ واحدٌ لا يقبل العَلَم بلا أن يلاحظ أحد. * EN: Which product does this command act on? (026) * * **Inferred when there is one, required when there are several.** A stop command hitting * the wrong appliance in a working rest-house is worse than a command that asks — so nothing * is guessed here, and the refusal lists the names rather than saying "specify one". * * It belongs in the base rather than in every command: a line repeated across thirty-six * files is forgotten in the thirty-seventh, leaving one command that ignores the flag with * nobody noticing. */ product: import("@oclif/core/interfaces").OptionFlag; elevated: import("@oclif/core/interfaces").BooleanFlag; }; /** * AR: النافذة المرفوعة جديدة وتُغلَق مع آخر سطر — فتُمسَك حتى يضغط صاحبها Enter، وإلّا ومضت النتيجة واختفت. * EN: The elevated window is a new one and closes with the last line — so it is held until Enter, or the * outcome flashes and vanishes. */ protected finally(error: Error | undefined): Promise; /** * AR: يُنفَّذ قبل جسم أيّ أمر (‎oclif‎ يناديها لكل أمر). وهو الموضع الوحيد الذي يضمن أن **كل** * أمرٍ يمرّ بفحص بيئة التشغيل، بلا سطرٍ مكرَّرٍ في ستّةٍ وثلاثين ملفًّا يُنسى في السابع * والثلاثين. * EN: Runs before any command's body (oclif calls it for every command). It is the one place that * guarantees **every** command passes the runtime check, with no line repeated across * thirty-six files and forgotten in the thirty-seventh. */ init(): Promise; /** * AR: يستنتج ملفّ التشغيل **إن وُجد**، ويعيد ‎undefined‎ إن لم يوجد — بلا خروجٍ ولا رسالة. * * مستهلكه الوحيد الصَدَفة: تفتح على آلةٍ فارغة لأنها الموضع الذي يُثبَّت منه النظام * (٠٢٦). وكلّ أمرٍ آخر يبقى على ‎loadProfile‎ الذي يخرج برسالةٍ تقول ماذا يفعل — لأن * ‎status‎ على آلةٍ بلا نظام **خطأ**، بينما فتحُ صَدَفةٍ عليها ليس كذلك. * EN: Resolves the run profile **if there is one**, and returns `undefined` when there is not — * with no exit and no message. * * Its only consumer is the shell: it opens on an empty machine because it is the place from * which the system gets installed (026). Every other command stays on `loadProfile`, which * exits with a message saying what to do — because `status` on a machine with no system **is** * an error, while opening a shell on one is not. */ protected loadProfileOrNothing(kind?: string, product?: string): Profile | undefined; protected loadProfile(kind?: string, ensureDirs?: boolean, product?: string): Profile; /** * جواب موحّد حين لا تُجيب النواة (017/FR-015). * * كل أمر إدارة يمرّ بهذه الحالة، وتكرار صياغتها في اثني عشر ملفًا يُنتج اثنتي عشرة صياغة تختلف * قليلًا وتتباعد مع الوقت. **ولا يتراجع أي أمر إلى قراءة البيانات بنفسه**: هذا هو الحدّ الذي * يفصل «الـ CLI يعرض» عن «الـ CLI يقرّر». */ protected coreUnreachable(command: string, profile: Profile, reason: string, json: boolean): never; /** * AR: **بوّابة التحديث قبل الإقلاع** — الخطوة الأولى في ‎start‎ و‎restart‎ (مواصفة 003). * * التسلسل ثابت (D1): **الأداة ← النظام ← الخدمات**. الأداة تحدّث نفسها قبل هذا في ‎selfUpdateFirst‎ * (2026-10-12)، فهنا الحزمة وحدها: ‎preBootStep‎ — فحصٌ بهويّة الجهاز وتثبيتٌ * **إجباريّ بلا سؤال**. لم يعد هنا «ثبّته الآن؟» — تحديثٌ يُسأل عنه تحديثٌ يُؤجَّل، وثغرةٌ تبقى. * * تعيد ‎true‎ حين أُقلعت الخدمات داخل الخطوة (تثبيتٌ نجح، أو تراجعٌ بعد فشل) فيعود المُنادي بلا * إقلاعٍ ثانٍ على منافذ محجوزة. * EN: **The pre-boot update gate** — the first step of `start` and `restart` (spec 003). * * The order is fixed (D1): **CLI ← system ← services**. The CLI updated itself before this, in * `selfUpdateFirst` (2026-10-12), so here is the bundle alone: `preBootStep` — a check by device * identity and a **mandatory install without asking**. There is no * "install it now?" here any more — an update that is asked about is an update postponed, and a * vulnerability left open. * * Returns `true` when the services came up inside the step (an install that succeeded, or a * rollback after one that failed), so the caller returns without a second start on ports it holds. */ protected updateGate(profile: Profile, options: UpdateGateOptions): Promise; /** * AR: **الأداة تحدّث نفسها قبل أيّ سؤالٍ عن الصلاحية** (2026-10-12) — الخطوة الأولى من D1 مفصولةً عن بوّابة * التحديث. ‎npm i -g‎ يكتب في ‎%AppData%\npm‎ لحساب صاحب الجهاز نفسه فلا يحتاج مديراً. كانت داخل * ‎updateGate‎ بعد ‎ensureElevated‎ وفحص الكتابة: 1.8.1 يخرج قبلها فلا تتحدّث أداته أبداً، و1.8.2–1.8.4 لا * تتحدّث إلا بعد «نعم» في نافذة UAC. وإن تحدّثت يُعاد الأمر كلّه بالجديدة ويُخرَج بكودها. * EN: **The CLI updates itself before any question about rights** (2026-10-12) — D1's first step, split from * the update gate. `npm i -g` writes to the owner's own `%AppData%\npm`, so it needs no administrator. It * sat inside `updateGate`, after `ensureElevated` and the write probe: 1.8.1 exits before it and never * updates itself, and 1.8.2–1.8.4 update only after "Yes" on the UAC prompt. When it updates, the whole * command re-runs with the new one and exits with its code. */ protected selfUpdateFirst(options: UpdateGateOptions): Promise; /** ‎--json‎ مخرَجٌ للآلات: التحديث يجري كما هو (إجباريّ)، لكن بلا أسطرٍ تفسد الـ JSON. */ private updateSay; /** * AR: **يطلب الرفع قبل أن يحتاجه الأمر** (2026-10-10). على جهازٍ ويندوز بلا صلاحية مدير يُعاد الأمر نفسه * مرفوعاً بعد نافذة UAC، ويُخرَج بكود النسخة المرفوعة. الرفض أو التعذّر يعيد ‎false‎ فيمضي المُنادي بلا * رفع — بوّابة التحديث تتخطّى نفسها حينها. لا يُطلب في ‎--json‎ ولا بلا طرفيّة: سكربتٌ لا يجيب نافذة. * EN: **Asks for elevation before the command needs it** (2026-10-10). On a Windows appliance without * administrator rights the same command is re-run elevated after the UAC prompt, and this one exits with * the elevated run's code. Declined or unavailable returns `false` and the caller carries on unelevated — * the update gate then skips itself. Never asked under `--json` or without a terminal: a script answers * no prompt. */ protected ensureElevated(profile: Profile, options: { json?: boolean; elevated?: boolean; declined?: string; }): Promise; /** * AR: **«نعم» الأخيرة** (2026-10-31). مع كل تشغيلٍ مرفوع: قاعدة جدار الحماية (‎packaging/firewall.ts‎)، ومهمّة تسجيل * الدخول إن غابت (‎packaging/logon-task.ts‎) — فلا يُسأل صاحب الجهاز عن الصلاحية بعد هذه المرّة. ولا تُسجَّل ما دامت * مهمّة الإقلاع مفعّلة: طريقان يُقلعان الخدمات هما التضارب نفسه. ومهمّة الإقلاع لا تُسجَّل من هنا أبدًا. * EN: **The last "Yes"** (2026-10-31). On every elevated run: the firewall rule (`packaging/firewall.ts`), and the logon * task when missing (`packaging/logon-task.ts`) — so the owner is not asked for permission after this time. Not * while the boot task is enabled: two roads starting the services is the collision itself. And the boot task is * never registered from here. */ protected healBootIntegration(profile: Profile, json?: boolean): Promise; private adminRights; /** سؤال الصلاحية يكلّف PowerShell كاملاً — يُسأل مرّةً لكل أمر. */ protected isAdmin(): Promise; } //# sourceMappingURL=base-command.d.ts.map