numux 2.6.0 → 2.7.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
@@ -59,7 +59,7 @@ export default defineConfig({
59
59
 
60
60
  The `defineConfig()` helper is optional — it provides type checking for your config.
61
61
 
62
- Processes can be a string (shorthand for `{ command: "..." }`) or a full config object.
62
+ Processes can be a string (shorthand for `{ command: "..." }`), `true` or `{}` (auto-resolves to a matching `package.json` script), or a full config object.
63
63
 
64
64
  Then run:
65
65
 
@@ -159,6 +159,18 @@ export default defineConfig({
159
159
 
160
160
  Template properties (color, env, dependsOn, etc.) are inherited by all matched processes. Colors given as an array are distributed round-robin.
161
161
 
162
+ When a process has no command and its name matches a `package.json` script, the command is auto-resolved:
163
+
164
+ ```ts
165
+ export default defineConfig({
166
+ processes: {
167
+ lint: true, // → bun run lint
168
+ typecheck: { dependsOn: ['db'] }, // → bun run typecheck (with dependency)
169
+ db: 'docker compose up postgres', // explicit command, not resolved
170
+ },
171
+ })
172
+ ```
173
+
162
174
  ### Options
163
175
 
164
176
  | Flag | Description |
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: "2.6.0",
39
+ version: "2.7.0",
40
40
  description: "Terminal multiplexer with dependency orchestration",
41
41
  type: "module",
42
42
  license: "MIT",
@@ -713,29 +713,60 @@ function splitPatternArgs(raw) {
713
713
  return { glob: raw, extraArgs: "" };
714
714
  return { glob: raw.slice(0, i), extraArgs: raw.slice(i) };
715
715
  }
716
+ function expandScriptCommand(raw, pm) {
717
+ const { glob: script, extraArgs } = splitPatternArgs(raw);
718
+ if (extraArgs) {
719
+ return `${pm} run ${script} --${extraArgs}`;
720
+ }
721
+ return `${pm} run ${script}`;
722
+ }
716
723
  function expandScriptPatterns(config, cwd) {
717
724
  const entries = Object.entries(config.processes);
725
+ const cmd = (v) => typeof v === "string" ? v : v?.command;
718
726
  const hasScriptRef = entries.some(([name, value]) => isScriptReference(name, value));
719
- if (!hasScriptRef)
727
+ const hasNpmCommand = entries.some(([, v]) => {
728
+ const c = cmd(v);
729
+ return typeof c === "string" && c.startsWith("npm:");
730
+ });
731
+ const hasCommandlessEntry = entries.some(([, v]) => {
732
+ if (v == null || v === true)
733
+ return true;
734
+ if (typeof v === "object" && !("command" in v))
735
+ return true;
736
+ return false;
737
+ });
738
+ if (!(hasScriptRef || hasNpmCommand || hasCommandlessEntry))
720
739
  return config;
721
740
  const dir = config.cwd ?? cwd ?? process.cwd();
722
741
  const pkgPath = resolve(dir, "package.json");
723
- if (!existsSync(pkgPath)) {
742
+ if (!existsSync(pkgPath) && hasScriptRef) {
724
743
  throw new Error(`Wildcard patterns require a package.json (looked in ${dir})`);
725
744
  }
726
- const pkgJson = JSON.parse(readFileSync(pkgPath, "utf-8"));
745
+ const pkgJson = existsSync(pkgPath) ? JSON.parse(readFileSync(pkgPath, "utf-8")) : {};
727
746
  const scripts = pkgJson.scripts;
728
- if (!scripts || typeof scripts !== "object") {
729
- throw new Error('package.json has no "scripts" field');
730
- }
731
- const scriptNames = Object.keys(scripts);
747
+ const scriptNames = scripts && typeof scripts === "object" ? Object.keys(scripts) : [];
732
748
  const pm = detectPackageManager(pkgJson, dir);
733
749
  const expanded = {};
734
750
  for (const [name, value] of entries) {
735
751
  if (!isScriptReference(name, value)) {
736
- expanded[name] = value;
752
+ if (value === true || value == null) {
753
+ expanded[name] = scriptNames.includes(name) ? expandScriptCommand(name, pm) : value;
754
+ continue;
755
+ }
756
+ let proc = value;
757
+ const c = cmd(proc);
758
+ if (typeof c === "string" && c.startsWith("npm:")) {
759
+ const expandedCmd = expandScriptCommand(c.slice(4), pm);
760
+ proc = typeof proc === "string" ? expandedCmd : { ...proc, command: expandedCmd };
761
+ } else if (!c && scriptNames.includes(name)) {
762
+ proc = { ...proc, command: expandScriptCommand(name, pm) };
763
+ }
764
+ expanded[name] = proc;
737
765
  continue;
738
766
  }
767
+ if (!scripts || typeof scripts !== "object") {
768
+ throw new Error('package.json has no "scripts" field');
769
+ }
739
770
  const rawPattern = name.startsWith("npm:") ? name.slice(4) : name;
740
771
  const { glob: globPattern, extraArgs } = splitPatternArgs(rawPattern);
741
772
  const template = value ?? {};
@@ -762,7 +793,7 @@ function expandScriptPatterns(config, cwd) {
762
793
  const { color: _color, ...rest } = template;
763
794
  expanded[displayName] = {
764
795
  ...rest,
765
- command: `${pm} run ${scriptName}${extraArgs}`,
796
+ command: expandScriptCommand(`${scriptName}${extraArgs}`, pm),
766
797
  ...color ? { color } : {}
767
798
  };
768
799
  }
@@ -1329,7 +1360,7 @@ function expandWorkspaces(config) {
1329
1360
  const newProcesses = {};
1330
1361
  let discoveredWorkspaces = null;
1331
1362
  for (const [name, entry] of Object.entries(config.processes)) {
1332
- if (typeof entry === "string" || !entry.workspaces) {
1363
+ if (typeof entry === "string" || entry === true || !entry.workspaces) {
1333
1364
  newProcesses[name] = entry;
1334
1365
  continue;
1335
1366
  }
package/dist/types.d.ts CHANGED
@@ -119,7 +119,7 @@ export interface NumuxConfig<K extends string = string> {
119
119
  noWatch?: boolean;
120
120
  /** Directory to write per-process log files */
121
121
  logDir?: string;
122
- processes: Record<K, NumuxProcessConfig<K> | NumuxScriptPattern<K> | string>;
122
+ processes: Record<K, NumuxProcessConfig<K> | NumuxScriptPattern<K> | string | true>;
123
123
  }
124
124
  export type SortOrder = 'config' | 'alphabetical' | 'topological';
125
125
  /** Process config after validation — dependsOn is always normalized to an array */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "numux",
3
- "version": "2.6.0",
3
+ "version": "2.7.0",
4
4
  "description": "Terminal multiplexer with dependency orchestration",
5
5
  "type": "module",
6
6
  "license": "MIT",