/** ما نعرف كيف نقرؤه. رقمٌ أعلى يعني ملفًّا كتبته واجهةٌ أحدث — نتوقّف ولا نخمّن. */ export declare const REGISTRY_SCHEMA_VERSION = 1; /** * AR: **دالّة لا ثابت.** الموضع يعتمد على المنصّة وعلى الحساب الذي نعمل به: مجلد بيانات البرامج * على ويندوز، و/var/lib/fantastic على لينكس حين نكون root — أو مجلد حالة المستخدم وفق XDG * حين لا نكون. وثابتٌ يُحسب عند تحميل الوحدة كان يجمّد جواب getuid() لحظةَ الاستيراد. * EN: **A function, not a constant.** The location depends on the platform and on whose account we * run as: the machine-wide program data directory on Windows, /var/lib/fantastic on Linux when * we are root — or the user's XDG state directory when we are not. A constant computed at module * load froze the answer to getuid() at import time. */ export declare function registryDir(): string; export declare function registryFile(): string; export type InstalledProduct = { id: string; version: string; root: string; ports: { core: number; live: number; }; installedAt: string; installedBy: string; /** * AR: كود التفعيل الذي رُكِّب به. **يُحفَظ ليُسأل المركز قبل الإقلاع لا لشيء آخر**: فحصُ إصدارٍ * جديد يحتاجه (المركز يحلّ الحزمة بالكود)، والنواة التي تحمل الرخصة لم تقلع بعد لحظةَ الفحص. * * **اختياريّ لأن غيابه حالةٌ عاديّة**: جهازٌ رُكِّب قبل هذا الحقل، أو سجلٌّ أُعيد بناؤه من * القرص (‎rebuild‎) — والقرص لا يحمل الكود. وغيابه يعني «لا فحص تلقائي»، لا عطلًا. * EN: The activation code the product was installed with. **Kept so the centre can be asked before * boot, and for nothing else**: checking for a newer bundle needs it (the centre resolves the * bundle by code), and the core that holds the licence has not started at the moment of the check. * * **Optional because its absence is ordinary**: a machine installed before this field, or a * registry rebuilt from disk (`rebuild`) — and the disk does not carry the code. Its absence * means "no automatic check", not a fault. */ activationCode?: string; }; /** * AR: يقرأ شجرة تثبيتٍ ويستنتج ما يعرفه عنها. **البيان هو الدليل**: مجلدٌ بلا ‎versions.json‎ * صالح ليس تثبيتًا لنا مهما كان اسمه، وقبولُه يُدرِج في السجلّ مجلدًا عشوائيًّا. * EN: Reads an install tree and infers what it can. **The manifest is the proof**: a directory * without a valid `versions.json` is not one of our installations whatever it is called, and * accepting it would list a random folder in the registry. */ export declare function inspectRoot(root: string, id?: string): InstalledProduct | undefined; /** * AR: يعيد بناء السجلّ من الأنظمة نفسها. يُستدعى حين يضيع الملفّ أو يتلف، **ولا يُستدعى في كل * أمر**: المسح أبطأ من قراءة ملفّ، والاختصار الذي يُحسَب في كل مرّة ليس اختصارًا. * EN: Rebuilds the registry from the installations themselves. Called when the file is lost or * corrupt, **not on every command**: scanning is slower than reading a file, and a shortcut * recomputed every time is not a shortcut. */ export declare function rebuild(extraRoots?: string[]): InstalledProduct[]; export type RegistryRead = { products: InstalledProduct[]; /** صحيح حين أُعيد البناء لأن الملفّ ضاع أو تلف — يُعلَن للمستخدم مرّة، ولا يُخفى. */ rebuilt: boolean; /** صحيح حين كتب الملفَّ إصدارٌ أحدث من هذه الواجهة: نتوقّف ونطلب تحديثها. */ newerSchema: boolean; }; /** * AR: **القراءة الوحيدة التي تُستعمل في الأوامر.** تقرأ، وتُسقط ما لم يعد موجودًا على القرص، * وتعيد البناء عند الحاجة. * * وإسقاطُ الجذر المفقود مقصود: قرصٌ نُزع أو مجلدٌ حُذف بيد أحدهم يترك قيدًا يشير إلى لا شيء، * وأمرُ حالةٍ يقرؤه يُبلّغ عن نظامٍ لا وجود له. ولا يُحذف القيد من الملفّ في القراءة — القراءة * لا تكتب؛ يسقط من الجواب، ويُكتب الملفّ عند أول تسجيلٍ أو إزالة. * EN: **The only read the commands use.** It reads, drops what no longer exists on disk, and * rebuilds when it must. * * Dropping a missing root is deliberate: an unplugged disk or a folder somebody deleted leaves * an entry pointing at nothing, and a status command reading it reports an appliance that does * not exist. The entry is not deleted from the file during a read — reads do not write; it is * dropped from the answer, and the file is rewritten at the next record or removal. */ export declare function readRegistry(): RegistryRead; /** * AR: ينقل كودًا بقي في ‎registry.json‎ إلى الملفّ المحميّ، ويمحوه من الفهرس. * * **يعمل عند القراءة لا عند التثبيت، وهذا هو بيت القصيد.** الأجهزة التي تحمل الكود نصًّا * مركَّبةٌ عند عملاء الآن، ولن يُعاد تثبيتها. فأوّل ‎doctor‎ أو ‎update‎ أو فحصٍ قبل الإقلاع * بعد ترقية الواجهة ينقل الكود ويستر أثره، بلا خطوةٍ يخطوها أحد وبلا أن يلاحظ العميل شيئًا. * * **ويفشل بصمت.** الترحيل تحسينٌ لا شرط تشغيل: تعذّرُه على حسابٍ لا يملك الكتابة يترك الحال * كما كان — وهو الحال الذي عاش به المنتج حتى اليوم — بينما إسقاط ‎doctor‎ لأجله يمنع الفنّي من * تشخيص عطلٍ حقيقيّ. * EN: Moves a code left in `registry.json` into the protected file and erases it from the index. * * **It runs on read rather than on install, and that is the whole point.** The appliances * carrying the code in plain text are installed at customer sites now and will not be * reinstalled. So the first `doctor`, `update` or pre-boot check after the CLI is upgraded moves * the code and covers its trace, with nobody taking a step and no customer noticing anything. * * **And it fails silently.** The migration is an improvement rather than an operating condition: * failing under an account without write access leaves things as they were — which is how the * product has lived until today — whereas failing `doctor` over it stops a technician diagnosing * a real fault. */ export declare function migrateLegacyActivationCode(): void; /** * AR: يسجّل منتجًا بعد **نجاح** تثبيته. الموضع في ‎install.ts‎ مقصود: بعد PATH ومهمّة الإقلاع، مع * بقيّة الآثار خارج مجلد التثبيت — فتثبيتٌ فشل وتراجع لا يترك قيدًا يشير إلى شجرةٍ حُذفت. * EN: Records a product after its installation **succeeded**. Its placement in `install.ts` is * deliberate: after PATH and the boot task, with the rest of the traces outside the install * directory — so a failed, rolled-back install leaves no entry pointing at a deleted tree. */ export declare function recordInstall(product: InstalledProduct): void; /** يزيل قيد منتجٍ بعد نجاح إزالته. غيابه أصلًا ليس خطأً — الغاية بلوغ حالةٍ لا تنفيذ خطوة. */ export declare function forgetInstall(id: string): void; /** * AR: منتجٌ واحد يُستنتَج، وأكثر يُطلب تحديده. **ولا يُخمَّن عند التعدّد**: أمرُ إيقافٍ يصيب * الجهاز الخطأ في استراحةٍ تعمل أسوأ من أمرٍ يسأل. * EN: One product is inferred; more than one must be named. **Never guessed when there are * several**: a stop command hitting the wrong appliance in a working rest-house is worse than a * command that asks. */ export declare function resolveProduct(products: InstalledProduct[], requested?: string): { product?: InstalledProduct; ambiguous: boolean; unknown: boolean; }; /** يُستعمل في الاختبارات وحدها: يمسح الملفّ. لا أمر ينادي هذه. */ export declare function forgetEverything(): void; //# sourceMappingURL=local-registry.d.ts.map