omp-config-crypt 0.6.2 → 0.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +35 -0
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -972,6 +972,41 @@ export default function (pi) {
972
972
  },
973
973
  });
974
974
 
975
+ // Register in-session upgrade command (/upgrade [check|plugins])
976
+ pi.registerCommand("upgrade", {
977
+ description: "Check for and apply updates for OMP and plugins (/upgrade [check|plugins])",
978
+ handler: async (args, ctx) => {
979
+ const clean = (args || "").trim().toLowerCase();
980
+ if (clean === "check") {
981
+ ctx.ui.notify("Checking for OMP updates...", "info");
982
+ try {
983
+ const { exec } = await import("node:child_process");
984
+ const { promisify } = await import("node:util");
985
+ const execAsync = promisify(exec);
986
+ const { stdout } = await execAsync("omp update --check");
987
+ ctx.ui.notify(stdout.trim() || "Check complete.", "info");
988
+ } catch (err) {
989
+ ctx.ui.notify(`Check error: ${err.message}`, "error");
990
+ }
991
+ return;
992
+ }
993
+
994
+ const pluginsOnly = clean === "plugins";
995
+ ctx.ui.notify(pluginsOnly ? "Upgrading all plugins..." : "Upgrading OMP core & plugins in background...", "info");
996
+ try {
997
+ const { exec } = await import("node:child_process");
998
+ const { promisify } = await import("node:util");
999
+ const execAsync = promisify(exec);
1000
+ const cmd = pluginsOnly ? "omp plugin upgrade" : "omp update -l";
1001
+ const { stdout, stderr } = await execAsync(cmd);
1002
+ const output = (stdout + "\n" + stderr).trim().split("\n").filter(Boolean).slice(-2).join("; ");
1003
+ ctx.ui.notify(`Update finished: ${output || "Success"}. Restart OMP to apply kernel changes.`, "info");
1004
+ } catch (err) {
1005
+ ctx.ui.notify(`Upgrade error: ${err.message}`, "error");
1006
+ }
1007
+ },
1008
+ });
1009
+
975
1010
  // Launch non-blocking background auto-maintenance (debounced every 24h)
976
1011
  try {
977
1012
  scheduleAutoMaintenance(configRoot(), 4000);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "omp-config-crypt",
3
- "version": "0.6.2",
3
+ "version": "0.6.3",
4
4
  "description": "Universal cross-platform encrypted portability for omp config, extensions, and instructions",
5
5
  "type": "module",
6
6
  "license": "MIT",