Skip to content

Commit 73aa792

Browse files
author
ericw
committed
Rounds 22-28: 11 new tools — Env, Cron, Triggers, Monitor, Tunnel, Draw, Edit, Record, Music, Email, Meet
Round 22 (Followups): neuros-update, neuros-dashboard, test_autofix.py Round 23 (AI): neuros-explain, neuros-search, neuros-teach, neuros-write, neuros-plan Round 24 (File Mgmt): neuros-rename, neuros-organize, neuros-dedup, neuros-compress, neuros-sync Round 25 (Automation): neuros-alert, neuros-log, neuros-cron, neuros-trigger Round 26 (DevOps): neuros-deploy, neuros-monitor, neuros-tunnel, neuros-env Round 27 (Media): neuros-draw, neuros-edit, neuros-record, neuros-music Round 28 (Comm): neuros-email, neuros-meet, neuros-pair, neuros-share Highlights: - neuros-cron: NL→cron AI parser, conflict detection, import/export - neuros-trigger: file/process/port/resource watchers, daemon mode - neuros-monitor: real-time terminal dashboard (CPU/GPU/mem/disk/net) - neuros-tunnel: SSH local/remote/socks + autossh + expose - neuros-edit: AI diff/preview/undo/batch/spellcheck - neuros-draw: prompt enhancement, SVG/mermaid/ASCII art - neuros-email: compose/reply/summarize/filter - neuros-meet: schedule/notes/summarize/action-items/followup Infrastructure: 0700 hook (+29 tools), zshrc (+29 aliases), validate-build.sh (+29 tool checks + new alias checks) 247 validations, 25 tests — all pass
1 parent 6baaef6 commit 73aa792

32 files changed

Lines changed: 9314 additions & 0 deletions

config/hooks/live/0700-install-neuros-tools.hook.chroot

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,34 @@ NEUROS_TOOLS=(
5959
"/usr/local/bin/neuros-refactor"
6060
"/usr/local/bin/neuros-scan"
6161
"/usr/local/bin/neuros-autofix"
62+
"/usr/local/bin/neuros-update"
63+
"/usr/local/bin/neuros-dashboard"
64+
"/usr/local/bin/neuros-explain"
65+
"/usr/local/bin/neuros-search"
66+
"/usr/local/bin/neuros-teach"
67+
"/usr/local/bin/neuros-write"
68+
"/usr/local/bin/neuros-plan"
69+
"/usr/local/bin/neuros-rename"
70+
"/usr/local/bin/neuros-organize"
71+
"/usr/local/bin/neuros-dedup"
72+
"/usr/local/bin/neuros-compress"
73+
"/usr/local/bin/neuros-sync"
74+
"/usr/local/bin/neuros-alert"
75+
"/usr/local/bin/neuros-log"
76+
"/usr/local/bin/neuros-deploy"
77+
"/usr/local/bin/neuros-pair"
78+
"/usr/local/bin/neuros-share"
79+
"/usr/local/bin/neuros-env"
80+
"/usr/local/bin/neuros-cron"
81+
"/usr/local/bin/neuros-trigger"
82+
"/usr/local/bin/neuros-monitor"
83+
"/usr/local/bin/neuros-tunnel"
84+
"/usr/local/bin/neuros-draw"
85+
"/usr/local/bin/neuros-edit"
86+
"/usr/local/bin/neuros-record"
87+
"/usr/local/bin/neuros-music"
88+
"/usr/local/bin/neuros-email"
89+
"/usr/local/bin/neuros-meet"
6290
)
6391

6492
for tool in "${NEUROS_TOOLS[@]}"; do

config/includes.chroot/etc/skel/.zshrc

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,33 @@ alias nwf="neuros-workflow"
123123
alias npipe="neuros-pipe"
124124
alias nbatch="neuros-batch"
125125
alias ntemplate="neuros-template"
126+
alias nupdate="neuros-update"
127+
alias ndash="neuros-dashboard"
128+
alias nsearch="neuros-search"
129+
alias nteach="neuros-teach"
130+
alias nwrite="neuros-write"
131+
alias nplan="neuros-plan"
132+
alias nrename="neuros-rename"
133+
alias norg="neuros-organize"
134+
alias ndedup="neuros-dedup"
135+
alias ncompress="neuros-compress"
136+
alias nsync="neuros-sync"
137+
alias nalert="neuros-alert"
138+
alias nlog="neuros-log"
139+
alias ndeploy="neuros-deploy"
140+
alias npair="neuros-pair"
141+
alias nshare="neuros-share"
142+
alias nenv="neuros-env"
143+
alias ncron="neuros-cron"
144+
alias ntrigger="neuros-trigger"
145+
alias nmon="neuros-monitor"
146+
alias ntunnel="neuros-tunnel"
147+
alias ndraw="neuros-draw"
148+
alias nedit="neuros-edit"
149+
alias nrecord="neuros-record"
150+
alias nmusic="neuros-music"
151+
alias nemail="neuros-email"
152+
alias nmeet="neuros-meet"
126153

