diff --git a/NozCli/NozCli.csproj b/NozCli/NozCli.csproj
index 5dc2529..ffdb6bb 100644
--- a/NozCli/NozCli.csproj
+++ b/NozCli/NozCli.csproj
@@ -13,6 +13,28 @@
net10.0
enable
enable
+ noz
+ NozCli
+ true
+ true
+ 0.1.0
+ 0.1.0
+
+
+
+
+
+
+ $(GitShortHash)
+
+
+
+
+
+
+
+
+
diff --git a/NozCli/Program.cs b/NozCli/Program.cs
index 018abb4..66c2d62 100644
--- a/NozCli/Program.cs
+++ b/NozCli/Program.cs
@@ -1,13 +1,23 @@
+using NozCli;
using NozCli.Core.Config;
using NozCli.Repl;
using Spectre.Console;
+// ── noz --version / -v ───────────────────────────────────────────────────────
+if (args is ["--version"] or ["-v"] or ["version"])
+{
+ Console.WriteLine($"noz {VersionInfo.Full}");
+ return 0;
+}
+
// ── noz init ────────────────────────────────────────────────────
if (args is ["init", var url, var token])
{
- if (!url.StartsWith("https://", StringComparison.OrdinalIgnoreCase))
+ var isLocalhost = url.StartsWith("http://localhost", StringComparison.OrdinalIgnoreCase)
+ || url.StartsWith("http://127.", StringComparison.OrdinalIgnoreCase);
+ if (!isLocalhost && !url.StartsWith("https://", StringComparison.OrdinalIgnoreCase))
{
- AnsiConsole.MarkupLine("[red]Error:[/] Only HTTPS servers are allowed.");
+ AnsiConsole.MarkupLine("[red]Error:[/] Only HTTPS servers are allowed (localhost HTTP is ok for dev).");
return 1;
}
diff --git a/NozCli/VersionInfo.cs b/NozCli/VersionInfo.cs
new file mode 100644
index 0000000..18e996f
--- /dev/null
+++ b/NozCli/VersionInfo.cs
@@ -0,0 +1,26 @@
+using System.Reflection;
+
+namespace NozCli;
+
+public static class VersionInfo
+{
+ private static readonly string _informational =
+ typeof(VersionInfo).Assembly
+ .GetCustomAttribute()
+ ?.InformationalVersion ?? "0.0.0";
+
+ // "0.1.0+abc1234" → "0.1.0"
+ public static string Version =>
+ _informational.Contains('+')
+ ? _informational[.._informational.IndexOf('+')]
+ : _informational;
+
+ // "0.1.0+abc1234" → "abc1234", or "" if no hash
+ public static string GitHash =>
+ _informational.Contains('+')
+ ? _informational[(_informational.IndexOf('+') + 1)..]
+ : "";
+
+ public static string Full =>
+ GitHash.Length > 0 ? $"{Version} ({GitHash})" : Version;
+}