diff --git a/HubitatPackageManagerTools/Executors/ManifestConvertExecutor.cs b/HubitatPackageManagerTools/Executors/ManifestConvertExecutor.cs
new file mode 100644
index 0000000..79adc47
--- /dev/null
+++ b/HubitatPackageManagerTools/Executors/ManifestConvertExecutor.cs
@@ -0,0 +1,74 @@
+using HubitatPackageManagerTools.Options;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Text;
+
+namespace HubitatPackageManagerTools.Executors
+{
+ internal class ManifestConvertExecutor : ManifestExecutorBase
+ {
+ public int Execute(ManifestConvertOptions options)
+ {
+ using var file = File.OpenText(options.SmartThingsFile);
+ var stFile = (JObject)JToken.ReadFrom(new JsonTextReader(file));
+
+ var newManifestContents = new JObject
+ {
+ ["packageName"] = stFile["name"],
+ ["author"] = stFile["author"],
+ ["minimumHEVersion"] = "0.0",
+ ["dateReleased"] = DateTime.Now.ToString("yyyy-MM-dd"),
+ ["apps"] = new JArray(),
+ ["drivers"] = new JArray()
+ };
+
+ var stParentApp = stFile["smartApps"]["parent"];
+ var parentApp = JObject.FromObject(new
+ {
+ id = Guid.NewGuid(),
+ name = stParentApp["name"],
+ @namespace = stFile["namespace"],
+ version = stParentApp["version"],
+ location = $"https://raw.githubusercontent.com/{stFile["repoOwner"]}/{stFile["repoName"]}/{stFile["repoBranch"]}/{stParentApp["appUrl"]}",
+ required = !((bool?)stParentApp["optional"] ?? true),
+ oauth = (bool?)stParentApp["oAuth"] ?? false
+ });
+ (newManifestContents["apps"] as JArray).Add(parentApp);
+ foreach (var stApp in stFile["smartApps"]["children"])
+ {
+ var app = JObject.FromObject(new
+ {
+ id = Guid.NewGuid(),
+ name = stApp["name"],
+ @namespace = stFile["namespace"],
+ version = stApp["version"],
+ location = $"https://raw.githubusercontent.com/{stFile["repoOwner"]}/{stFile["repoName"]}/{stFile["repoBranch"]}/{stApp["appUrl"]}",
+ required = !((bool?)stApp["optional"] ?? true),
+ oauth = (bool?)stApp["oAuth"] ?? false
+ });
+ (newManifestContents["apps"] as JArray).Add(app);
+ }
+
+ foreach (var dth in stFile["deviceHandlers"])
+ {
+ var driver = JObject.FromObject(new
+ {
+ id = Guid.NewGuid(),
+ name = dth["name"],
+ @namespace = stFile["namespace"],
+ version = dth["version"],
+ location = $"https://raw.githubusercontent.com/{stFile["repoOwner"]}/{stFile["repoName"]}/{stFile["repoBranch"]}/{dth["appUrl"]}",
+ required = !((bool?)dth["optional"] ?? true)
+ });
+ (newManifestContents["drivers"] as JArray).Add(driver);
+ }
+
+ SaveManifest(options, newManifestContents);
+
+ return 0;
+ }
+ }
+}
diff --git a/HubitatPackageManagerTools/HubitatPackageManagerTools.csproj b/HubitatPackageManagerTools/HubitatPackageManagerTools.csproj
index aaddeea..ee20dfb 100644
--- a/HubitatPackageManagerTools/HubitatPackageManagerTools.csproj
+++ b/HubitatPackageManagerTools/HubitatPackageManagerTools.csproj
@@ -4,6 +4,13 @@
Exe
netcoreapp3.1
hpm
+ 1.1.0
+
+
+
+ x86
+ none
+ false
diff --git a/HubitatPackageManagerTools/Options/ManifestConvertOptions.cs b/HubitatPackageManagerTools/Options/ManifestConvertOptions.cs
new file mode 100644
index 0000000..dcdb448
--- /dev/null
+++ b/HubitatPackageManagerTools/Options/ManifestConvertOptions.cs
@@ -0,0 +1,14 @@
+using CommandLine;
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace HubitatPackageManagerTools.Options
+{
+ [Verb("manifest-convert", HelpText = "Convert a SmartThings Community Installer manifest to a Hubitat Package Manager manifest.")]
+ internal class ManifestConvertOptions : ManifestOptionsBase
+ {
+ [Value(0, HelpText = "The local path to the SmartThings installer manifest JSON.", MetaName = "stInstallerFile", Required = true)]
+ public string SmartThingsFile { get; set; }
+ }
+}
diff --git a/HubitatPackageManagerTools/Program.cs b/HubitatPackageManagerTools/Program.cs
index b232930..5a03788 100644
--- a/HubitatPackageManagerTools/Program.cs
+++ b/HubitatPackageManagerTools/Program.cs
@@ -28,6 +28,7 @@ static int Main(string[] args)
ManifestModifyOptions,
ManifestRemoveAppOptions,
ManifestRemoveDriverOptions,
+ ManifestConvertOptions,
RepositoryAddPackageOptions,
RepositoryCreateOptions,
RepositoryModifyOptions,
@@ -50,7 +51,8 @@ static int Main(string[] args)
(ManifestRemoveAppOptions opts) => new ManifestRemoveAppExecutor().Execute(opts),
(ManifestRemoveDriverOptions opts) => new ManifestRemoveDriverExecutor().Execute(opts),
(ManifestModifyAppOptions opts) => new ManifestModifyAppExecutor().Execute(opts),
- (ManifestModifyDriverOptions opts) => new ManifestModifyDriverExecutor().Execute(opts)
+ (ManifestModifyDriverOptions opts) => new ManifestModifyDriverExecutor().Execute(opts),
+ (ManifestConvertOptions opts) => new ManifestConvertExecutor().Execute(opts)
, errs =>
{
var helpText = HelpText.AutoBuild(result, h =>