omp-config-crypt 0.6.1 → 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.
- package/bin/omp-sync.js +11 -2
- package/index.js +35 -0
- package/package.json +1 -1
package/bin/omp-sync.js
CHANGED
|
@@ -70,6 +70,7 @@ Options:
|
|
|
70
70
|
--public Save as public (synced across machines via models.yml)
|
|
71
71
|
-y, --yes Non-interactive mode (use defaults without prompting)
|
|
72
72
|
-f, --force Force operations (e.g. bypass maintenance debounce)
|
|
73
|
+
--profile <name> Target specific profile scene (e.g. dev, ops)
|
|
73
74
|
|
|
74
75
|
Environment Variables:
|
|
75
76
|
OMP_CONFIG_PASS Passphrase for non-interactive automation
|
|
@@ -100,6 +101,7 @@ function parseCliArgs(argv) {
|
|
|
100
101
|
nonInteractive: false,
|
|
101
102
|
force: false,
|
|
102
103
|
positional: [],
|
|
104
|
+
profile: null,
|
|
103
105
|
};
|
|
104
106
|
|
|
105
107
|
const positional = [];
|
|
@@ -137,6 +139,10 @@ function parseCliArgs(argv) {
|
|
|
137
139
|
options.nonInteractive = true;
|
|
138
140
|
} else if (a === "-f" || a === "--force") {
|
|
139
141
|
options.force = true;
|
|
142
|
+
} else if (a === "--profile") {
|
|
143
|
+
options.profile = args[++i];
|
|
144
|
+
} else if (a.startsWith("--profile=")) {
|
|
145
|
+
options.profile = a.slice(10);
|
|
140
146
|
} else if (a.startsWith("--pass=")) {
|
|
141
147
|
options.pass = a.slice(7);
|
|
142
148
|
} else if (a.startsWith("--token=")) {
|
|
@@ -198,8 +204,11 @@ async function main() {
|
|
|
198
204
|
process.exit(options.help ? 0 : 1);
|
|
199
205
|
}
|
|
200
206
|
|
|
201
|
-
const root =
|
|
202
|
-
|
|
207
|
+
const root =
|
|
208
|
+
options.root ||
|
|
209
|
+
(options.profile
|
|
210
|
+
? path.join(os.homedir(), ".omp", "profiles", options.profile, "agent")
|
|
211
|
+
: configRoot());
|
|
203
212
|
try {
|
|
204
213
|
switch (options.command) {
|
|
205
214
|
case "export": {
|
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);
|