numux 1.19.0 → 1.20.0

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/README.md CHANGED
@@ -223,6 +223,7 @@ Each process accepts:
223
223
  | `maxRestarts` | `number` | `Infinity` | Max auto-restart attempts before giving up |
224
224
  | `delay` | `number` | — | Milliseconds to wait before starting the process |
225
225
  | `condition` | `string` | — | Env var name; process skipped if falsy. Prefix with `!` to negate |
226
+ | `platform` | `string \| string[]` | — | OS(es) this process runs on (e.g. `'darwin'`, `'linux'`). Non-matching processes are removed; dependents still start |
226
227
  | `stopSignal` | `string` | `SIGTERM` | Signal for graceful stop (`SIGTERM`, `SIGINT`, or `SIGHUP`) |
227
228
  | `color` | `string \| string[]` | auto | Hex (e.g. `"#ff6600"`) or basic name: black, red, green, yellow, blue, magenta, cyan, white, gray, orange, purple |
228
229
  | `watch` | `string \| string[]` | — | Glob patterns — restart process when matching files change |
package/dist/numux.js CHANGED
@@ -36,7 +36,7 @@ var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports,
36
36
  var require_package = __commonJS((exports, module) => {
37
37
  module.exports = {
38
38
  name: "numux",
39
- version: "1.19.0",
39
+ version: "1.20.0",
40
40
  description: "Terminal multiplexer with dependency orchestration",
41
41
  type: "module",
42
42
  license: "MIT",
@@ -826,6 +826,34 @@ async function autoDetectConfig(cwd) {
826
826
  throw new Error(`No numux config found. Create one of: ${CONFIG_FILES.join(", ")}, or add a "numux" key to package.json`);
827
827
  }
828
828
 
829
+ // src/config/platform.ts
830
+ function filterByPlatform(config, currentPlatform = process.platform) {
831
+ const excluded = new Set;
832
+ for (const [name, proc] of Object.entries(config.processes)) {
833
+ if (!proc.platform)
834
+ continue;
835
+ const platforms = Array.isArray(proc.platform) ? proc.platform : [proc.platform];
836
+ if (!platforms.includes(currentPlatform)) {
837
+ excluded.add(name);
838
+ }
839
+ }
840
+ if (excluded.size === 0)
841
+ return config;
842
+ const processes = {};
843
+ for (const [name, proc] of Object.entries(config.processes)) {
844
+ if (excluded.has(name))
845
+ continue;
846
+ const copy = { ...proc };
847
+ if (copy.dependsOn) {
848
+ copy.dependsOn = copy.dependsOn.filter((d) => !excluded.has(d));
849
+ if (copy.dependsOn.length === 0)
850
+ copy.dependsOn = undefined;
851
+ }
852
+ processes[name] = copy;
853
+ }
854
+ return { processes };
855
+ }
856
+
829
857
  // src/config/resolver.ts
830
858
  function resolveDependencyTiers(config) {
831
859
  const names = Object.keys(config.processes);
@@ -1086,6 +1114,7 @@ function validateConfig(raw, warnings) {
1086
1114
  const processEnv = p.env && typeof p.env === "object" ? p.env : undefined;
1087
1115
  const processEnvFile = validateEnvFile(p.envFile);
1088
1116
  const showCommand = typeof p.showCommand === "boolean" ? p.showCommand : globalShowCommand ?? true;
1117
+ const platform = validatePlatform(name, p.platform);
1089
1118
  validated[name] = {
1090
1119
  command: p.command,
1091
1120
  cwd: processCwd ?? globalCwd,
@@ -1098,6 +1127,7 @@ function validateConfig(raw, warnings) {
1098
1127
  readyTimeout: typeof p.readyTimeout === "number" && p.readyTimeout > 0 ? p.readyTimeout : undefined,
1099
1128
  delay: typeof p.delay === "number" && p.delay > 0 ? p.delay : undefined,
1100
1129
  condition: typeof p.condition === "string" && p.condition.trim() ? p.condition.trim() : undefined,
1130
+ platform,
1101
1131
  stopSignal: validateStopSignal(p.stopSignal),
1102
1132
  color: typeof p.color === "string" ? p.color : Array.isArray(p.color) ? p.color : undefined,
1103
1133
  watch: validateStringOrStringArray(p.watch),
@@ -1136,6 +1166,19 @@ function validateErrorMatcher(name, value) {
1136
1166
  }
1137
1167
  return;
1138
1168
  }
1169
+ var VALID_PLATFORMS = new Set(["aix", "darwin", "freebsd", "linux", "openbsd", "sunos", "win32"]);
1170
+ function validatePlatform(name, value) {
1171
+ const arr = validateStringOrStringArray(value);
1172
+ if (arr === undefined)
1173
+ return;
1174
+ const values = typeof arr === "string" ? [arr] : arr;
1175
+ for (const v of values) {
1176
+ if (!VALID_PLATFORMS.has(v)) {
1177
+ throw new Error(`Process "${name}".platform "${v}" is not valid. Must be one of: ${[...VALID_PLATFORMS].join(", ")}`);
1178
+ }
1179
+ }
1180
+ return arr;
1181
+ }
1139
1182
  var VALID_STOP_SIGNALS = new Set(["SIGTERM", "SIGINT", "SIGHUP"]);
1140
1183
  function validateStopSignal(value) {
1141
1184
  if (typeof value === "string" && VALID_STOP_SIGNALS.has(value)) {
@@ -3302,6 +3345,7 @@ async function main() {
3302
3345
  const raw = expandScriptPatterns(await loadConfig(parsed.configPath));
3303
3346
  const warnings2 = [];
3304
3347
  let config2 = validateConfig(raw, warnings2);
3348
+ config2 = filterByPlatform(config2);
3305
3349
  if (parsed.only || parsed.exclude) {
3306
3350
  config2 = filterConfig(config2, parsed.only, parsed.exclude);
3307
3351
  }
@@ -3325,6 +3369,10 @@ async function main() {
3325
3369
  flags.push(`delay: ${proc.delay}ms`);
3326
3370
  if (proc.condition)
3327
3371
  flags.push(`if: ${proc.condition}`);
3372
+ if (proc.platform) {
3373
+ const p = Array.isArray(proc.platform) ? proc.platform : [proc.platform];
3374
+ flags.push(`platform: ${p.join(", ")}`);
3375
+ }
3328
3376
  if (proc.watch) {
3329
3377
  const patterns = Array.isArray(proc.watch) ? proc.watch : [proc.watch];
3330
3378
  flags.push(`watch: ${patterns.join(", ")}`);
@@ -3414,6 +3462,7 @@ async function main() {
3414
3462
  } else {
3415
3463
  const raw = expandScriptPatterns(await loadConfig(parsed.configPath));
3416
3464
  config = validateConfig(raw, warnings);
3465
+ config = filterByPlatform(config);
3417
3466
  if (parsed.noRestart) {
3418
3467
  for (const proc of Object.values(config.processes)) {
3419
3468
  proc.maxRestarts = 0;
package/dist/types.d.ts CHANGED
@@ -31,6 +31,8 @@ export interface NumuxProcessConfig<K extends string = string> {
31
31
  delay?: number;
32
32
  /** Env var name (prefix with `!` to negate); process skipped if condition is falsy */
33
33
  condition?: string;
34
+ /** OS(es) this process runs on (e.g. `'darwin'`, `'linux'`). Non-matching processes are removed, their dependents still start */
35
+ platform?: string | string[];
34
36
  /**
35
37
  * Signal for graceful stop
36
38
  * @default 'SIGTERM'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "numux",
3
- "version": "1.19.0",
3
+ "version": "1.20.0",
4
4
  "description": "Terminal multiplexer with dependency orchestration",
5
5
  "type": "module",
6
6
  "license": "MIT",