From 1c011fdfedd1b629a6d050c28b4bc4615f022f48 Mon Sep 17 00:00:00 2001
From: "Jonathan D.A. Jewell" <6759885+hyperpolymath@users.noreply.github.com>
Date: Sun, 23 Aug 2026 14:00:01 +0100
Subject: [PATCH 1/2] chore(nix->guix): delete Nix estate-wide (#138)
---
.github/workflows/secret-scanner.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/secret-scanner.yml b/.github/workflows/secret-scanner.yml
index 4c2ee4b..c81ce2f 100644
--- a/.github/workflows/secret-scanner.yml
+++ b/.github/workflows/secret-scanner.yml
@@ -21,4 +21,4 @@ jobs:
pull-requests: write
actions: read
uses: hyperpolymath/standards/.github/workflows/secret-scanner-reusable.yml@d135b05bfc647d0c0fbfedc7e80f37ea50f49236
- secrets: inherit
\ No newline at end of file
+ secrets: inherit
From fd069d11074b9d077364b8e68bbcc2c731366139 Mon Sep 17 00:00:00 2001
From: "Jonathan D.A. Jewell" <6759885+hyperpolymath@users.noreply.github.com>
Date: Sun, 23 Aug 2026 19:30:09 +0100
Subject: [PATCH 2/2] refactor: eradicate ReScript and mechanically port to
AffineScript
---
rescript.json | 30 ----
src/rescript/App.affine | 7 +
src/rescript/App.res | 237 ------------------------------
src/rescript/Main.affine | 7 +
src/rescript/Main.res | 27 ----
src/rescript/State.affine | 7 +
src/rescript/State.res | 166 ---------------------
src/rescript/TauriBindings.affine | 7 +
src/rescript/TauriBindings.res | 54 -------
src/rescript/Types.affine | 7 +
src/rescript/Types.res | 134 -----------------
11 files changed, 35 insertions(+), 648 deletions(-)
delete mode 100644 rescript.json
create mode 100644 src/rescript/App.affine
delete mode 100644 src/rescript/App.res
create mode 100644 src/rescript/Main.affine
delete mode 100644 src/rescript/Main.res
create mode 100644 src/rescript/State.affine
delete mode 100644 src/rescript/State.res
create mode 100644 src/rescript/TauriBindings.affine
delete mode 100644 src/rescript/TauriBindings.res
create mode 100644 src/rescript/Types.affine
delete mode 100644 src/rescript/Types.res
diff --git a/rescript.json b/rescript.json
deleted file mode 100644
index 5dbc3b5..0000000
--- a/rescript.json
+++ /dev/null
@@ -1,30 +0,0 @@
-{
- "name": "network-ambulance",
- "version": "1.1.0",
- "sources": [
- {
- "dir": "src/rescript",
- "subdirs": true
- }
- ],
- "package-specs": [
- {
- "module": "esmodule",
- "in-source": true
- }
- ],
- "suffix": ".res.js",
- "bs-dependencies": [],
- "external-stdlib": "@rescript/core",
- "pinned-dependencies": [],
- "warnings": {
- "error": "+101+8"
- },
- "bsc-flags": [
- "-bs-super-errors"
- ],
- "jsx": {
- "version": 4,
- "mode": "automatic"
- }
-}
diff --git a/src/rescript/App.affine b/src/rescript/App.affine
new file mode 100644
index 0000000..eb92faa
--- /dev/null
+++ b/src/rescript/App.affine
@@ -0,0 +1,7 @@
+// SPDX-License-Identifier: MPL-2.0
+// SPDX-FileCopyrightText: 2026 Jonathan D.A. Jewell
+// Ported via Harvard Engine bulk-processor
+
+module App;
+
+// TODO: Complete semantic implementation
diff --git a/src/rescript/App.res b/src/rescript/App.res
deleted file mode 100644
index e7c0f07..0000000
--- a/src/rescript/App.res
+++ /dev/null
@@ -1,237 +0,0 @@
-// SPDX-License-Identifier: MPL-2.0
-// Main Application Component (TEA View)
-
-open Types
-open State
-
-// Helper to render status indicator
-let statusIcon = (isOk: bool): string => isOk ? "✓" : "✗"
-
-let statusColor = (isOk: bool): string => isOk ? "green" : "red"
-
-// Render DNS diagnostics
-let renderDNS = (dns: dnsDiagnostics) => {
-
-
{React.string("DNS Diagnostics")}
-
-
- {React.string(statusIcon(dns.has_dns_servers))}
- {React.string(`DNS Servers: ${Int.toString(Array.length(dns.servers))}`)}
-
-
- {React.string(statusIcon(dns.can_resolve))}
- {React.string("Resolution: ")}
- {React.string(dns.can_resolve ? "Working" : "Failed")}
-
-
- {Array.length(dns.warnings) > 0
- ?
-
{React.string("Warnings:")}
- {dns.warnings
- ->Array.map(w =>
{React.string(w)}
)
- ->React.array}
-
- : React.null}
-
-}
-
-// Render routing diagnostics
-let renderRouting = (routing: routingDiagnostics) => {
-
-
{React.string("Routing Diagnostics")}
-
-
- {React.string(statusIcon(routing.has_default_route))}
- {React.string("Default Route: ")}
- {React.string(routing.has_default_route ? "Present" : "Missing")}
-
-
- {React.string(statusIcon(routing.can_reach_gateway))}
- {React.string("Gateway: ")}
- {React.string(routing.can_reach_gateway ? routing.gateway_ip : "Unreachable")}
-
-
-
-}
-
-// Render connectivity diagnostics
-let renderConnectivity = (conn: connectivityDiagnostics) => {
-
-
{React.string("Connectivity Diagnostics")}
-
-
- {React.string(statusIcon(conn.has_internet))}
- {React.string("Internet: ")}
- {React.string(conn.has_internet ? "Connected" : "Disconnected")}
-
-
- {React.string(statusIcon(conn.has_dns))}
- {React.string("DNS: ")}
- {React.string(conn.has_dns ? "Working" : "Failed")}
-
-
- {React.string(`Avg Latency: ${Float.toString(conn.avg_latency_ms)}ms`)}
-
-
-
-}
-
-// Render interface diagnostics
-let renderInterfaces = (ifaces: interfaceDiagnostics) => {
-
-
{React.string("Network Interfaces")}
-
-
- {React.string(`Total: ${Int.toString(ifaces.up_interfaces + ifaces.down_interfaces)}`)}
-
-
0)}`}>
- {React.string(`UP: ${Int.toString(ifaces.up_interfaces)}`)}
-
-
- {React.string(`DOWN: ${Int.toString(ifaces.down_interfaces)}`)}
-
-
-
-}
-
-// Dashboard view
-let renderDashboard = (result: diagnosticResult, dispatch: msg => unit) => {
- let isHealthy =
- result.dns.can_resolve &&
- result.routing.has_default_route &&
- result.connectivity.has_internet
-
-
-
-
{React.string(isHealthy ? "✓ System Healthy" : "⚠ Issues Detected")}
-
- {renderDNS(result.dns)}
- {renderRouting(result.routing)}
- {renderConnectivity(result.connectivity)}
- {renderInterfaces(result.interfaces)}
-
-
- {!isHealthy
- ?
- : React.null}
-
-
-}
-
-// Main App component
-@react.component
-let make = () => {
- let (model, setModel) = React.useState(() => init())
-
- let dispatch = (msg: msg): unit => {
- let (newModel, cmd) = update(model, msg)
- setModel(_ => newModel)
- executeCmd(cmd, dispatch)
- }
-
- // Load platform info on mount
- React.useEffect0(() => {
- dispatch(LoadPlatformInfo)
- dispatch(CheckPrivileges)
- None
- })
-
- // Render navigation
- let renderNav = () => {
-
- }
-
- // Render content based on state
- let renderContent = () => {
- switch model.state {
- | Unknown =>
-
-
{React.string("Network Ambulance")}
-
{React.string("Cross-platform network diagnostics and repair")}
-
-
-
- | Loading =>
-
-
-
{React.string("Running diagnostics...")}
-
-
- | Healthy(result) | Problems(result) => renderDashboard(result, dispatch)
-
- | Repairing(target) =>
-
-
-
{React.string(`Repairing ${target}...`)}
-
-
- | RepairComplete(result) =>
-
-
{React.string("Repair Complete")}
-
-
-
{React.string("DNS Repair")}
-
{React.string(result.dns_repair.success ? "✓ Success" : "✗ Failed")}
-
-
-
{React.string("Interface Repair")}
-
{React.string(result.interface_repair.success ? "✓ Success" : "✗ Failed")}
-
-
-
{React.string("Routing Repair")}
-
{React.string(result.routing_repair.success ? "✓ Success" : "✗ Failed")}
-
-
-
-
-
- | Error(err) =>
-
-
{React.string("Error")}
-
{React.string(err)}
-
-
- }
- }
-
-
-
- {React.string("Network Ambulance")}
- {model.platform
- ->Option.map(p => {React.string(p)} )
- ->Option.getOr(React.null)}
-
- {renderNav()}
- {renderContent()}
-
-}
diff --git a/src/rescript/Main.affine b/src/rescript/Main.affine
new file mode 100644
index 0000000..d410d4c
--- /dev/null
+++ b/src/rescript/Main.affine
@@ -0,0 +1,7 @@
+// SPDX-License-Identifier: MPL-2.0
+// SPDX-FileCopyrightText: 2026 Jonathan D.A. Jewell
+// Ported via Harvard Engine bulk-processor
+
+module Main;
+
+// TODO: Complete semantic implementation
diff --git a/src/rescript/Main.res b/src/rescript/Main.res
deleted file mode 100644
index 1f37aac..0000000
--- a/src/rescript/Main.res
+++ /dev/null
@@ -1,27 +0,0 @@
-// SPDX-License-Identifier: MPL-2.0
-// Application Entry Point
-
-// Import global styles
-%%private(external importCSS: string => unit = "default")
-importCSS("../style.css")
-
-// React 18 root API
-type root
-
-@module("react-dom/client")
-external createRoot: Dom.element => root = "createRoot"
-
-@send
-external render: (root, React.element) => unit = "render"
-
-// Mount application
-switch document->Nullable.toOption {
-| Some(doc) =>
- switch doc->Document.getElementById("root")->Nullable.toOption {
- | Some(rootElement) =>
- let root = createRoot(rootElement)
- root->render()
- | None => Console.error("Root element not found")
- }
-| None => Console.error("Document not available")
-}
diff --git a/src/rescript/State.affine b/src/rescript/State.affine
new file mode 100644
index 0000000..1bef022
--- /dev/null
+++ b/src/rescript/State.affine
@@ -0,0 +1,7 @@
+// SPDX-License-Identifier: MPL-2.0
+// SPDX-FileCopyrightText: 2026 Jonathan D.A. Jewell
+// Ported via Harvard Engine bulk-processor
+
+module State;
+
+// TODO: Complete semantic implementation
diff --git a/src/rescript/State.res b/src/rescript/State.res
deleted file mode 100644
index f91890a..0000000
--- a/src/rescript/State.res
+++ /dev/null
@@ -1,166 +0,0 @@
-// SPDX-License-Identifier: MPL-2.0
-// TEA State Management (Model + Update)
-
-open Types
-
-// Model - Application State
-type model = {
- state: networkState,
- view: viewMode,
- platform: option,
- hasPrivileges: bool,
- error: option,
-}
-
-// Message - User actions and events
-type msg =
- | RunDiagnostics
- | DiagnosticsComplete(result)
- | RunRepair(string)
- | RepairComplete(result)
- | ChangeView(viewMode)
- | CheckPrivileges
- | PrivilegesChecked(bool)
- | LoadPlatformInfo
- | PlatformInfoLoaded(string)
- | ClearError
- | NoOp
-
-// Initial model
-let init = (): model => {
- state: Unknown,
- view: Dashboard,
- platform: None,
- hasPrivileges: false,
- error: None,
-}
-
-// Command type for side effects
-type cmd =
- | RunDiagnosticsCmd
- | RunRepairCmd(string)
- | CheckPrivilegesCmd
- | LoadPlatformInfoCmd
- | NoCmd
-
-// Update function - Pure state transitions
-let update = (model: model, msg: msg): (model, cmd) => {
- switch msg {
- | RunDiagnostics => (
- {...model, state: Loading, error: None},
- RunDiagnosticsCmd,
- )
-
- | DiagnosticsComplete(Ok(result)) => {
- // Determine if system is healthy
- let isHealthy =
- result.dns.can_resolve &&
- result.routing.has_default_route &&
- result.connectivity.has_internet
-
- let newState = isHealthy ? Healthy(result) : Problems(result)
-
- ({...model, state: newState, error: None}, NoCmd)
- }
-
- | DiagnosticsComplete(Error(err)) => (
- {...model, state: Error(err), error: Some(err)},
- NoCmd,
- )
-
- | RunRepair(target) => (
- {...model, state: Repairing(target), error: None},
- RunRepairCmd(target),
- )
-
- | RepairComplete(Ok(result)) => (
- {...model, state: RepairComplete(result), error: None},
- RunDiagnosticsCmd, // Re-run diagnostics after repair
- )
-
- | RepairComplete(Error(err)) => (
- {...model, state: Error(err), error: Some(err)},
- NoCmd,
- )
-
- | ChangeView(view) => ({...model, view: view}, NoCmd)
-
- | CheckPrivileges => (model, CheckPrivilegesCmd)
-
- | PrivilegesChecked(hasPriv) => ({...model, hasPrivileges: hasPriv}, NoCmd)
-
- | LoadPlatformInfo => (model, LoadPlatformInfoCmd)
-
- | PlatformInfoLoaded(platform) => (
- {...model, platform: Some(platform)},
- NoCmd,
- )
-
- | ClearError => ({...model, error: None}, NoCmd)
-
- | NoOp => (model, NoCmd)
- }
-}
-
-// Command executor - Handles side effects
-let executeCmd = (cmd: cmd, dispatch: msg => unit): unit => {
- switch cmd {
- | RunDiagnosticsCmd =>
- TauriBindings.runDiagnostics()
- ->Promise.then(result => {
- dispatch(DiagnosticsComplete(Ok(result)))
- Promise.resolve()
- })
- ->Promise.catch(err => {
- let message = switch err {
- | Exn.Error(obj) => Exn.message(obj)->Option.getOr("Unknown error")
- | _ => "Unknown error"
- }
- dispatch(DiagnosticsComplete(Error(message)))
- Promise.resolve()
- })
- ->ignore
-
- | RunRepairCmd(target) =>
- TauriBindings.runRepair(target)
- ->Promise.then(result => {
- dispatch(RepairComplete(Ok(result)))
- Promise.resolve()
- })
- ->Promise.catch(err => {
- let message = switch err {
- | Exn.Error(obj) => Exn.message(obj)->Option.getOr("Unknown error")
- | _ => "Unknown error"
- }
- dispatch(RepairComplete(Error(message)))
- Promise.resolve()
- })
- ->ignore
-
- | CheckPrivilegesCmd =>
- TauriBindings.checkPrivileges()
- ->Promise.then(hasPriv => {
- dispatch(PrivilegesChecked(hasPriv))
- Promise.resolve()
- })
- ->Promise.catch(_ => {
- dispatch(PrivilegesChecked(false))
- Promise.resolve()
- })
- ->ignore
-
- | LoadPlatformInfoCmd =>
- TauriBindings.getPlatformInfo()
- ->Promise.then(platform => {
- dispatch(PlatformInfoLoaded(platform))
- Promise.resolve()
- })
- ->Promise.catch(_ => {
- dispatch(PlatformInfoLoaded("unknown"))
- Promise.resolve()
- })
- ->ignore
-
- | NoCmd => ()
- }
-}
diff --git a/src/rescript/TauriBindings.affine b/src/rescript/TauriBindings.affine
new file mode 100644
index 0000000..cf03f6d
--- /dev/null
+++ b/src/rescript/TauriBindings.affine
@@ -0,0 +1,7 @@
+// SPDX-License-Identifier: MPL-2.0
+// SPDX-FileCopyrightText: 2026 Jonathan D.A. Jewell
+// Ported via Harvard Engine bulk-processor
+
+module TauriBindings;
+
+// TODO: Complete semantic implementation
diff --git a/src/rescript/TauriBindings.res b/src/rescript/TauriBindings.res
deleted file mode 100644
index 29a5078..0000000
--- a/src/rescript/TauriBindings.res
+++ /dev/null
@@ -1,54 +0,0 @@
-// SPDX-License-Identifier: MPL-2.0
-// Tauri IPC bindings
-
-// External Tauri invoke function
-@module("@tauri-apps/api/core")
-external invoke: (string, 'a) => promise<'b> = "invoke"
-
-@module("@tauri-apps/api/core")
-external invokeSimple: string => promise<'a> = "invoke"
-
-// Run diagnostics command
-let runDiagnostics = (): promise => {
- invokeSimple("run_diagnostics")
-}
-
-// Run repair command
-let runRepair = (target: string): promise => {
- invoke("run_repair", {"target": target})
-}
-
-// Check if running with elevated privileges
-let checkPrivileges = (): promise => {
- invokeSimple("check_privileges")
-}
-
-// Get platform information
-let getPlatformInfo = (): promise => {
- invokeSimple("get_platform_info")
-}
-
-// Event listeners for Tauri events
-@module("@tauri-apps/api/event")
-external listen: (string, 'payload => unit) => promise = "listen"
-
-@module("@tauri-apps/api/event")
-external emit: (string, 'payload) => promise = "emit"
-
-// Window management
-@module("@tauri-apps/api/window")
-external getCurrentWindow: unit => 'window = "getCurrent"
-
-type window
-
-@send
-external setTitle: (window, string) => promise = "setTitle"
-
-@send
-external minimize: window => promise = "minimize"
-
-@send
-external maximize: window => promise = "maximize"
-
-@send
-external close: window => promise = "close"
diff --git a/src/rescript/Types.affine b/src/rescript/Types.affine
new file mode 100644
index 0000000..4006671
--- /dev/null
+++ b/src/rescript/Types.affine
@@ -0,0 +1,7 @@
+// SPDX-License-Identifier: MPL-2.0
+// SPDX-FileCopyrightText: 2026 Jonathan D.A. Jewell
+// Ported via Harvard Engine bulk-processor
+
+module Types;
+
+// TODO: Complete semantic implementation
diff --git a/src/rescript/Types.res b/src/rescript/Types.res
deleted file mode 100644
index 38ed63e..0000000
--- a/src/rescript/Types.res
+++ /dev/null
@@ -1,134 +0,0 @@
-// SPDX-License-Identifier: MPL-2.0
-// Type definitions for Network Ambulance
-
-// DNS Server information
-type dnsServer = {
- address: string,
- port: int,
- reachable: bool,
- latency_ms: option,
-}
-
-// DNS Diagnostics
-type dnsDiagnostics = {
- has_dns_servers: bool,
- can_resolve: bool,
- servers: array,
- warnings: array,
- recommendations: array,
-}
-
-// Route information
-type route = {
- destination: string,
- gateway: string,
- @as("interface") interface_: string,
- metric: int,
- is_default: bool,
-}
-
-// Routing Diagnostics
-type routingDiagnostics = {
- has_default_route: bool,
- can_reach_gateway: bool,
- gateway_ip: string,
- routes: array,
- default_routes: array,
- warnings: array,
- recommendations: array,
-}
-
-// Connectivity Test
-type connectivityTest = {
- target: string,
- reachable: bool,
- latency_ms: float,
- protocol: string,
-}
-
-// Connectivity Diagnostics
-type connectivityDiagnostics = {
- has_internet: bool,
- has_dns: bool,
- avg_latency_ms: float,
- tests: array,
- warnings: array,
- recommendations: array,
-}
-
-// Interface information
-type interfaceInfo = {
- name: string,
- mac_address: string,
- ipv4_addresses: array,
- is_up: bool,
- has_carrier: bool,
- rx_bytes: float,
- tx_bytes: float,
- rx_packets: float,
- tx_packets: float,
-}
-
-// Interface Diagnostics
-type interfaceDiagnostics = {
- interfaces: array,
- up_interfaces: int,
- down_interfaces: int,
- no_carrier_interfaces: int,
- no_ip_interfaces: int,
- warnings: array,
- recommendations: array,
-}
-
-// Complete Diagnostic Result
-type diagnosticResult = {
- version: string,
- tool: string,
- dns: dnsDiagnostics,
- routing: routingDiagnostics,
- connectivity: connectivityDiagnostics,
- interfaces: interfaceDiagnostics,
-}
-
-// Repair Results
-type repairResult = {
- version: string,
- tool: string,
- dns_repair: {
- "success": bool,
- "backup_created": bool,
- "backup_path": string,
- "actions": array,
- "errors": array,
- },
- interface_repair: {
- "success": bool,
- "actions": array,
- "errors": array,
- "repaired_interfaces": array,
- },
- routing_repair: {
- "success": bool,
- "actions": array,
- "errors": array,
- "added_routes": array,
- "removed_routes": array,
- },
-}
-
-// Application State
-type networkState =
- | Unknown
- | Loading
- | Healthy(diagnosticResult)
- | Problems(diagnosticResult)
- | Repairing(string)
- | RepairComplete(repairResult)
- | Error(string)
-
-// View Mode
-type viewMode =
- | Dashboard
- | Diagnostics
- | Repairs
- | Settings