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

@ -1,7 +1,7 @@
import 'package:flutter/material.dart';
import '../data/error_presentation.dart';
import '../data/fai_log.dart';
import '../data/chain_log.dart';
import '../data/hub.dart';
import '../data/system_actions.dart';
import '../l10n/app_localizations.dart';
@ -47,7 +47,7 @@ class _DoctorPageState extends State<DoctorPage> {
tooltip: AppLocalizations.of(context)!.doctorRecheckTooltip,
onPressed: _refresh,
),
const SizedBox(width: FaiSpace.sm),
const SizedBox(width: ChainSpace.sm),
],
),
body: FutureBuilder<DoctorSnapshot>(
@ -58,7 +58,7 @@ class _DoctorPageState extends State<DoctorPage> {
}
if (snapshot.hasError) {
final l = AppLocalizations.of(context)!;
return FaiEmptyState(
return ChainEmptyState(
icon: Icons.cloud_off_outlined,
iconColor: Theme.of(context).colorScheme.error,
title: l.hubUnreachable,
@ -74,34 +74,34 @@ class _DoctorPageState extends State<DoctorPage> {
s.update.updateAvailable ||
(!s.update.manifestReachable && s.update.localVersion.isNotEmpty);
return ListView(
padding: const EdgeInsets.all(FaiSpace.xl),
padding: const EdgeInsets.all(ChainSpace.xl),
children: [
if (showUpdate) _UpdateBanner(status: s.update),
if (showUpdate) const SizedBox(height: FaiSpace.lg),
if (showUpdate) const SizedBox(height: ChainSpace.lg),
_SummaryStrip(snapshot: s),
const SizedBox(height: FaiSpace.xl),
const SizedBox(height: ChainSpace.xl),
_Section(
title: AppLocalizations.of(context)!.doctorEventLogSection,
child: _EventLogPanel(snapshot: s, onRefresh: _refresh),
),
const SizedBox(height: FaiSpace.lg),
const SizedBox(height: ChainSpace.lg),
_Section(
title: AppLocalizations.of(
context,
)!.doctorModulesApprovalsSection,
child: _ModulesPanel(snapshot: s),
),
const SizedBox(height: FaiSpace.lg),
const SizedBox(height: ChainSpace.lg),
_Section(
title: AppLocalizations.of(context)!.doctorHostServicesSection,
child: _ServicesPanel(snapshot: s),
),
const SizedBox(height: FaiSpace.lg),
const SizedBox(height: ChainSpace.lg),
_Section(
title: AppLocalizations.of(context)!.doctorDaemonFilesSection,
child: _DaemonPathsPanel(paths: s.paths),
),
const SizedBox(height: FaiSpace.lg),
const SizedBox(height: ChainSpace.lg),
_Section(
title: AppLocalizations.of(context)!.doctorDaemonControlSection,
child: _DaemonActionsCard(),
@ -128,8 +128,8 @@ class _Section extends StatelessWidget {
children: [
Padding(
padding: const EdgeInsets.only(
left: FaiSpace.xs,
bottom: FaiSpace.sm,
left: ChainSpace.xs,
bottom: ChainSpace.sm,
),
child: Text(
title.toUpperCase(),
@ -162,17 +162,17 @@ class _SummaryStrip extends StatelessWidget {
subtitle: l.doctorSummaryCapabilities(snapshot.capabilityCount),
icon: Icons.extension_outlined,
),
const SizedBox(width: FaiSpace.md),
const SizedBox(width: ChainSpace.md),
_StatTile(
label: l.doctorSummaryApprovals,
value: snapshot.pendingApprovals.toString(),
subtitle: l.doctorSummaryPending,
icon: Icons.inbox_outlined,
tone: snapshot.pendingApprovals > 0
? FaiPillTone.warning
: FaiPillTone.neutral,
? ChainPillTone.warning
: ChainPillTone.neutral,
),
const SizedBox(width: FaiSpace.md),
const SizedBox(width: ChainSpace.md),
_StatTile(
label: l.doctorSummaryAudit,
value: snapshot.chainHealthy ? '' : '',
@ -182,10 +182,10 @@ class _SummaryStrip extends StatelessWidget {
),
icon: Icons.shield_outlined,
tone: snapshot.chainHealthy
? FaiPillTone.success
: FaiPillTone.danger,
? ChainPillTone.success
: ChainPillTone.danger,
),
const SizedBox(width: FaiSpace.md),
const SizedBox(width: ChainSpace.md),
_StatTile(
label: l.doctorSummaryServices,
value: snapshot.services.length.toString(),
@ -202,36 +202,36 @@ class _StatTile extends StatelessWidget {
final String value;
final String subtitle;
final IconData icon;
final FaiPillTone tone;
final ChainPillTone tone;
const _StatTile({
required this.label,
required this.value,
required this.subtitle,
required this.icon,
this.tone = FaiPillTone.neutral,
this.tone = ChainPillTone.neutral,
});
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
final accentColor = switch (tone) {
FaiPillTone.success => FaiColors.success,
FaiPillTone.warning => FaiColors.warning,
FaiPillTone.danger => theme.colorScheme.error,
ChainPillTone.success => ChainColors.success,
ChainPillTone.warning => ChainColors.warning,
ChainPillTone.danger => theme.colorScheme.error,
_ => theme.colorScheme.primary,
};
return Expanded(
child: FaiCard(
child: ChainCard(
accentLeft: accentColor,
padding: const EdgeInsets.all(FaiSpace.lg),
padding: const EdgeInsets.all(ChainSpace.lg),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Icon(icon, size: 14, color: theme.colorScheme.onSurfaceVariant),
const SizedBox(width: FaiSpace.xs),
const SizedBox(width: ChainSpace.xs),
Flexible(
child: Text(
label.toUpperCase(),
@ -245,7 +245,7 @@ class _StatTile extends StatelessWidget {
),
],
),
const SizedBox(height: FaiSpace.sm),
const SizedBox(height: ChainSpace.sm),
Text(
value,
style: theme.textTheme.displaySmall?.copyWith(
@ -282,15 +282,15 @@ class _EventLogPanel extends StatelessWidget {
final theme = Theme.of(context);
final healthy = snapshot.chainHealthy;
final l = AppLocalizations.of(context)!;
return FaiCard(
return ChainCard(
child: Row(
children: [
Icon(
healthy ? Icons.verified_outlined : Icons.gpp_bad_outlined,
size: 24,
color: healthy ? FaiColors.success : theme.colorScheme.error,
color: healthy ? ChainColors.success : theme.colorScheme.error,
),
const SizedBox(width: FaiSpace.lg),
const SizedBox(width: ChainSpace.lg),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
@ -322,10 +322,10 @@ class _EventLogPanel extends StatelessWidget {
icon: const Icon(Icons.fact_check_outlined, size: 16),
label: Text(l.doctorVerifyNow),
),
const SizedBox(width: FaiSpace.sm),
FaiPill(
const SizedBox(width: ChainSpace.sm),
ChainPill(
label: healthy ? l.doctorChainPillOk : l.doctorChainPillTamper,
tone: healthy ? FaiPillTone.success : FaiPillTone.danger,
tone: healthy ? ChainPillTone.success : ChainPillTone.danger,
),
],
),
@ -353,7 +353,7 @@ class _DaemonPathsPanel extends StatelessWidget {
(l.doctorPathLog, paths.logPath, Icons.description_outlined, false),
(
l.doctorPathStudioErrors,
FaiLog.instance.path,
ChainLog.instance.path,
Icons.report_problem_outlined,
false,
),
@ -365,7 +365,7 @@ class _DaemonPathsPanel extends StatelessWidget {
].where((e) => e.$2.isNotEmpty).toList();
if (entries.isEmpty) {
return FaiCard(
return ChainCard(
child: Text(
l.doctorPathsEmpty,
style: Theme.of(context).textTheme.bodySmall,
@ -373,7 +373,7 @@ class _DaemonPathsPanel extends StatelessWidget {
);
}
return FaiCard(
return ChainCard(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
@ -416,7 +416,7 @@ class _PathRow extends StatelessWidget {
child: Row(
children: [
Icon(icon, size: 16, color: theme.colorScheme.onSurfaceVariant),
const SizedBox(width: FaiSpace.sm),
const SizedBox(width: ChainSpace.sm),
SizedBox(
width: 90,
child: Text(
@ -429,13 +429,13 @@ class _PathRow extends StatelessWidget {
Expanded(
child: SelectableText(
path,
style: FaiTheme.mono(
style: ChainTheme.mono(
size: 11,
color: theme.colorScheme.onSurface,
),
),
),
const SizedBox(width: FaiSpace.sm),
const SizedBox(width: ChainSpace.sm),
if (isLog || isConfig) ...[
OutlinedButton.icon(
onPressed: () => isConfig
@ -447,7 +447,7 @@ class _PathRow extends StatelessWidget {
visualDensity: VisualDensity.compact,
),
),
const SizedBox(width: FaiSpace.xs),
const SizedBox(width: ChainSpace.xs),
],
OutlinedButton.icon(
onPressed: () async {
@ -494,7 +494,7 @@ class _DaemonActionsCardState extends State<_DaemonActionsCard> {
/// True when the last daemon action failed because no `fai`
/// binary could be located. Swaps the raw output line for the
/// actionable [FaiBinaryRecovery] block.
/// actionable [ChainBinaryRecovery] block.
bool _binaryMissing = false;
ChannelStatusSnapshot? _channels;
@ -557,7 +557,7 @@ class _DaemonActionsCardState extends State<_DaemonActionsCard> {
}
}
}
return FaiCard(
return ChainCard(
// Row + Expanded forces the card to take the full width
// its parent offers. Without this, the card hugs the
// intrinsic width of the longest button row and ends up
@ -575,10 +575,10 @@ class _DaemonActionsCardState extends State<_DaemonActionsCard> {
: Icons.power_off_outlined,
size: 18,
color: active?.running == true
? FaiColors.success
? ChainColors.success
: theme.colorScheme.onSurfaceVariant,
),
const SizedBox(width: FaiSpace.sm),
const SizedBox(width: ChainSpace.sm),
Expanded(
child: Text(
active == null
@ -593,36 +593,36 @@ class _DaemonActionsCardState extends State<_DaemonActionsCard> {
),
),
if (active != null) ...[
const SizedBox(width: FaiSpace.sm),
FaiPill(
const SizedBox(width: ChainSpace.sm),
ChainPill(
label: active.running
? l.doctorPillRunning
: l.doctorPillStopped,
tone: active.running
? FaiPillTone.success
: FaiPillTone.neutral,
? ChainPillTone.success
: ChainPillTone.neutral,
),
],
],
),
const SizedBox(height: FaiSpace.sm),
const SizedBox(height: ChainSpace.sm),
Text(
l.doctorDaemonControlHint,
style: theme.textTheme.bodySmall?.copyWith(
color: theme.colorScheme.onSurfaceVariant,
),
),
const SizedBox(height: FaiSpace.md),
const SizedBox(height: ChainSpace.md),
Wrap(
spacing: FaiSpace.sm,
runSpacing: FaiSpace.sm,
spacing: ChainSpace.sm,
runSpacing: ChainSpace.sm,
children: [
FilledButton.tonalIcon(
onPressed: _busy
? null
: () => _run(
l.daemonActionRestart,
() => SystemActions.faiDaemon(['restart']),
() => SystemActions.chainDaemon(['restart']),
),
icon: const Icon(Icons.restart_alt, size: 16),
label: Text(l.doctorRestart),
@ -633,7 +633,7 @@ class _DaemonActionsCardState extends State<_DaemonActionsCard> {
? null
: () => _run(
l.daemonActionStart,
() => SystemActions.faiDaemon(['start']),
() => SystemActions.chainDaemon(['start']),
),
icon: const Icon(Icons.play_arrow, size: 16),
label: Text(l.doctorStart),
@ -643,7 +643,7 @@ class _DaemonActionsCardState extends State<_DaemonActionsCard> {
? null
: () => _run(
l.daemonActionStop,
() => SystemActions.faiDaemon(['stop']),
() => SystemActions.chainDaemon(['stop']),
),
icon: const Icon(Icons.stop_circle_outlined, size: 16),
label: Text(l.doctorStop),
@ -653,7 +653,7 @@ class _DaemonActionsCardState extends State<_DaemonActionsCard> {
? null
: () => _run(
l.daemonActionStatus,
() => SystemActions.faiDaemon(['status']),
() => SystemActions.chainDaemon(['status']),
),
icon: const Icon(Icons.health_and_safety_outlined, size: 16),
label: Text(l.doctorStatusAction),
@ -661,7 +661,7 @@ class _DaemonActionsCardState extends State<_DaemonActionsCard> {
],
),
if (_busy) ...[
const SizedBox(height: FaiSpace.md),
const SizedBox(height: ChainSpace.md),
Row(
children: [
const SizedBox(
@ -669,7 +669,7 @@ class _DaemonActionsCardState extends State<_DaemonActionsCard> {
height: 14,
child: CircularProgressIndicator(strokeWidth: 2),
),
const SizedBox(width: FaiSpace.sm),
const SizedBox(width: ChainSpace.sm),
Text(
l.doctorDaemonControlWorking,
style: theme.textTheme.bodySmall?.copyWith(
@ -680,27 +680,27 @@ class _DaemonActionsCardState extends State<_DaemonActionsCard> {
),
],
if (_binaryMissing) ...[
const SizedBox(height: FaiSpace.md),
FaiBinaryRecovery(
const SizedBox(height: ChainSpace.md),
ChainBinaryRecovery(
onLocated: () => _run(
l.daemonActionStatus,
() => SystemActions.faiDaemon(['status']),
() => SystemActions.chainDaemon(['status']),
),
),
],
if (_output != null) ...[
const SizedBox(height: FaiSpace.md),
const SizedBox(height: ChainSpace.md),
Container(
width: double.infinity,
padding: const EdgeInsets.all(FaiSpace.sm),
padding: const EdgeInsets.all(ChainSpace.sm),
decoration: BoxDecoration(
color: theme.colorScheme.surfaceContainerHigh,
borderRadius: BorderRadius.circular(FaiRadius.sm),
borderRadius: BorderRadius.circular(ChainRadius.sm),
border: Border.all(color: theme.colorScheme.outlineVariant),
),
child: SelectableText(
_output!,
style: FaiTheme.mono(
style: ChainTheme.mono(
size: 11,
color: theme.colorScheme.onSurface,
),
@ -732,7 +732,7 @@ class _ModulesPanel extends StatelessWidget {
Widget build(BuildContext context) {
final theme = Theme.of(context);
final l = AppLocalizations.of(context)!;
return FaiCard(
return ChainCard(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
@ -743,7 +743,7 @@ class _ModulesPanel extends StatelessWidget {
size: 18,
color: theme.colorScheme.onSurfaceVariant,
),
const SizedBox(width: FaiSpace.sm),
const SizedBox(width: ChainSpace.sm),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
@ -767,17 +767,17 @@ class _ModulesPanel extends StatelessWidget {
],
),
),
FaiPill(
ChainPill(
label: snapshot.moduleCount > 0
? l.doctorPillLoaded
: l.doctorPillEmpty,
tone: snapshot.moduleCount > 0
? FaiPillTone.success
: FaiPillTone.neutral,
? ChainPillTone.success
: ChainPillTone.neutral,
),
],
),
const Divider(height: FaiSpace.xl),
const Divider(height: ChainSpace.xl),
Row(
children: [
Icon(
@ -785,7 +785,7 @@ class _ModulesPanel extends StatelessWidget {
size: 18,
color: theme.colorScheme.onSurfaceVariant,
),
const SizedBox(width: FaiSpace.sm),
const SizedBox(width: ChainSpace.sm),
Text(
snapshot.pendingApprovals == 0
? l.doctorApprovalsNone
@ -794,9 +794,9 @@ class _ModulesPanel extends StatelessWidget {
),
const Spacer(),
if (snapshot.pendingApprovals > 0)
FaiPill(
ChainPill(
label: l.doctorApprovalsAttentionPill,
tone: FaiPillTone.warning,
tone: ChainPillTone.warning,
),
],
),
@ -819,10 +819,10 @@ class _ServicesPanel extends StatelessWidget {
// Wrap on narrow windows so the mono-spaced hint
// (`add to ~/.chain/config.yaml under services:`) does not
// overflow horizontally past the card's right edge.
return FaiCard(
return ChainCard(
child: Wrap(
spacing: FaiSpace.sm,
runSpacing: FaiSpace.xs,
spacing: ChainSpace.sm,
runSpacing: ChainSpace.xs,
crossAxisAlignment: WrapCrossAlignment.center,
children: [
Row(
@ -833,7 +833,7 @@ class _ServicesPanel extends StatelessWidget {
size: 18,
color: theme.colorScheme.onSurfaceVariant,
),
const SizedBox(width: FaiSpace.sm),
const SizedBox(width: ChainSpace.sm),
Text(
l.doctorServicesEmpty,
style: theme.textTheme.bodyMedium?.copyWith(
@ -844,7 +844,7 @@ class _ServicesPanel extends StatelessWidget {
),
Text(
l.doctorServicesEmptyHint,
style: FaiTheme.mono(
style: ChainTheme.mono(
size: 11,
color: theme.colorScheme.onSurfaceVariant,
),
@ -853,7 +853,7 @@ class _ServicesPanel extends StatelessWidget {
),
);
}
return FaiCard(
return ChainCard(
padding: EdgeInsets.zero,
child: Column(
children: [
@ -861,7 +861,7 @@ class _ServicesPanel extends StatelessWidget {
if (i > 0)
Divider(height: 1, color: theme.colorScheme.outlineVariant),
Padding(
padding: const EdgeInsets.all(FaiSpace.lg),
padding: const EdgeInsets.all(ChainSpace.lg),
child: Row(
children: [
Icon(
@ -869,25 +869,25 @@ class _ServicesPanel extends StatelessWidget {
size: 16,
color: theme.colorScheme.primary,
),
const SizedBox(width: FaiSpace.sm),
const SizedBox(width: ChainSpace.sm),
Text(
snapshot.services[i].name,
style: theme.textTheme.titleSmall?.copyWith(
fontWeight: FontWeight.w600,
),
),
const SizedBox(width: FaiSpace.md),
const SizedBox(width: ChainSpace.md),
Text(
snapshot.services[i].endpoint,
style: FaiTheme.mono(
style: ChainTheme.mono(
size: 11,
color: theme.colorScheme.onSurfaceVariant,
),
),
const Spacer(),
for (final tag in snapshot.services[i].tags) ...[
FaiPill(label: tag, tone: FaiPillTone.neutral),
const SizedBox(width: FaiSpace.xs),
ChainPill(label: tag, tone: ChainPillTone.neutral),
const SizedBox(width: ChainSpace.xs),
],
],
),
@ -917,7 +917,7 @@ class _UpdateBannerState extends State<_UpdateBanner> {
_applying = true;
_applyOutput = null;
});
final r = await SystemActions.faiUpdateApply(widget.status.channel);
final r = await SystemActions.chainUpdateApply(widget.status.channel);
if (!mounted) return;
setState(() {
_applying = false;
@ -945,7 +945,7 @@ class _UpdateBannerState extends State<_UpdateBanner> {
final body = available
? l.doctorUpdateBody(status.channel, status.latestVersion)
: (status.reason ?? l.doctorUpdateUnreachableBody(status.channel));
return FaiCard(
return ChainCard(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
@ -953,7 +953,7 @@ class _UpdateBannerState extends State<_UpdateBanner> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Icon(iconData, size: 20, color: iconColor),
const SizedBox(width: FaiSpace.md),
const SizedBox(width: ChainSpace.md),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
@ -967,7 +967,7 @@ class _UpdateBannerState extends State<_UpdateBanner> {
const SizedBox(height: 2),
Text(
body,
style: FaiTheme.mono(
style: ChainTheme.mono(
size: 11,
color: theme.colorScheme.onSurfaceVariant,
),
@ -976,7 +976,7 @@ class _UpdateBannerState extends State<_UpdateBanner> {
const SizedBox(height: 4),
Text(
l.doctorReleaseNotes(status.releaseNotesUrl!),
style: FaiTheme.mono(
style: ChainTheme.mono(
size: 11,
color: theme.colorScheme.primary,
),
@ -999,16 +999,16 @@ class _UpdateBannerState extends State<_UpdateBanner> {
_applying ? l.doctorApplying : l.doctorApplyUpdate,
),
),
const SizedBox(width: FaiSpace.sm),
FaiPill(
const SizedBox(width: ChainSpace.sm),
ChainPill(
label: available ? l.doctorPillNew : l.doctorPillOffline,
tone: available ? FaiPillTone.success : FaiPillTone.neutral,
tone: available ? ChainPillTone.success : ChainPillTone.neutral,
),
],
),
if (_applyOutput != null) ...[
const SizedBox(height: FaiSpace.md),
FaiErrorBox(text: _applyOutput!, maxHeight: 240),
const SizedBox(height: ChainSpace.md),
ChainErrorBox(text: _applyOutput!, maxHeight: 240),
],
],
),