From 401b1e1ce5f6a5b3730c43e46e7506bb369730a6 Mon Sep 17 00:00:00 2001 From: Jeroen Schweitzer Date: Fri, 12 Jun 2026 02:16:33 +0200 Subject: [PATCH] delete ToolCheck and the GraphView placeholder (T-385) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ToolCheck had zero callers. GraphView was unreachable — the graph builtin contributes nothing, so no surface ever built it; the flat pql-connections ListView it held was never the owned-canvas graph anyway (T-7 cancelled). The Governance Graph idea (Q-46/Q-49) starts fresh if it lands. Co-Authored-By: Claude Fable 5 --- lib/builtin/graph/src/graph_view.dart | 113 -------------------------- lib/kernel/src/tool_check.dart | 38 --------- 2 files changed, 151 deletions(-) delete mode 100644 lib/builtin/graph/src/graph_view.dart delete mode 100644 lib/kernel/src/tool_check.dart diff --git a/lib/builtin/graph/src/graph_view.dart b/lib/builtin/graph/src/graph_view.dart deleted file mode 100644 index 2fea4c63..00000000 --- a/lib/builtin/graph/src/graph_view.dart +++ /dev/null @@ -1,113 +0,0 @@ -import 'dart:async'; -import 'dart:convert'; - -import 'package:clide/kernel/kernel.dart'; -import 'package:clide/widgets/widgets.dart'; -import 'package:flutter/widgets.dart'; - -class GraphView extends StatefulWidget { - const GraphView({super.key}); - - @override - State createState() => _GraphViewState(); -} - -class _GraphViewState extends State { - List<_GraphNode> _nodes = []; - String? _error; - bool _loading = true; - - @override - void didChangeDependencies() { - super.didChangeDependencies(); - if (!_loading || _nodes.isNotEmpty) return; - unawaited(_load()); - } - - Future _load() async { - final kernel = ClideKernel.of(context); - final resp = await kernel.ipc.request( - 'pql.exec', - args: { - 'argv': ['search', '--connections', '--limit', '50'], - }, - ); - if (!mounted) return; - if (!resp.ok) { - setState(() { - _error = resp.error?.message ?? 'failed to load graph'; - _loading = false; - }); - return; - } - final raw = resp.data['stdout'] as String? ?? '[]'; - try { - final list = (jsonDecode(raw) as List).cast>(); - setState(() { - _nodes = list.map(_GraphNode.fromJson).toList(); - _loading = false; - }); - } catch (e) { - setState(() { - _error = 'parse error: $e'; - _loading = false; - }); - } - } - - @override - Widget build(BuildContext context) { - final tokens = ClideTheme.of(context).surface; - if (_loading) { - return const Center(child: ClideText('Loading graph...', muted: true)); - } - if (_error != null) { - return Padding(padding: const EdgeInsets.all(12), child: ClideText(_error!, muted: true)); - } - if (_nodes.isEmpty) { - return const Padding(padding: EdgeInsets.all(12), child: ClideText('No linked files found.\nAdd wikilinks to your markdown files.', muted: true)); - } - return ListView.builder( - itemCount: _nodes.length, - itemBuilder: (ctx, i) { - final n = _nodes[i]; - return _NodeRow(node: n, tokens: tokens); - }, - ); - } -} - -class _GraphNode { - const _GraphNode({required this.path, this.inbound = 0, this.outbound = 0}); - final String path; - final int inbound; - final int outbound; - - factory _GraphNode.fromJson(Map json) => _GraphNode( - path: json['path'] as String? ?? json['relative_path'] as String? ?? '', - inbound: (json['inbound_count'] as num?)?.toInt() ?? 0, - outbound: (json['outbound_count'] as num?)?.toInt() ?? 0, - ); -} - -class _NodeRow extends StatelessWidget { - const _NodeRow({required this.node, required this.tokens}); - final _GraphNode node; - final SurfaceTokens tokens; - - @override - Widget build(BuildContext context) { - return ClideTappable( - builder: (context, hovered, _) => Container( - color: hovered ? tokens.listItemHoverBackground : null, - padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 4), - child: Row( - children: [ - Expanded(child: ClideText(node.path, fontSize: clideFontCaption)), - ClideText('${node.inbound}in ${node.outbound}out', color: tokens.globalTextMuted, fontSize: clideFontSmall), - ], - ), - ), - ); - } -} diff --git a/lib/kernel/src/tool_check.dart b/lib/kernel/src/tool_check.dart deleted file mode 100644 index 04e869ff..00000000 --- a/lib/kernel/src/tool_check.dart +++ /dev/null @@ -1,38 +0,0 @@ -import 'dart:io'; - -import 'package:flutter/foundation.dart'; - -import '../../src/pty/env.dart'; - -class ToolCheck extends ChangeNotifier { - bool pqlOk = false; - bool tmuxOk = false; - bool gitOk = false; - bool checked = false; - - bool get allOk => pqlOk && tmuxOk && gitOk; - - List get errors => [if (!pqlOk) 'pql not found', if (!tmuxOk) 'tmux not found', if (!gitOk) 'git not found']; - - /// Workspace root, set by the app at boot. Falls back to cwd. - static String? workspaceRoot; - - Future check() async { - pqlOk = _existsOnPath('pql'); - tmuxOk = _existsOnPath('tmux'); - gitOk = _existsOnPath('git'); - checked = true; - notifyListeners(); - } - - /// Check if [name] exists as an executable in any PATH directory. - /// Uses direct file-existence checks — works inside a macOS sandbox - /// without needing to exec `which`. - static bool _existsOnPath(String name) { - for (final dir in expandedPath.split(':')) { - if (dir.isEmpty) continue; - if (File('$dir/$name').existsSync()) return true; - } - return false; - } -}