refactor: rename internal Fai* design system + fai_ helpers to chain
Some checks failed
Security / Security check (push) Failing after 2s

The Studio design system, widgets and helpers carried a Fai* / fai_
prefix (FaiSpace, FaiColors, FaiTheme, FaiLog, 17 fai_*.dart files, the
faiBinary* l10n keys). Studio is the Ch∆In product, so rename them to
Chain* / chain_ — carefully preserving English fail/failure/failed.
Also fix stale references: the 'fai' binary in l10n strings -> 'chain',
FAI_* env vars (FAI_BIN/DATA_DIR/MODULES_DIR/TODAY/BOOTSTRAP_TOKEN) ->
CHAIN_*, fai_platform -> fai_chain, fai_hub -> chain_hub. Vendor
security-hook tooling (FAI_BANNED_TERMS_FILE) + the .fai bundle ext left.
flutter analyze + test: clean (20 passed).

Signed-off-by: flemming-it <stefan.a.flemming@googlemail.com>
This commit is contained in:
flemming-it 2026-06-16 17:53:17 +02:00
parent 68d23ab7dd
commit 891acd2ba2
52 changed files with 1225 additions and 1225 deletions

View file

@ -22,7 +22,7 @@ import 'package:shared_preferences/shared_preferences.dart';
/// Sentinel returned in `_runFai(...).stderr` when no `fai`
/// binary could be located. UI layers should not display this
/// verbatim they check [SystemActions.faiBinaryExists] first
/// verbatim they check [SystemActions.chainBinaryExists] first
/// and render a localized, actionable message instead.
const String kFaiBinaryNotFound = 'fai-binary-not-found';
@ -37,7 +37,7 @@ class SystemActions {
/// SharedPreferences key for an operator-chosen `fai` binary
/// path (set via the file picker when auto-detection fails).
static const String _kFaiBinaryPrefKey = 'system.fai_binary_path';
static const String _kFaiBinaryPrefKey = 'system.chain_binary_path';
/// In-memory cache of the operator override, loaded once at
/// startup by [loadFaiBinaryOverride]. Null = no override.
@ -71,7 +71,7 @@ class SystemActions {
/// the canonical install dir). UI uses this to decide between
/// the normal daemon-control affordances and the "locate the
/// binary / read the install guide" recovery path.
static bool faiBinaryExists() => _faiExecutable() != null;
static bool chainBinaryExists() => _faiExecutable() != null;
/// Ask the OS to open [path] in the default handler. On macOS
/// this opens text files in TextEdit, configs in the registered
@ -137,7 +137,7 @@ class SystemActions {
/// Run a `chain daemon ...` subcommand and surface the captured
/// output. Used by Doctor's "Restart daemon" button.
static Future<({bool ok, String stdout, String stderr})> faiDaemon(
static Future<({bool ok, String stdout, String stderr})> chainDaemon(
List<String> args,
) async {
return _runFai(['daemon', ...args]);
@ -145,7 +145,7 @@ class SystemActions {
/// Run `chain update apply --channel <c>`. Long-running on a slow
/// network caller should show a spinner.
static Future<({bool ok, String stdout, String stderr})> faiUpdateApply(
static Future<({bool ok, String stdout, String stderr})> chainUpdateApply(
String channel,
) async {
return _runFai(['update', 'apply', '--channel', channel]);
@ -154,7 +154,7 @@ class SystemActions {
/// Switch the active channel pointer at `~/.chain/current-channel`.
/// The CLI also restarts the daemon for the new channel, so the
/// caller does not need a follow-up restart.
static Future<({bool ok, String stdout, String stderr})> faiChannelSwitch(
static Future<({bool ok, String stdout, String stderr})> chainChannelSwitch(
String channel,
) async {
return _runFai(['channel', 'switch', channel]);
@ -164,14 +164,14 @@ class SystemActions {
/// (launchd plist on macOS, systemd-user unit on Linux). On
/// Windows the platform CLI returns a "not supported" exit
/// status that the caller surfaces as an error message.
static Future<({bool ok, String stdout, String stderr})> faiDaemonEnable(
static Future<({bool ok, String stdout, String stderr})> chainDaemonEnable(
String channel,
) async {
return _runFai(['daemon', 'enable', '--channel', channel]);
}
/// Remove the autostart unit installed by [faiDaemonEnable].
static Future<({bool ok, String stdout, String stderr})> faiDaemonDisable(
/// Remove the autostart unit installed by [chainDaemonEnable].
static Future<({bool ok, String stdout, String stderr})> chainDaemonDisable(
String channel,
) async {
return _runFai(['daemon', 'disable', '--channel', channel]);
@ -186,7 +186,7 @@ class SystemActions {
///
/// Studio's gRPC channel goes down for ~1s while the daemon
/// restarts caller should follow up with a reconnect.
static Future<({bool ok, String stdout, String stderr})> faiReset({
static Future<({bool ok, String stdout, String stderr})> chainReset({
bool keepModules = false,
bool keepData = false,
}) async {
@ -202,9 +202,9 @@ class SystemActions {
final exe = _faiExecutable();
if (exe == null) {
// Sentinel, not a user-facing string. Callers detect this
// via `faiBinaryExists()` and render a localized,
// via `chainBinaryExists()` and render a localized,
// actionable recovery message (locate binary / install
// guide) instead of CLI jargon like "set FAI_BIN".
// guide) instead of CLI jargon like "set CHAIN_BIN".
return (ok: false, stdout: '', stderr: kFaiBinaryNotFound);
}
try {
@ -226,7 +226,7 @@ class SystemActions {
}
/// Locate the `fai` binary. Order: operator override (set via
/// the file picker), $FAI_BIN, PATH, fallback to the canonical
/// the file picker), $CHAIN_BIN, PATH, fallback to the canonical
/// install location under the user's home dir.
static String? _faiExecutable() {
final override = _faiBinaryOverride;
@ -236,7 +236,7 @@ class SystemActions {
return override;
}
final fromEnv = Platform.environment['FAI_BIN'];
final fromEnv = Platform.environment['CHAIN_BIN'];
if (fromEnv != null && fromEnv.isNotEmpty && File(fromEnv).existsSync()) {
return fromEnv;
}