Skip to content

Commit 2ac164c

Browse files
committed
Auto-commit before sync: Wed 15 Apr 15:29:16 BST 2026
1 parent 7dec489 commit 2ac164c

2 files changed

Lines changed: 118 additions & 67 deletions

File tree

‎lib/script_manager/tui.ex‎

Lines changed: 118 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ defmodule ScriptManager.TUI do
9191
IO.puts("[19] Media Finder")
9292
IO.puts("[20] Dependency Fixer")
9393
IO.puts("[21] Toolchain Linker")
94+
IO.puts("[22] Launch NQC (Database Query)")
95+
IO.puts("[23] Launch Invariant Path (Code Analysis)")
9496
IO.puts("\n[h] Help - Detailed information")
9597
IO.puts("[s] System Status")
9698
IO.puts("[0] Exit")
@@ -130,6 +132,8 @@ defmodule ScriptManager.TUI do
130132
"19" -> safe_execute(&ScriptManager.MediaFinder.run/0, "Media Finder")
131133
"20" -> safe_execute(&ScriptManager.DependencyFixer.run/0, "Dependency Fixer")
132134
"21" -> safe_execute(&ScriptManager.ToolchainLinker.run/0, "Toolchain Linker")
135+
"22" -> launch_nqc()
136+
"23" -> launch_invariant_path()
133137
"h" -> show_help()
134138
"s" -> show_system_status()
135139
"0" -> IO.puts("\n👋 Goodbye!")
@@ -195,12 +199,111 @@ defmodule ScriptManager.TUI do
195199
end
196200
end
197201

202+
defp show_system_status do
203+
IO.puts("\n" <> String.duplicate("=", 60))
204+
IO.puts("SYSTEM STATUS")
205+
IO.puts(String.duplicate("=", 60))
206+
207+
# Check required commands
208+
required_commands = ["bash", "git", "gh", "jq"]
209+
210+
IO.puts("\nRequired Commands:")
211+
Enum.each(required_commands, fn cmd ->
212+
if System.cmd("which", [cmd], [stderr_to_stdout: true]) |> elem(0) == 0 do
213+
IO.puts(" ✅ #{cmd}")
214+
else
215+
IO.puts(" ❌ #{cmd} (missing)")
216+
end
217+
end)
218+
219+
# Check scripts directory
220+
scripts_dir = "scripts"
221+
if File.exists?(scripts_dir) do
222+
script_count = File.ls!(scripts_dir) |> Enum.count()
223+
IO.puts("\nScripts Directory: ✅ #{script_count} scripts found")
224+
else
225+
IO.puts("\nScripts Directory: ❌ Not found")
226+
end
227+
228+
# Check GitHub CLI authentication
229+
IO.puts("\nGitHub CLI Status:")
230+
case System.cmd("gh", ["auth", "status"], [stderr_to_stdout: true]) do
231+
{0, output} -> IO.puts(" ✅ Authenticated: #{String.trim(output)}")
232+
{_, _} -> IO.puts(" ❌ Not authenticated or error")
233+
end
234+
235+
IO.puts("\n" <> String.duplicate("-", 60))
236+
IO.puts("Press Enter to return to main menu...")
237+
IO.gets("")
238+
end
239+
240+
defp run_clean_unicode do
241+
IO.puts("\n🧼 CLEAN UNICODE")
242+
IO.puts("Cleaning hidden/bidirectional Unicode characters from files...")
243+
244+
# Check if script exists
245+
script_path = "/var/mnt/eclipse/scripts/clean-unicode.sh"
246+
247+
if File.exists?(script_path) do
248+
IO.puts("Running: #{script_path}")
249+
250+
# Execute with error handling
251+
case System.cmd(script_path, []) do
252+
{0, output} ->
253+
IO.puts("✅ Unicode cleaning complete!")
254+
IO.puts(output)
255+
{status, error} ->
256+
IO.puts("❌ Unicode cleaning failed (exit #{status}):")
257+
IO.puts(error)
258+
end
259+
else
260+
IO.puts("❌ Script not found: #{script_path}")
261+
IO.puts("Cannot perform Unicode cleaning")
262+
end
263+
264+
:ok
265+
end
266+
267+
defp launch_nqc do
268+
IO.puts("\n🚀 Launching NextGen Query Client...")
269+
270+
nqc_launcher = "/var/mnt/eclipse/repos/nextgen-databases/nqc/nqc-enhanced-launcher.sh"
271+
272+
if File.exists?(nqc_launcher) do
273+
IO.puts("Starting NQC web interface...")
274+
case System.cmd(nqc_launcher, ["--auto"]) do
275+
{0, _} -> IO.puts("✅ NQC launched successfully")
276+
{status, error} -> IO.puts("❌ Failed to launch NQC (exit #{status}): #{error}")
277+
end
278+
else
279+
IO.puts("❌ NQC launcher not found: #{nqc_launcher}")
280+
IO.puts("Please install NQC first")
281+
end
282+
end
283+
284+
defp launch_invariant_path do
285+
IO.puts("\n🔍 Launching Invariant Path...")
286+
287+
ip_launcher = "/var/mnt/eclipse/repos/invariant-path/invariant-path-launcher"
288+
289+
if File.exists?(ip_launcher) do
290+
IO.puts("Starting Invariant Path analysis tool...")
291+
case System.cmd(ip_launcher, ["--auto"]) do
292+
{0, _} -> IO.puts("✅ Invariant Path launched successfully")
293+
{status, error} -> IO.puts("❌ Failed to launch Invariant Path (exit #{status}): #{error}")
294+
end
295+
else
296+
IO.puts("❌ Invariant Path launcher not found: #{ip_launcher}")
297+
IO.puts("Please install Invariant Path first")
298+
end
299+
end
300+
198301
defp show_help do
199302
IO.puts("\n" <> String.duplicate("=", 60))
200303
IO.puts("HELP SYSTEM - Detailed Function Information")
201304
IO.puts(String.duplicate("=", 60))
202305

