neex 0.4.6 → 0.5.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
@@ -6,7 +6,7 @@
6
6
  </picture>
7
7
  </a>
8
8
 
9
- # Neex v0.1.2
9
+ # Neex v0.5.0
10
10
 
11
11
  ### 🚀 Neex: The Modern Build System for Polyrepo-in-Monorepo Architecture
12
12
 
@@ -20,12 +20,12 @@
20
20
 
21
21
  next + express = neex 🌱
22
22
 
23
- Neex is a modern build system designed to bridge the gap between polyrepo and monorepo architectures. It provides powerful script execution capabilities with features like parallel processing, colored output, and intelligent build orchestration. Whether you're managing a complex monorepo or coordinating multiple repositories, neex makes your development workflow more efficient and visually organized.
23
+ Neex is a modern build system and script runner designed for **Polyrepo-in-Monorepo** architectures, but powerful enough for any project. It simplifies managing and running multiple scripts across your project, whether they are microservices, frontend applications, or build tasks. Neex offers robust features like parallel and sequential execution, live-reloading for development (`watch`), optimized server running (`servers`), and even basic process management (`pm2`-like commands), all aimed at making your development workflow more efficient, organized, and visually clear.
24
24
 
25
25
  ## ✨ Key Features
26
26
 
27
27
  - 🎨 **Colored Output** - Distinguish commands with unique colors
28
- - ⚡ **Dual Execution Modes** - Run commands in parallel (`p`, `runx`) or sequence (`s`, `run`)
28
+ - ⚡ **Dual Execution Modes** - Run commands in parallel (`px`) or sequence (`s`, `run`)
29
29
  - ⏱️ **Smart Timing** - Track execution time for each command
30
30
  - 🛑 **Error Control** - Stop on first error (perfect for CI/CD)
31
31
  - 🔢 **Parallel Control** - Limit concurrent processes with `--max-parallel`
@@ -34,7 +34,24 @@ Neex is a modern build system designed to bridge the gap between polyrepo and mo
34
34
  - 🤫 **Flexible Display** - Control prefixes, timing, and output visibility
35
35
  - 🧰 **Node.js API** - Programmatic usage in your applications
36
36
 
37
- ## Quick Start
37
+ ## 🚀 Installation
38
+
39
+ Install Neex globally to use it anywhere, or locally in your project.
40
+
41
+ ```bash
42
+ # Global install
43
+ npm install -g neex
44
+
45
+ # Local install
46
+ npm install --save-dev neex # npm
47
+ yarn add --dev neex # yarn
48
+ pnpm add --save-dev neex # pnpm
49
+ bun add --dev neex # bun
50
+ ```
51
+
52
+ When installed locally, you can run Neex commands using `npx neex ...` or by adding them to your `package.json` scripts.
53
+
54
+ ## 🖥️ Usage
38
55
 
