portkeeper 1.0.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.
Files changed (72) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +190 -0
  3. package/dist/cli/commands/ai.d.ts +3 -0
  4. package/dist/cli/commands/ai.d.ts.map +1 -0
  5. package/dist/cli/commands/ai.js +248 -0
  6. package/dist/cli/commands/ai.js.map +1 -0
  7. package/dist/cli/commands/check.d.ts +3 -0
  8. package/dist/cli/commands/check.d.ts.map +1 -0
  9. package/dist/cli/commands/check.js +79 -0
  10. package/dist/cli/commands/check.js.map +1 -0
  11. package/dist/cli/commands/export.d.ts +3 -0
  12. package/dist/cli/commands/export.d.ts.map +1 -0
  13. package/dist/cli/commands/export.js +40 -0
  14. package/dist/cli/commands/export.js.map +1 -0
  15. package/dist/cli/commands/gui.d.ts +3 -0
  16. package/dist/cli/commands/gui.d.ts.map +1 -0
  17. package/dist/cli/commands/gui.js +45 -0
  18. package/dist/cli/commands/gui.js.map +1 -0
  19. package/dist/cli/commands/import.d.ts +3 -0
  20. package/dist/cli/commands/import.d.ts.map +1 -0
  21. package/dist/cli/commands/import.js +93 -0
  22. package/dist/cli/commands/import.js.map +1 -0
  23. package/dist/cli/commands/kill.d.ts +3 -0
  24. package/dist/cli/commands/kill.d.ts.map +1 -0
  25. package/dist/cli/commands/kill.js +70 -0
  26. package/dist/cli/commands/kill.js.map +1 -0
  27. package/dist/cli/commands/list.d.ts +3 -0
  28. package/dist/cli/commands/list.d.ts.map +1 -0
  29. package/dist/cli/commands/list.js +58 -0
  30. package/dist/cli/commands/list.js.map +1 -0
  31. package/dist/cli/commands/release.d.ts +3 -0
  32. package/dist/cli/commands/release.d.ts.map +1 -0
  33. package/dist/cli/commands/release.js +56 -0
  34. package/dist/cli/commands/release.js.map +1 -0
  35. package/dist/cli/commands/request.d.ts +3 -0
  36. package/dist/cli/commands/request.d.ts.map +1 -0
  37. package/dist/cli/commands/request.js +72 -0
  38. package/dist/cli/commands/request.js.map +1 -0
  39. package/dist/cli/commands/reserve.d.ts +3 -0
  40. package/dist/cli/commands/reserve.d.ts.map +1 -0
  41. package/dist/cli/commands/reserve.js +41 -0
  42. package/dist/cli/commands/reserve.js.map +1 -0
  43. package/dist/cli/commands/scan.d.ts +3 -0
  44. package/dist/cli/commands/scan.d.ts.map +1 -0
  45. package/dist/cli/commands/scan.js +52 -0
  46. package/dist/cli/commands/scan.js.map +1 -0
  47. package/dist/cli/index.d.ts +3 -0
  48. package/dist/cli/index.d.ts.map +1 -0
  49. package/dist/cli/index.js +40 -0
  50. package/dist/cli/index.js.map +1 -0
  51. package/dist/cli/utils/format.d.ts +3 -0
  52. package/dist/cli/utils/format.d.ts.map +1 -0
  53. package/dist/cli/utils/format.js +26 -0
  54. package/dist/cli/utils/format.js.map +1 -0
  55. package/dist/core/database/Database.d.ts +13 -0
  56. package/dist/core/database/Database.d.ts.map +1 -0
  57. package/dist/core/database/Database.js +62 -0
  58. package/dist/core/database/Database.js.map +1 -0
  59. package/dist/core/models/Port.d.ts +65 -0
  60. package/dist/core/models/Port.d.ts.map +1 -0
  61. package/dist/core/models/Port.js +29 -0
  62. package/dist/core/models/Port.js.map +1 -0
  63. package/dist/core/services/PortService.d.ts +21 -0
  64. package/dist/core/services/PortService.d.ts.map +1 -0
  65. package/dist/core/services/PortService.js +364 -0
  66. package/dist/core/services/PortService.js.map +1 -0
  67. package/dist/electron/main/index.js +809 -0
  68. package/dist/electron/preload/index.cjs +33 -0
  69. package/dist/electron/renderer/assets/index-CaFNPppU.js +62913 -0
  70. package/dist/electron/renderer/assets/index-vdfDsR7w.css +74 -0
  71. package/dist/electron/renderer/index.html +14 -0
  72. package/package.json +100 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Ahmad Zein
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,190 @@
1
+ # Port Manager 🚀
2
+
3
+ A comprehensive port management tool for developers that helps reserve, monitor, and manage local development ports through both CLI and GUI interfaces.
4
+
5
+ ## Features
6
+
7
+ ### CLI Features
8
+ - 🔍 **Check Port Status**: Quickly check if a port is reserved or in use
9
+ - 📌 **Reserve Ports**: Reserve ports for specific projects with tags and descriptions
10
+ - 📋 **List All Ports**: View all reserved ports with filtering options
11
+ - 🔓 **Release Ports**: Free up reserved ports (supports bulk operations)
12
+ - ⚡ **Kill Processes**: Terminate processes using specific ports
13
+ - 🔎 **Scan Active Ports**: Detect all ports currently in use
14
+ - 🎯 **Request Multiple Ports**: Automatically find and reserve multiple available ports
15
+ - 📤 **Export/Import**: Share port configurations with your team
16
+
17
+ ### GUI Features
18
+ - 📊 **Visual Dashboard**: See all reserved ports with rich details
19
+ - 🔍 **Enhanced Scan View**: View active ports with reservation information
20
+ - 🎯 **Quick Actions**: Reserve, release, and kill processes with one click
21
+ - 🔎 **Smart Search**: Search across ports, processes, projects, and descriptions
22
+ - 🎨 **Themes**: Dark and light mode support
23
+ - ⌨️ **Keyboard Shortcuts**: Complete keyboard navigation
24
+ - 💾 **Data Management**: Export/import port configurations
25
+ - 🔄 **Real-time Updates**: Live scanning and status updates
26
+
27
+ ## Installation
28
+
29
+ ### Via npm
30
+ ```bash
31
+ npm install -g portkeeper
32
+
33
+ # Verify installation
34
+ portman --version
35
+ ```
36
+
37
+ ### From Source
38
+ ```bash
39
+ # Clone the repository
40
+ git clone https://github.com/ahmadzein/portmanager.git
41
+ cd portmanager
42
+ npm install
43
+ npm run build
44
+ npm link
45
+ ```
46
+
47
+ ### Download GUI Binary
48
+ Electron binaries for the GUI application are available from the [releases page](https://github.com/ahmadzein/portmanager/releases).
49
+
50
+ ## Quick Start
51
+
52
+ ### CLI Usage
53
+
54
+ ```bash
55
+ # Check if a port is available
56
+ portman check 3000
57
+
58
+ # Reserve a port for your project
59
+ portman reserve 3000 --name "my-app" --desc "React dev server" --tags frontend react
60
+
61
+ # Request multiple ports automatically
62
+ portman request 5 --name "microservices" --sequential
63
+
64
+ # List all reserved ports
65
+ portman list
66
+
67
+ # Scan for active ports with reservation info
68
+ portman scan --reserved
69
+
70
+ # Release ports when done
71
+ portman release 3000 3001 3002
72
+
73
+ # Kill a process using a port
74
+ portman kill 8080
75
+
76
+ # Export your team's port configuration
77
+ portman export team-ports.json
78
+ ```
79
+
80
+ ### GUI Usage
81
+
82
+ ```bash
83
+ # Launch the GUI application
84
+ portman gui
85
+ ```
86
+
87
+ In the GUI:
88
+ - **Dashboard**: Manage all your reserved ports
89
+ - **Scan View**: See active ports with reservation details
90
+ - **Quick Actions**: Reserve, release, or kill processes with one click
91
+ - **Keyboard Shortcuts**: Press `?` to see all shortcuts
92
+
93
+ ## GUI Usage
94
+
95
+ Launch the GUI application:
96
+ ```bash
97
+ portman gui
98
+ ```
99
+
100
+ **Note**: The GUI feature requires the project to be built first. If you encounter native module errors:
101
+
102
+ For GUI (Electron):
103
+ ```bash
104
+ npm run build:gui
105
+ ./scripts/fix-native-modules.sh electron
106
+ ```
107
+
108
+ For CLI (Node.js):
109
+ ```bash
110
+ ./scripts/fix-native-modules.sh
111
+ ```
112
+
113
+ ## Documentation
114
+
115
+ - 📖 [CLI Command Reference](docs/CLI_COMMAND_REFERENCE.md) - Detailed CLI documentation with examples
116
+ - 🖥️ [GUI User Guide](docs/GUI_USER_GUIDE.md) - Complete GUI walkthrough
117
+ - 🏗️ [Technical Architecture](TECHNICAL_ARCHITECTURE.md) - System design and structure
118
+ - 📋 [Feature Parity Matrix](docs/FEATURE_PARITY_MATRIX.md) - CLI/GUI feature comparison
119
+
120
+ ## Development
121
+
122
+ ### Prerequisites
123
+ - Node.js >= 18.0.0
124
+ - npm or yarn
125
+ - SQLite3
126
+
127
+ ### Setup
128
+ ```bash
129
+ # Clone the repository
130
+ git clone https://github.com/ahmadzein/portmanager.git
131
+ cd portmanager
132
+
133
+ # Install dependencies
134
+ npm install
135
+
136
+ # Build the project
137
+ npm run build
138
+
139
+ # Run CLI in development
140
+ npm run dev:cli
141
+
142
+ # Run GUI in development
143
+ npm run dev:gui
144
+
145
+ # Run tests
146
+ npm test
147
+
148
+ # Link for global CLI usage
149
+ npm link
150
+ ```
151
+
152
+ ## Architecture
153
+
154
+ Port Manager follows a layered architecture with shared core functionality between CLI and GUI:
155
+
156
+ - **Core Layer**: Business logic, models, and services
157
+ - **Data Layer**: SQLite database for persistence
158
+ - **CLI Layer**: Commander.js based command-line interface
159
+ - **GUI Layer**: Electron + React desktop application
160
+
161
+ ## Contributing
162
+
163
+ We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details.
164
+
165
+ ### Development Workflow
166
+ 1. Fork the repository
167
+ 2. Create your feature branch (`git checkout -b feature/amazing-feature`)
168
+ 3. Commit your changes (`git commit -m 'Add amazing feature'`)
169
+ 4. Push to the branch (`git push origin feature/amazing-feature`)
170
+ 5. Open a Pull Request
171
+
172
+ ## License
173
+
174
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
175
+
176
+ ## Acknowledgments
177
+
178
+ - Built with ❤️ by developers, for developers
179
+ - Special thanks to all contributors
180
+ - Inspired by the need for better port management in modern development
181
+
182
+ ## Support
183
+
184
+ - 📧 Email: support@portmanager.dev
185
+ - 💬 Discord: [Join our community](https://discord.gg/portmanager)
186
+ - 🐛 Issues: [GitHub Issues](https://github.com/yourusername/portmanager/issues)
187
+
188
+ ---
189
+
190
+ **Port Manager** - Never worry about port conflicts again! 🎉
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare const aiCommand: Command;
3
+ //# sourceMappingURL=ai.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ai.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/ai.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,eAAO,MAAM,SAAS,SAyQlB,CAAC"}
@@ -0,0 +1,248 @@
1
+ import { Command } from 'commander';
2
+ import chalk from 'chalk';
3
+ export const aiCommand = new Command('ai')
4
+ .description('Display AI agent instructions and integration guide')
5
+ .option('--json', 'Output in JSON format')
6
+ .action((options) => {
7
+ if (options.json) {
8
+ const jsonOutput = {
9
+ name: 'Port Keeper',
10
+ version: '1.0.0',
11
+ description: 'A comprehensive tool for managing local development ports',
12
+ packageName: 'portkeeper',
13
+ cliCommand: 'portman',
14
+ capabilities: [
15
+ 'Check port status (free/reserved/in-use)',
16
+ 'Reserve ports for projects',
17
+ 'Release reserved ports',
18
+ 'List all managed ports',
19
+ 'Scan active system ports',
20
+ 'Kill processes on ports',
21
+ 'Request multiple available ports',
22
+ 'Export/Import configurations',
23
+ 'Launch GUI interface'
24
+ ],
25
+ commands: {
26
+ check: {
27
+ syntax: 'portman check <port> [--json]',
28
+ description: 'Check if a port is free, reserved, or in use',
29
+ examples: ['portman check 3000', 'portman check 3000 --json'],
30
+ jsonResponse: {
31
+ port: 'number',
32
+ status: 'free | reserved | in-use',
33
+ projectName: 'string (if reserved)',
34
+ pid: 'number (if in-use)',
35
+ processName: 'string (if in-use)'
36
+ }
37
+ },
38
+ reserve: {
39
+ syntax: 'portman reserve <port> -n <name> [options]',
40
+ description: 'Reserve a port for a project',
41
+ options: {
42
+ '--name, -n': 'Project name (required)',
43
+ '--description, -d': 'Port description',
44
+ '--tags, -t': 'Comma-separated tags',
45
+ '--auto-release, -a': 'Auto-release when process exits',
46
+ '--json': 'Output as JSON'
47
+ },
48
+ examples: [
49
+ 'portman reserve 3000 -n "my-api"',
50
+ 'portman reserve 3000 -n "my-api" -d "API server" -t "backend,prod"'
51
+ ]
52
+ },
53
+ release: {
54
+ syntax: 'portman release <ports...> [--json]',
55
+ description: 'Release one or more reserved ports',
56
+ examples: ['portman release 3000', 'portman release 3000 3001 3002']
57
+ },
58
+ list: {
59
+ syntax: 'portman list [options]',
60
+ description: 'List all reserved and in-use ports',
61
+ options: {
62
+ '--status, -s': 'Filter by status (reserved/in-use)',
63
+ '--project, -p': 'Filter by project name',
64
+ '--tags, -t': 'Filter by tags',
65
+ '--json': 'Output as JSON array'
66
+ }
67
+ },
68
+ scan: {
69
+ syntax: 'portman scan [--json]',
70
+ description: 'Scan for all active ports on the system',
71
+ notes: 'Shows process information and reservation details'
72
+ },
73
+ kill: {
74
+ syntax: 'portman kill <ports...> [options]',
75
+ description: 'Kill process using specified port(s)',
76
+ options: {
77
+ '--force, -f': 'Skip confirmation prompt',
78
+ '--json': 'Output as JSON'
79
+ }
80
+ },
81
+ request: {
82
+ syntax: 'portman request <count> -n <name> [options]',
83
+ description: 'Request and reserve multiple available ports',
84
+ options: {
85
+ '--name, -n': 'Project name (required)',
86
+ '--description, -d': 'Description for ports',
87
+ '--tags, -t': 'Comma-separated tags',
88
+ '--sequential, -s': 'Find sequential ports (default)',
89
+ '--random, -r': 'Find random ports',
90
+ '--start': 'Start port for search (default: 3000)',
91
+ '--end': 'End port for search (default: 9999)',
92
+ '--avoid': 'Comma-separated ports to avoid',
93
+ '--json': 'Output as JSON'
94
+ }
95
+ },
96
+ export: {
97
+ syntax: 'portman export [options]',
98
+ description: 'Export port configuration to JSON',
99
+ options: {
100
+ '--output, -o': 'Output to file instead of stdout',
101
+ '--pretty, -p': 'Pretty print JSON'
102
+ }
103
+ },
104
+ import: {
105
+ syntax: 'portman import [file] [options]',
106
+ description: 'Import port configuration from JSON',
107
+ options: {
108
+ '--force, -f': 'Skip conflicts',
109
+ '--json': 'Output results as JSON'
110
+ }
111
+ },
112
+ gui: {
113
+ syntax: 'portman gui',
114
+ description: 'Launch the Port Manager desktop application'
115
+ }
116
+ },
117
+ workflow: {
118
+ description: 'IMPORTANT: Always follow this workflow when using ports',
119
+ steps: [
120
+ '1. Check port availability with "portman check <port>"',
121
+ '2. Reserve the port with "portman reserve <port> -n <project>"',
122
+ '3. Use the reserved port in your application',
123
+ '4. Release the port with "portman release <port>" when done'
124
+ ],
125
+ critical: 'NEVER use a port without reserving it first!'
126
+ },
127
+ automation: {
128
+ jsonSupport: 'All commands support --json flag for machine-readable output',
129
+ exitCodes: {
130
+ 0: 'Success',
131
+ 1: 'General error',
132
+ 2: 'Port not found',
133
+ 3: 'Port already in use',
134
+ 4: 'Port already reserved',
135
+ 5: 'Permission denied'
136
+ },
137
+ integration: {
138
+ bash: 'Use with jq for JSON parsing',
139
+ python: 'subprocess.run() with json.loads()',
140
+ nodejs: 'child_process.exec() with JSON.parse()',
141
+ docker: 'Dynamic port allocation in containers',
142
+ cicd: 'GitHub Actions, Jenkins, GitLab CI'
143
+ }
144
+ },
145
+ bestPractices: [
146
+ 'ALWAYS reserve ports before using them in your application',
147
+ 'Check port status before attempting to reserve',
148
+ 'Always use --json flag for automation',
149
+ 'Check exit codes for error handling',
150
+ 'Use descriptive project names',
151
+ 'Tag ports for better organization',
152
+ 'Release ports when done',
153
+ 'Use request command for multiple ports',
154
+ 'Export configurations for team sharing',
155
+ 'Never use a port without reserving it first'
156
+ ]
157
+ };
158
+ console.log(JSON.stringify(jsonOutput, null, 2));
159
+ return;
160
+ }
161
+ console.log(chalk.blue.bold('\n🤖 Port Manager - AI Agent Integration Guide\n'));
162
+ console.log(chalk.yellow('PURPOSE:'));
163
+ console.log('Port Manager helps manage local development ports to prevent conflicts');
164
+ console.log('and enable team collaboration through port reservation and tracking.\n');
165
+ console.log(chalk.yellow('KEY CAPABILITIES:'));
166
+ console.log('• Check port availability and status');
167
+ console.log('• Reserve ports for specific projects');
168
+ console.log('• Detect and display active ports with process info');
169
+ console.log('• Kill processes occupying ports');
170
+ console.log('• Request multiple available ports automatically');
171
+ console.log('• Export/import port configurations');
172
+ console.log('• JSON output for all commands (add --json flag)\n');
173
+ console.log(chalk.yellow('COMMAND OVERVIEW:'));
174
+ console.log(chalk.cyan('Check port status:'));
175
+ console.log(' portman check <port> [--json]');
176
+ console.log(' Example: portman check 3000 --json\n');
177
+ console.log(chalk.cyan('Reserve a port:'));
178
+ console.log(' portman reserve <port> -n <project> [-d <desc>] [-t <tags>] [--json]');
179
+ console.log(' Example: portman reserve 3000 -n "my-api" -d "API server"\n');
180
+ console.log(chalk.cyan('Release ports:'));
181
+ console.log(' portman release <port1> [port2...] [--json]');
182
+ console.log(' Example: portman release 3000 3001\n');
183
+ console.log(chalk.cyan('List managed ports:'));
184
+ console.log(' portman list [-s <status>] [-p <project>] [--json]');
185
+ console.log(' Example: portman list -s reserved --json\n');
186
+ console.log(chalk.cyan('Scan active ports:'));
187
+ console.log(' portman scan [--json]');
188
+ console.log(' Shows all listening ports with process details\n');
189
+ console.log(chalk.cyan('Request multiple ports:'));
190
+ console.log(' portman request <count> -n <project> [--sequential|--random] [--json]');
191
+ console.log(' Example: portman request 3 -n "microservices" --json\n');
192
+ console.log(chalk.yellow('PROPER WORKFLOW:'));
193
+ console.log('1. Check if port is available');
194
+ console.log('2. Reserve the port for your project');
195
+ console.log('3. Start your application on the reserved port');
196
+ console.log('4. Release the port when done\n');
197
+ console.log(chalk.yellow('AUTOMATION EXAMPLES:'));
198
+ console.log(chalk.cyan('Correct workflow in Bash:'));
199
+ console.log(` # 1. Check port status
200
+ STATUS=$(portman check 3000 --json | jq -r '.status')
201
+
202
+ # 2. Reserve if free
203
+ if [ "$STATUS" = "free" ]; then
204
+ portman reserve 3000 -n "my-app" --json
205
+
206
+ # 3. Start your app
207
+ npm start -- --port 3000
208
+
209
+ # 4. Release when done (in cleanup/trap)
210
+ portman release 3000
211
+ else
212
+ echo "Port 3000 is not available"
213
+ exit 1
214
+ fi\n`);
215
+ console.log(chalk.cyan('Python integration:'));
216
+ console.log(` import subprocess, json
217
+ result = subprocess.run(['portman', 'check', '3000', '--json'],
218
+ capture_output=True, text=True)
219
+ data = json.loads(result.stdout)
220
+ print(f"Port 3000 is {data['status']}")\n`);
221
+ console.log(chalk.cyan('Node.js integration:'));
222
+ console.log(` const { exec } = require('child_process');
223
+ exec('portman check 3000 --json', (err, stdout) => {
224
+ const data = JSON.parse(stdout);
225
+ console.log(\`Port 3000 is \${data.status}\`);
226
+ });\n`);
227
+ console.log(chalk.yellow('JSON RESPONSE STRUCTURES:'));
228
+ console.log(chalk.cyan('Check response:'));
229
+ console.log(' {"port": 3000, "status": "free|reserved|in-use", ...}\n');
230
+ console.log(chalk.cyan('List response:'));
231
+ console.log(' [{"number": 3000, "projectName": "my-api", "status": "reserved", ...}]\n');
232
+ console.log(chalk.cyan('Request response:'));
233
+ console.log(' {"ports": [{"number": 3000, ...}], "summary": "..."}\n');
234
+ console.log(chalk.yellow('BEST PRACTICES:'));
235
+ console.log('• Always use --json flag for parsing');
236
+ console.log('• ALWAYS reserve ports before using them');
237
+ console.log('• Check port status before reserving');
238
+ console.log('• Check exit codes (0=success, non-zero=error)');
239
+ console.log('• Use descriptive project names');
240
+ console.log('• Release ports when done');
241
+ console.log('• Handle errors gracefully\n');
242
+ console.log(chalk.red('IMPORTANT:'));
243
+ console.log('Always reserve a port before using it in your application!');
244
+ console.log('This prevents conflicts and enables team collaboration.\n');
245
+ console.log(chalk.green('For full documentation: https://portkeeper.net'));
246
+ console.log(chalk.green('For detailed AI guide: Use "portman ai --json" for complete schema\n'));
247
+ });
248
+ //# sourceMappingURL=ai.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ai.js","sourceRoot":"","sources":["../../../src/cli/commands/ai.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,CAAC,MAAM,SAAS,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;KACvC,WAAW,CAAC,qDAAqD,CAAC;KAClE,MAAM,CAAC,QAAQ,EAAE,uBAAuB,CAAC;KACzC,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE;IAClB,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;QACjB,MAAM,UAAU,GAAG;YACjB,IAAI,EAAE,aAAa;YACnB,OAAO,EAAE,OAAO;YAChB,WAAW,EAAE,2DAA2D;YACxE,WAAW,EAAE,YAAY;YACzB,UAAU,EAAE,SAAS;YACrB,YAAY,EAAE;gBACZ,0CAA0C;gBAC1C,4BAA4B;gBAC5B,wBAAwB;gBACxB,wBAAwB;gBACxB,0BAA0B;gBAC1B,yBAAyB;gBACzB,kCAAkC;gBAClC,8BAA8B;gBAC9B,sBAAsB;aACvB;YACD,QAAQ,EAAE;gBACR,KAAK,EAAE;oBACL,MAAM,EAAE,+BAA+B;oBACvC,WAAW,EAAE,8CAA8C;oBAC3D,QAAQ,EAAE,CAAC,oBAAoB,EAAE,2BAA2B,CAAC;oBAC7D,YAAY,EAAE;wBACZ,IAAI,EAAE,QAAQ;wBACd,MAAM,EAAE,0BAA0B;wBAClC,WAAW,EAAE,sBAAsB;wBACnC,GAAG,EAAE,oBAAoB;wBACzB,WAAW,EAAE,oBAAoB;qBAClC;iBACF;gBACD,OAAO,EAAE;oBACP,MAAM,EAAE,4CAA4C;oBACpD,WAAW,EAAE,8BAA8B;oBAC3C,OAAO,EAAE;wBACP,YAAY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AC;IACrC,OAAO,CAAC,GAAG,CAAC,4DAA4D,CAAC,CAAC;IAC1E,OAAO,CAAC,GAAG,CAAC,2DAA2D,CAAC,CAAC;IAEzE,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,gDAAgD,CAAC,CAAC,CAAC;IAC3E,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,sEAAsE,CAAC,CAAC,CAAC;AACnG,CAAC,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare const checkCommand: Command;
3
+ //# sourceMappingURL=check.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"check.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/check.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC,eAAO,MAAM,YAAY,SA2ErB,CAAC"}
@@ -0,0 +1,79 @@
1
+ import { Command } from 'commander';
2
+ import chalk from 'chalk';
3
+ import { PortService } from '../../core/services/PortService.js';
4
+ import { formatError } from '../utils/format.js';
5
+ export const checkCommand = new Command('check')
6
+ .description('Check if a port is reserved or in use')
7
+ .argument('<port>', 'Port number to check')
8
+ .option('--json', 'Output as JSON')
9
+ .action(async (portStr, options) => {
10
+ try {
11
+ const port = parseInt(portStr, 10);
12
+ const service = new PortService();
13
+ const status = await service.checkPort(port);
14
+ if (options.json) {
15
+ const result = {
16
+ port,
17
+ status,
18
+ };
19
+ if (status === 'reserved') {
20
+ const ports = await service.listPorts({ status: 'reserved' });
21
+ const reservedPort = ports.find(p => p.number === port);
22
+ if (reservedPort) {
23
+ result.projectName = reservedPort.projectName;
24
+ result.description = reservedPort.description;
25
+ result.reservedAt = reservedPort.reservedAt;
26
+ }
27
+ }
28
+ else if (status === 'in-use') {
29
+ try {
30
+ const activePorts = await service.scanActivePorts();
31
+ const activePort = activePorts.find(p => p.number === port);
32
+ if (activePort) {
33
+ result.pid = activePort.pid;
34
+ result.processName = activePort.processName;
35
+ }
36
+ }
37
+ catch {
38
+ }
39
+ }
40
+ console.log(JSON.stringify(result, null, 2));
41
+ return;
42
+ }
43
+ switch (status) {
44
+ case 'free':
45
+ console.log(chalk.green(`✓ Port ${port} is free`));
46
+ break;
47
+ case 'reserved':
48
+ const ports = await service.listPorts({ status: 'reserved' });
49
+ const reservedPort = ports.find(p => p.number === port);
50
+ if (reservedPort) {
51
+ console.log(chalk.yellow(`⚠ Port ${port} is reserved for "${reservedPort.projectName}"`));
52
+ if (reservedPort.description) {
53
+ console.log(chalk.gray(` Description: ${reservedPort.description}`));
54
+ }
55
+ }
56
+ break;
57
+ case 'in-use':
58
+ console.log(chalk.red(`✗ Port ${port} is in use`));
59
+ try {
60
+ const activePorts = await service.scanActivePorts();
61
+ const activePort = activePorts.find(p => p.number === port);
62
+ if (activePort) {
63
+ console.log(chalk.gray(` PID: ${activePort.pid}`));
64
+ if (activePort.processName) {
65
+ console.log(chalk.gray(` Process: ${activePort.processName}`));
66
+ }
67
+ }
68
+ }
69
+ catch {
70
+ }
71
+ break;
72
+ }
73
+ }
74
+ catch (error) {
75
+ console.error(formatError(error));
76
+ process.exit(1);
77
+ }
78
+ });
79
+ //# sourceMappingURL=check.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"check.js","sourceRoot":"","sources":["../../../src/cli/commands/check.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,OAAO,CAAC,OAAO,CAAC;KAC7C,WAAW,CAAC,uCAAuC,CAAC;KACpD,QAAQ,CAAC,QAAQ,EAAE,sBAAsB,CAAC;KAC1C,MAAM,CAAC,QAAQ,EAAE,gBAAgB,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5D,IAAI,UAAU,EAAE,CAAC;wBACf,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,UAAU,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;wBACpD,IAAI,UAAU,CAAC,WAAW,EAAE,CAAC;4BAC3B,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,cAAc,UAAU,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC;wBAClE,CAAC;oBACH,CAAC;gBACH,CAAC;gBAAC,MAAM,CAAC;gBAET,CAAC;gBACD,MAAM;QACV,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC;QAClC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare const exportCommand: Command;
3
+ //# sourceMappingURL=export.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"export.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/export.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,eAAO,MAAM,aAAa,SAqCtB,CAAC"}
@@ -0,0 +1,40 @@
1
+ import { Command } from 'commander';
2
+ import { PortService } from '../../core/services/PortService.js';
3
+ import { formatError } from '../utils/format.js';
4
+ export const exportCommand = new Command('export')
5
+ .description('Export port configuration to JSON')
6
+ .option('-o, --output <file>', 'Output file (default: stdout)')
7
+ .option('--pretty', 'Pretty print JSON output')
8
+ .action(async (options) => {
9
+ try {
10
+ const service = new PortService();
11
+ const ports = await service.listPorts();
12
+ const exportData = {
13
+ version: '1.0.0',
14
+ exportDate: new Date().toISOString(),
15
+ ports: ports.map(port => ({
16
+ number: port.number,
17
+ projectName: port.projectName,
18
+ description: port.description,
19
+ tags: port.tags,
20
+ reservedAt: port.reservedAt,
21
+ })),
22
+ };
23
+ const jsonOutput = options.pretty
24
+ ? JSON.stringify(exportData, null, 2)
25
+ : JSON.stringify(exportData);
26
+ if (options.output) {
27
+ const fs = await import('fs/promises');
28
+ await fs.writeFile(options.output, jsonOutput, 'utf-8');
29
+ console.log(`✓ Exported ${ports.length} ports to ${options.output}`);
30
+ }
31
+ else {
32
+ console.log(jsonOutput);
33
+ }
34
+ }
35
+ catch (error) {
36
+ console.error(formatError(error));
37
+ process.exit(1);
38
+ }
39
+ });
40
+ //# sourceMappingURL=export.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"export.js","sourceRoot":"","sources":["../../../src/cli/commands/export.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,OAAO,CAAC,QAAQ,CAAC;KAC/C,WAAW,CAAC,mCAAmC,CAAC;KAChD,MAAM,CAAC,qBAAqB,EAAE,+BAA+B,CAAC;KAC9D,MAAM,CAAC,UAAU,EAAE,0BAA0B,CAAC;KAC9C,MAAM,CAAC,KAAK,EAAE,OAAY,EAAE,EAAE;IAC7B,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC;QAClC,MAAM,KAAK,GAAG,MAAM,OAAO,CAAC,SAAS,EAAE,CAAC;QAGxC,MAAM,UAAU,GAAG;YACjB,OAAO,EAAE,OAAO;YAChB,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACpC,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;gBACxB,MAAM,EAAE,IAAI,CAAC,MAAM;gBACnB,WAAW,EAAE,IAAI,CAAC,WAAW;gBAC7B,WAAW,EAAE,IAAI,CAAC,WAAW;gBAC7B,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,UAAU,EAAE,IAAI,CAAC,UAAU;aAC5B,CAAC,CAAC;SACJ,CAAC;QAEF,MAAM,UAAU,GAAG,OAAO,CAAC,MAAM;YAC/B,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;YACrC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;QAE/B,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;YACnB,MAAM,EAAE,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC,CAAC;YACvC,MAAM,EAAE,CAAC,SAAS,CAAC,OAAO,CAAC,MAAM,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;YACxD,OAAO,CAAC,GAAG,CAAC,cAAc,KAAK,CAAC,MAAM,aAAa,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;QACvE,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;QAC1B,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC;QAClC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare const guiCommand: Command;
3
+ //# sourceMappingURL=gui.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gui.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/gui.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAUpC,eAAO,MAAM,UAAU,SA+CnB,CAAC"}