203-
help_items = %{
306+
help_items = Map.merge(%{
204307
"1" => {
205308
"Wiki Audit",
206309
"Audits GitHub wiki status across repositories",
@@ -260,8 +363,21 @@ defmodule ScriptManager.TUI do
260363
"Processes pull requests across repositories",
261364
"Can add labels, review, or perform other batch operations",
262365
"Use for bulk PR management"
366+
}},
367+
%{
368+
"22" => {
369+
"Launch NQC",
370+
"Launches NextGen Query Client for database operations",
371+
"Provides web interface for VQL/GQL/KQL queries",
372+
"Use for database exploration and querying"
373+
},
374+
"23" => {
375+
"Launch Invariant Path",
376+
"Launches Invariant Path for code analysis",
377+
"Analyzes claim transitions and invariant preservation",
378+
"Use for code documentation and invariant checking"
263379
}
264-
}
380+
})
265381

266382
Enum.each(help_items, fn {num, {name, desc, details, usage}} ->
267383
IO.puts("\n[#{num}] #{name}")
@@ -274,69 +390,4 @@ defmodule ScriptManager.TUI do
274390
IO.puts("Press Enter to return to main menu...")
275391
IO.gets("")
276392
end
277-
278-
defp show_system_status do
279-
IO.puts("\n" <> String.duplicate("=", 60))
280-
IO.puts("SYSTEM STATUS")
281-
IO.puts(String.duplicate("=", 60))
282-
283-
# Check required commands
284-
required_commands = ["bash", "git", "gh", "jq"]
285-
286-
IO.puts("\nRequired Commands:")
287-
Enum.each(required_commands, fn cmd ->
288-
if System.cmd("which", [cmd], [stderr_to_stdout: true]) |> elem(0) == 0 do
289-
IO.puts(" ✅ #{cmd}")
290-
else
291-
IO.puts(" ❌ #{cmd} (missing)")
292-
end
293-
end)
294-
295-
# Check scripts directory
296-
scripts_dir = "scripts"
297-
if File.exists?(scripts_dir) do
298-
script_count = File.ls!(scripts_dir) |> Enum.count()
299-
IO.puts("\nScripts Directory: ✅ #{script_count} scripts found")
300-
else
301-
IO.puts("\nScripts Directory: ❌ Not found")
302-
end
303-
304-
# Check GitHub CLI authentication
305-
IO.puts("\nGitHub CLI Status:")
306-
case System.cmd("gh", ["auth", "status"], [stderr_to_stdout: true]) do
307-
{0, output} -> IO.puts(" ✅ Authenticated: #{String.trim(output)}")
308-
{_, _} -> IO.puts(" ❌ Not authenticated or error")
309-
end
310-
311-
IO.puts("\n" <> String.duplicate("-", 60))
312-
IO.puts("Press Enter to return to main menu...")
313-
IO.gets("")
314-
end
315-
316-
defp run_clean_unicode do
317-
IO.puts("\n🧼 CLEAN UNICODE")
318-
IO.puts("Cleaning hidden/bidirectional Unicode characters from files...")
319-
320-
# Check if script exists
321-
script_path = "/var/mnt/eclipse/scripts/clean-unicode.sh"
322-
323-
if File.exists?(script_path) do
324-
IO.puts("Running: #{script_path}")
325-
326-
# Execute with error handling
327-
case System.cmd(script_path, []) do
328-
{0, output} ->
329-
IO.puts("✅ Unicode cleaning complete!")
330-
IO.puts(output)
331-
{status, error} ->
332-
IO.puts("❌ Unicode cleaning failed (exit #{status}):")
333-
IO.puts(error)
334-
end
335-
else
336-
IO.puts("❌ Script not found: #{script_path}")
337-
IO.puts("Cannot perform Unicode cleaning")
338-
end
339-
340-
:ok
341-
end
342393
end

‎script_manager‎

644 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)