39
56
  ```bash
40
57
  # Global install
@@ -49,36 +66,148 @@ bun add -D neex # bun
49
66
 
50
67
  ## 🖥️ Usage
51
68
 
52
- ### Commands
69
+ ### Core Commands
70
+
71
+ Neex provides several commands to manage and run your scripts:
72
+
73
+ - **`px <commands...>`** (*default command*)
74
+ - Runs specified commands in **parallel** by default.
75
+ - Use the `-q` or `--sequential` flag to run them sequentially.
76
+ - Ideal for build steps, tests, or any tasks that can run concurrently.
77
+
78
+ - **`run <commands...>`** (alias: `s`)
79
+ - Runs specified commands **sequentially**.
80
+ - Useful for tasks that depend on the completion of previous ones (e.g., build then deploy).
53
81
 
54
- - `runx` (alias: `p`) - Run in **parallel** (default)
55
- - `run` (alias: `s`) - Run **sequentially**
82
+ - **`servers <commands...>`** (alias: `srv`)
83
+ - Optimized for running multiple development **servers** (e.g., backend API, frontend app) in parallel.
84
+ - Provides grouped and clear output for each server, making it easy to monitor logs.
85
+ - Detects and displays server ports and URLs.
56
86
 
57
- ### Examples
87
+ - **`watch <commands...>`** (alias: `w`)
88
+ - Runs commands and **watches for file changes** to automatically restart them (Nodemon-like functionality).
89
+ - Highly configurable with options for watched paths, ignored patterns, extensions, and restart delays.
90
+ - Perfect for development workflows where you need instant feedback on code changes.
91
+
92
+ - **Process Management Commands**
93
+ - Neex provides built-in process management capabilities, similar to PM2, for long-running applications. These commands operate directly under `neex`:
94
+ - **`start <script_path_or_command> [--name <name>] [--watch] [-- <args...>]`**: Start a new process.
95
+ - **`stop <name_or_id>`**: Stop a running process.
96
+ - **`restart <name_or_id>`**: Restart a running process.
97
+ - **`delete <name_or_id>`**: Stop and delete a process from the list.
98
+ - **`list`** (aliases: `ls`, `status`): List all managed processes.
99
+ - **`logs [name_or_id] [--lines <number>] [--follow]`**: Display logs for a specific process or all if no ID is given.
100
+ - **`monit`**: Launch a monitoring interface for all managed processes.
101
+ - **`save`**: Save the current list of running processes.
102
+ - **`resurrect`**: Restart processes that were previously saved.
103
+ - **`startup`**: Generate a sample startup script (e.g., for systemd).
104
+
105
+ ### General Command Examples
58
106
 
59
107
  ```bash
60
- # Parallel execution (default)
61
- neex p "echo Task 1" "echo Task 2" "echo Task 3"
108
+ # Parallel execution (default behavior for px)
109
+ neex px "npm run build:api" "npm run build:frontend" "npm run lint"
110
+ # px is the command for parallel execution
111
+ neex px "npm run test:unit" "npm run test:integration"
62
112
 
63
113
  # Sequential execution