127154
# === nn shell integration ===
128155
# Ctrl+Space for quick nn access
Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
#!/usr/bin/env python3
2+
"""
3+
neuros-alert — NeurOS Multi-Channel Alert System
4+
Sends alerts via desktop notifications, webhooks, email, or custom scripts.
5+
Triggered by other tools or used standalone.
6+
7+
Usage:
8+
neuros-alert "Disk is at 95%!" Send desktop notification
9+
neuros-alert --webhook "https://..." "Server down" Send to webhook
10+
neuros-alert --email admin@x.com "Backup failed" Email alert
11+
neuros-alert --script /path/to/alert.sh "Event" Run custom alert script
12+
neuros-alert --listen Listen for stdin alerts
13+
"""
14+
15+
import sys
16+
import os
17+
import json
18+
import shlex
19+
import subprocess
20+
import argparse
21+
import urllib.request
22+
import urllib.error
23+
from datetime import datetime
24+
25+
CONFIG_DIR = os.path.expanduser("~/.config/neuros")
26+
ALERT_LOG = os.path.expanduser("~/.local/share/neuros/alerts.json")
27+
28+
29+
def ensure_dirs():
30+
os.makedirs(os.path.dirname(ALERT_LOG), exist_ok=True)
31+
32+
33+
def log_alert(channel, message, success):
34+
history = []
35+
if os.path.exists(ALERT_LOG):
36+
with open(ALERT_LOG) as f:
37+
history = json.load(f)
38+
history.append({
39+
"timestamp": datetime.now().isoformat(),
40+
"channel": channel,
41+
"message": message[:500],
42+
"success": success
43+
})
44+
if len(history) > 200:
45+
history = history[-200:]
46+
with open(ALERT_LOG, "w") as f:
47+
json.dump(history, f, indent=2)
48+
49+
50+
def send_desktop(title, body, urgency="normal"):
51+
try:
52+
subprocess.run(
53+
["notify-send", "-u", urgency, title, body],
54+
timeout=5, capture_output=True
55+
)
56+
return True
57+
except Exception:
58+
return False
59+
60+
61+
def send_webhook(url, message):
62+
try:
63+
data = json.dumps({"text": message, "timestamp": datetime.now().isoformat()}).encode()
64+
req = urllib.request.Request(url, data=data,
65+
headers={"Content-Type": "application/json"})
66+
urllib.request.urlopen(req, timeout=10)
67+
return True
68+
except Exception:
69+
return False
70+
71+
72+
def send_email(to, subject, body):
73+
try:
74+
proc = subprocess.run(
75+
["mail", "-s", subject, to],
76+
input=body, text=True, capture_output=True, timeout=10
77+
)
78+
return proc.returncode == 0
79+
except Exception:
80+
return False
81+
82+
83+
def run_script(script_path, message):
84+
try:
85+
result = subprocess.run(
86+
[script_path, message],
87+
capture_output=True, text=True, timeout=30
88+
)
89+
return result.returncode == 0
90+
except Exception:
91+
return False
92+
93+
94+
def listen_stdin():
95+
print("👂 Alert listener active (Ctrl+C to stop)")
96+
try:
97+
for line in sys.stdin:
98+
line = line.strip()
99+
if not line:
100+
continue
101+
send_desktop("NeurOS Alert", line)
102+
print(f" 🔔 {line}")
103+
except KeyboardInterrupt:
104+
pass
105+
106+
107+
def main():
108+
ensure_dirs()
109+
parser = argparse.ArgumentParser(description="NeurOS Alert System")
110+
parser.add_argument("message", nargs="?", help="Alert message")
111+
parser.add_argument("--webhook", "-w", help="Webhook URL")
112+
parser.add_argument("--email", "-e", help="Email recipient")
113+
parser.add_argument("--script", "-s", help="Custom alert script")
114+
parser.add_argument("--urgency", "-u", default="normal",
115+
choices=["low", "normal", "critical"])
116+
parser.add_argument("--title", "-t", default="NeurOS Alert")
117+
parser.add_argument("--listen", "-l", action="store_true",
118+
help="Listen for stdin alerts")
119+
120+
args = parser.parse_args()
121+
122+
if args.listen:
123+
listen_stdin()
124+
return
125+
126+
if not args.message:
127+
parser.print_help()
128+
return
129+
130+
results = []
131+
132+
if args.webhook:
133+
ok = send_webhook(args.webhook, args.message)
134+
log_alert("webhook", args.message, ok)
135+
results.append(f"{'✅' if ok else '❌'} webhook")
136+
137+
if args.email:
138+
ok = send_email(args.email, args.title, args.message)
139+
log_alert("email", args.message, ok)
140+
results.append(f"{'✅' if ok else '❌'} email")
141+
142+
if args.script:
143+
ok = run_script(args.script, args.message)
144+
log_alert("script", args.message, ok)
145+
results.append(f"{'✅' if ok else '❌'} script")
146+
147+
if not (args.webhook or args.email or args.script):
148+
ok = send_desktop(args.title, args.message, args.urgency)
149+
log_alert("desktop", args.message, ok)
150+
results.append(f"{'✅' if ok else '❌'} desktop")
151+
152+
if results:
153+
print(f" Alert: {' '.join(results)}")
154+
155+
156+
if __name__ == "__main__":
157+
main()

0 commit comments

Comments
 (0)