64
- neex s "echo Step 1" "echo Step 2" "echo Step 3"
114
+ neex run "npm run clean" "npm run build" "npm run deploy"
115
+ # Alias for sequential
116
+ neex s "echo First" "echo Second" "echo Third"
117
+
118
+ # Run 'px' commands sequentially using the -q flag
119
+ neex px -q "npm run step1" "npm run step2"
120
+ ```
121
+
122
+ ### `servers` Command Examples
123
+
124
+ ```bash
125
+ # Start frontend and backend development servers
126
+ neex servers "cd frontend && npm start" "cd backend && npm start"
127
+
128
+ # Group output for better readability
129
+ neex servers --group-output "npm run dev:service-a" "npm run dev:service-b"
130
+ ```
131
+
132
+ ### `watch` Command Examples
133
+
134
+ ```bash
135
+ # Watch for changes in './src' and restart 'npm run build'
136
+ neex watch "npm run build" -w ./src
137
+
138
+ # Watch for .ts file changes in 'services/' and restart two commands, ignoring 'node_modules'
139
+ neex watch "npm run start:service1" "npm run start:service2" -w services/ -e ts -i node_modules/**
140
+
141
+ # Clear console on restart and set a delay
142
+ neex watch "node server.js" --clear --delay 1500
143
+ ```
144
+
145
+ ### Process Management Command Examples
146
+
147
+ ```bash
148
+ # Start a Node.js app and give it a name
149
+ neex start server.js --name my-app
150
+
151
+ # Start an app and watch for file changes
152
+ neex start api/index.js --name my-api --watch
153
+
154
+ # List all running processes managed by neex
155
+ neex list
65
156
 
66
- # Parallel with sequential flag
67
- neex p -q "echo Step 1" "echo Step 2" "echo Step 3"
157
+ # View logs for 'my-app'
158
+ neex logs my-app
159
+
160
+ # Stop 'my-api'
161
+ neex stop my-api
162
+
163
+ # Restart 'my-app'
164
+ neex restart my-app
165
+
166
+ # Delete 'my-api' from neex management
167
+ neex delete my-api
68
168
  ```
69
169
 
70
- ### 🛠️ Options
170
+ ### 📚 Examples
71
171
 
72
- | Flag | Alias | Description | Default |
73
- |------|-------|-------------|----------|
74
- | `--no-color` | `-c` | Disable colors | `false` |
75
- | `--no-timing` | `-t` | Hide timing | `false` |
76
- | `--no-prefix` | `-p` | Hide prefixes | `false` |
77
- | `--stop-on-error` | `-s` | Stop on failure | `false` |
78
- | `--no-output` | `-o` | Hide all output | `false` |
79
- | `--max-parallel` | `-m` | Max parallel tasks | CPU count |
80
- | `--sequential` | `-q` | Force sequential | `false` |
172
+ ### Parallel Execution
173
+
174
+ ```bash
175
+ # Parallel execution (default behavior for p)
176
+ neex p "npm run build:api" "npm run build:frontend" "npm run lint"
177
+ neex par "npm run test:unit" "npm run test:integration"
178
+ neex parallel "npm run test:frontend" "npm run test:backend"
179
+ ```
180
+
181
+ ### Sequential Execution
182
+
183
+ ```bash
184
+ # Sequential execution using s command
185
+ neex s "npm run clean" "npm run build" "npm run deploy"
186
+ neex seq "echo First" "echo Second" "echo Third"
187
+ neex sequential "npm run step1" "npm run step2" "npm run step3"
188
+ ```
189
+
190
+ ### Parallel with Sequential Flag
191
+
192
+ ```bash
193
+ # Run parallel commands sequentially using the -q flag
194
+ neex p -q "npm run step1" "npm run step2"
195
+ neex par -q "npm run build" "npm run test"
196
+ neex parallel -q "npm run lint" "npm run format"
197
+ ```
198
+
199
+ ### Advanced Options
200
+
201
+ ```bash
202
+ # With retry options
203
+ neex p --retry 3 --retry-delay 1000 "npm run test"
81
204
 
205
+ # With output control
206
+ neex s --no-color --no-timing --no-output "npm run build"
207
+
208
+ # With parallel limits
209
+ neex p --max-parallel 2 "npm run build:frontend" "npm run build:backend" "npm run build:api"
210
+ ```
82
211
 
83
212
  ### Advanced Example
84
213
 
@@ -115,17 +244,38 @@ async function main() {
115
244
  }
116
245
  ```
117
246
 
118
- ### API Options
247
+ ### API Options (`RunOptions`)
248
+
249
+ When using Neex programmatically, you can pass an options object to the `run` function:
119
250
 
120
251
  ```typescript
121
- interface RunOptions {
122
- parallel?: boolean; // Run in parallel (default: true)
123
- maxParallel?: number; // Max parallel processes (default: CPU count)
124
- color?: boolean; // Enable colors (default: true)
125
- prefix?: boolean; // Show command prefix (default: true)
126
- showTiming?: boolean; // Show timing info (default: true)
127
- printOutput?: boolean; // Show command output (default: true)
128
- stopOnError?: boolean; // Stop on failure (default: false)
252
+ export interface RunOptions {
253
+ // Run in parallel or sequentially
254
+ parallel: boolean;
255
+ // Maximum number of parallel processes (default: CPU count)
256
+ maxParallel?: number;
257
+ // Show command output (default: true)
258
+ printOutput: boolean;
259
+ // Color output (default: true)
260
+ color: boolean;
261
+ // Show timing information (default: true)
262
+ showTiming: boolean;
263
+ // Show command prefix (default: true)
264
+ prefix: boolean;
265
+ // Stop on error (default: false)
266
+ stopOnError: boolean;
267
+ // Use minimal output format (default: false)
268
+ minimalOutput: boolean;
269
+ // Group output by command (default: false, mainly for server mode)
270
+ groupOutput: boolean;
271
+ // Use server mode formatting (default: false)
272
+ isServerMode: boolean;
273
+ // Number of times to retry a failed command (default: 0)
274
+ retry?: number;
275
+ // Delay in milliseconds between retries (default: 1000)
276
+ retryDelay?: number;
277
+ // Callback to register a cleanup function, called on SIGINT/SIGTERM
278
+ registerCleanup?: (cleanupFn: () => void) => void;
129
279
  }
130
280
  ```
131
281
 
@@ -141,17 +291,54 @@ steps:
141
291
  run: neex p -s -m 4 "npm run lint" "npm test" "npm run e2e"
142
292
  ```
143
293
 
144
- ## 💡 Real-world Examples
294
+ ## 💡 Real-world Scenarios & `package.json` Integration
295
+
296
+ Neex shines when integrated into your `package.json` scripts.
297
+
298
+ **Example `package.json` scripts:**
299
+
300
+ ```json
301
+ {
302
+ "scripts": {
303
+ "dev:frontend": "cd packages/frontend && npm run dev",
304
+ "dev:backend": "cd packages/api && npm run dev",
305
+ "dev": "neex servers \"npm run dev:frontend\" \"npm run dev:backend\" --group-output",
306
+
307
+ "build:ui": "cd packages/ui-library && npm run build",
308
+ "build:app": "cd packages/main-app && npm run build",
309
+ "build": "neex runx \"npm run build:ui\" \"npm run build:app\"",
310
+
311
+ "test": "neex runx -s \"npm run test:unit\" \"npm run test:e2e\"",
312
+ "test:unit": "jest",
313
+ "test:e2e": "playwright test",
314
+
315
+ "lint": "eslint .",
316
+ "format": "prettier --write .",
317
+ "check-all": "neex p \"npm run lint\" \"npm run format -- --check\" \"npm run test\"",
318
+
319
+ "start:prod": "neex pm2 start dist/server.js --name my-prod-app",
320
+ "watch:build": "neex watch \"npm run build:app\" -w packages/main-app/src -e ts,tsx"
321
+ }
322
+ }
323
+ ```
324
+
325
+ **Running these scripts:**
145
326
 
146
327
  ```bash
147
- # Dev servers
148
- neex p "cd frontend && npm dev" "cd api && npm dev"
328
+ # Start all development servers with grouped output
329
+ npm run dev
330
+
331
+ # Build UI library and main application in parallel
332
+ npm run build
333
+
334
+ # Run linters, format check, and all tests in parallel
335
+ npm run check-all
149
336
 
150
- # Monorepo build
151
- neex p -m 2 "npm run build:ui" "npm run build:api"
337
+ # Start the production application using neex's pm2
338
+ npm run start:prod
152
339
 
153
- # Deploy pipeline
154
- neex s -s "npm test" "npm run build" "npm run deploy"
340
+ # Watch for changes in the main app's src and rebuild it
341
+ npm run watch:build
155
342
  ```
156
343
 
157
344
  ## 🤝 Contributing
package/dist/src/cli.js CHANGED
@@ -3,37 +3,48 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- // src/cli.ts - Updated version
6
+ // src/cli.ts - Main CLI file (refactored)
7
7
  const commander_1 = require("commander");
8
+ const index_js_1 = require("./commands/index.js");
8
9
  const chalk_1 = __importDefault(require("chalk"));
9
10
  const figures_1 = __importDefault(require("figures"));
10
- const project_manager_js_1 = require("./project-manager.js");
11
11
  const { version } = require('../../package.json');
12
12
  function cli() {
13
13
  const program = new commander_1.Command();
14
- let cleanupRunner = null;
14
+ // Initialize cleanup handlers
15
+ const cleanupHandlers = [];
15
16
  program
16
17
  .name('neex')
17
- .description('Professional TypeScript development tool with ultra-fast compilation')
18
+ .description('Professional script runner with nodemon and PM2 functionality')
18
19
  .version(version);
19
- // Register all commands
20
- new project_manager_js_1.ProjectManager(program);
20
+ // Add all command groups
21
+ (0, index_js_1.addRunCommands)(program);
22
+ (0, index_js_1.addServerCommands)(program);
23
+ const devCommands = (0, index_js_1.addDevCommands)(program);
24
+ cleanupHandlers.push(devCommands.cleanupDev);
25
+ const processCommands = (0, index_js_1.addProcessCommands)(program);
26
+ cleanupHandlers.push(processCommands.cleanupProcess);
21
27
  program.parse(process.argv);
22
28
  // Show help if no commands specified
23
29
  if (program.args.length === 0) {
24
30
  program.help();
25
31
  }
26
32
  // Graceful shutdown handling
27
- const handleSignal = (signal) => {
33
+ const handleSignal = async (signal) => {
28
34
  console.log(`\n${chalk_1.default.yellow(`${figures_1.default.warning} Received ${signal}. Cleaning up...`)}`);
29
- if (cleanupRunner) {
30
- cleanupRunner();
35
+ // Run all cleanup handlers
36
+ for (const cleanup of cleanupHandlers) {
37
+ try {
38
+ await cleanup();
39
+ }
40
+ catch (error) {
41
+ console.error(`Cleanup error:`, error);
42
+ }
31
43
  }
32
- // Give cleanup a moment, then exit
33
44
  setTimeout(() => process.exit(0), 500);
34
45
  };
35
- process.on('SIGINT', () => handleSignal('SIGINT')); // Ctrl+C
36
- process.on('SIGTERM', () => handleSignal('SIGTERM'));
37
- process.on('SIGQUIT', () => handleSignal('SIGQUIT'));
46
+ process.on('SIGINT', () => handleSignal('SIGINT').catch(err => console.error('SIGINT handler error:', err)));
47
+ process.on('SIGTERM', () => handleSignal('SIGTERM').catch(err => console.error('SIGTERM handler error:', err)));
48
+ process.on('SIGQUIT', () => handleSignal('SIGQUIT').catch(err => console.error('SIGQUIT handler error:', err)));
38
49
  }
39
50
  exports.default = cli;
@@ -0,0 +1,190 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.addDevCommands = void 0;
30
+ const dev_runner_js_1 = require("../dev-runner.js");
31
+ const chalk_1 = __importDefault(require("chalk"));
32
+ const figures_1 = __importDefault(require("figures"));
33
+ const path = __importStar(require("path"));
34
+ const fs = __importStar(require("fs/promises"));
35
+ // Helper function to find default command from package.json
36
+ async function findDefaultCommand() {
37
+ var _a, _b;
38
+ try {
39
+ const packageJsonPath = path.join(process.cwd(), 'package.json');
40
+ await fs.access(packageJsonPath);
41
+ const packageJsonContent = await fs.readFile(packageJsonPath, 'utf-8');
42
+ const packageJson = JSON.parse(packageJsonContent);
43
+ if ((_a = packageJson.scripts) === null || _a === void 0 ? void 0 : _a.dev) {
44
+ console.log(chalk_1.default.blue(`${figures_1.default.info} No command provided. Using "dev" script from package.json: npm run dev`));
45
+ return 'npm run dev';
46
+ }
47
+ if ((_b = packageJson.scripts) === null || _b === void 0 ? void 0 : _b.start) {
48
+ console.log(chalk_1.default.blue(`${figures_1.default.info} No command provided. Using "start" script from package.json: npm run start`));
49
+ return 'npm run start';
50
+ }
51
+ if (packageJson.main) {
52
+ const mainFile = packageJson.main;
53
+ const mainFilePath = path.resolve(process.cwd(), mainFile);
54
+ try {
55
+ await fs.access(mainFilePath);
56
+ if (mainFile.endsWith('.ts') || mainFile.endsWith('.mts') || mainFile.endsWith('.cts')) {
57
+ console.log(chalk_1.default.blue(`${figures_1.default.info} No command or script found. Using "main" field (TypeScript): npx ts-node ${mainFile}`));
58
+ return `npx ts-node ${mainFile}`;
59
+ }
60
+ else {
61
+ console.log(chalk_1.default.blue(`${figures_1.default.info} No command or script found. Using "main" field (JavaScript): node ${mainFile}`));
62
+ return `node ${mainFile}`;
63
+ }
64
+ }
65
+ catch (e) {
66
+ // Main file doesn't exist, do nothing, will fall through to return null
67
+ }
68
+ }
69
+ return null;
70
+ }
71
+ catch (error) {
72
+ // package.json doesn't exist or other error, do nothing
73
+ return null;
74
+ }
75
+ }
76
+ function addDevCommands(program) {
77
+ let devRunner = null;
78
+ // Dev command (Nodemon functionality - formerly watch)
79
+ program
80
+ .command('dev [commands...]') // Made commands optional
81
+ .alias('d')
82
+ .description('Run commands with file watching and auto-restart (nodemon functionality)')
83
+ .option('-c, --no-color', 'Disable colored output')
84
+ .option('-t, --no-timing', 'Hide timing information')
85
+ .option('-p, --no-prefix', 'Hide command prefix')
86
+ .option('-s, --stop-on-error', 'Stop on first error')
87
+ .option('-o, --no-output', 'Hide command output')
88
+ .option('-m, --minimal', 'Use minimal output format')
89
+ .option('-w, --watch <paths...>', 'Paths to watch (default: current directory)')
90
+ .option('-i, --ignore <patterns...>', 'Patterns to ignore')
91
+ .option('-e, --ext <extensions...>', 'File extensions to watch (default: js,mjs,json,ts,tsx,jsx)')
92
+ .option('-d, --delay <ms>', 'Delay before restart in milliseconds', parseInt)
93
+ .option('--clear', 'Clear console on restart')
94
+ .option('--verbose', 'Verbose output')
95
+ .option('--signal <signal>', 'Signal to send to processes on restart', 'SIGTERM')
96
+ .action(async (commands, options) => {
97
+ try {
98
+ let effectiveCommands = commands;
99
+ if (!effectiveCommands || effectiveCommands.length === 0) {
100
+ const foundCommand = await findDefaultCommand();
101
+ if (foundCommand) {
102
+ effectiveCommands = [foundCommand];
103
+ console.log(chalk_1.default.blue(`${figures_1.default.info} No command specified for 'neex dev', using default: "${foundCommand}"`));
104
+ }
105
+ else {
106
+ console.error(chalk_1.default.red(`${figures_1.default.cross} No command specified for 'neex dev' and no default script (dev, start) or main file found in package.json.`));
107
+ console.error(chalk_1.default.yellow(`${figures_1.default.pointer} Please specify a command to run (e.g., neex dev "npm run dev") or define a "dev" or "start" script in your package.json.`));
108
+ process.exit(1);
109
+ }
110
+ }
111
+ else { // At least one command/argument is provided
112
+ const firstArg = effectiveCommands[0];
113
+ const remainingArgs = effectiveCommands.slice(1);
114
+ const isLikelyCommandOrScript = firstArg.includes(' ') || firstArg.startsWith('npm') || firstArg.startsWith('yarn') || firstArg.startsWith('pnpm');
115
+ if (!isLikelyCommandOrScript) {
116
+ const filePath = path.resolve(process.cwd(), firstArg);
117
+ try {
118
+ await fs.access(filePath); // Check if file exists
119
+ let commandToExecute = '';
120
+ if (firstArg.endsWith('.js') || firstArg.endsWith('.mjs') || firstArg.endsWith('.cjs')) {
121
+ commandToExecute = `node ${firstArg}`;
122
+ console.log(chalk_1.default.blue(`${figures_1.default.info} Detected .js file, prepending with node.`));
123
+ }
124
+ else if (firstArg.endsWith('.ts') || firstArg.endsWith('.mts') || firstArg.endsWith('.cts')) {
125
+ commandToExecute = `npx ts-node ${firstArg}`;
126
+ console.log(chalk_1.default.blue(`${figures_1.default.info} Detected .ts file, prepending with npx ts-node.`));
127
+ }
128
+ if (commandToExecute) {
129
+ effectiveCommands = [commandToExecute, ...remainingArgs];
130
+ console.log(chalk_1.default.cyan(`${figures_1.default.pointer} Executing: ${effectiveCommands.join(' ')}`));
131
+ }
132
+ else {
133
+ console.log(chalk_1.default.yellow(`${figures_1.default.warning} First argument "${firstArg}" is not a recognized .js/.ts file and doesn't look like a script. Attempting to run as is.`));
134
+ }
135
+ }
136
+ catch (e) {
137
+ console.log(chalk_1.default.yellow(`${figures_1.default.warning} File "${firstArg}" not found. Attempting to run as command.`));
138
+ }
139
+ }
140
+ }
141
+ console.log(chalk_1.default.blue(`${figures_1.default.info} Starting development server with file watching (neex dev) for command(s): ${effectiveCommands.map(cmd => `"${cmd}"`).join(' && ')}...`));
142
+ const watchPaths = options.watch || ['./'];
143
+ const ignorePatterns = options.ignore || [
144
+ 'node_modules/**', '.git/**', '*.log', 'dist/**', 'build/**',
145
+ 'coverage/**', '.nyc_output/**', '*.tmp', '*.temp'
146
+ ];
147
+ const extensions = options.ext || ['js', 'mjs', 'json', 'ts', 'tsx', 'jsx'];
148
+ devRunner = new dev_runner_js_1.DevRunner({
149
+ runnerName: 'neex dev',
150
+ parallel: false,
151
+ color: options.color,
152
+ showTiming: options.timing,
153
+ prefix: options.prefix,
154
+ stopOnError: options.stopOnError,
155
+ printOutput: options.output,
156
+ minimalOutput: options.minimal,
157
+ watch: watchPaths,
158
+ ignore: ignorePatterns,
159
+ ext: extensions,
160
+ delay: options.delay || 1000,
161
+ clearConsole: options.clear,
162
+ verbose: options.verbose,
163
+ signal: options.signal,
164
+ restartOnChange: true,
165
+ groupOutput: false,
166
+ isServerMode: false
167
+ });
168
+ await devRunner.start(effectiveCommands);
169
+ }
170
+ catch (error) {
171
+ if (error instanceof Error) {
172
+ console.error(chalk_1.default.red(`${figures_1.default.cross} Dev Error: ${error.message}`));
173
+ }
174
+ else {
175
+ console.error(chalk_1.default.red(`${figures_1.default.cross} An unknown dev error occurred`));
176
+ }
177
+ process.exit(1);
178
+ }
179
+ });
180
+ // Return cleanup function for dev runner
181
+ return {
182
+ getDevRunner: () => devRunner,
183
+ cleanupDev: () => {
184
+ if (devRunner && devRunner.isActive()) {
185
+ devRunner.stop();
186
+ }
187
+ }
188
+ };
189
+ }
190
+ exports.addDevCommands = addDevCommands;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ // src/commands/index.ts - Export all commands
18
+ __exportStar(require("./run-commands.js"), exports);
19
+ __exportStar(require("./dev-commands.js"), exports);
20
+ __exportStar(require("./process-commands.js"), exports);
21
+ __exportStar(require("./server-commands.js"), exports);