@wwkit/harness 1.0.32 → 1.0.33
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/LICENSE +21 -21
- package/README.md +128 -128
- package/agents/scrum.md +186 -180
- package/agents/sprint.md +121 -118
- package/bin/index.js +226 -226
- package/commands/fix.md +87 -87
- package/commands/git-sync.md +217 -217
- package/commands/net-port.md +364 -364
- package/commands/pytest.md +10 -10
- package/commands/resume.md +104 -104
- package/commands/tl.md +11 -11
- package/package.json +3 -3
- package/plugin.js +19 -19
- package/readme/development.md +39 -39
- package/readme/publish.md +41 -41
- package/readme/testing.md +44 -44
- package/scripts/postinstall.js +58 -58
- package/skills/better-skill/SKILL.md +124 -124
- package/skills/blame-skill/SKILL.md +201 -201
- package/skills/extract/SKILL.md +119 -119
- package/skills/extract/references/build-xpath.js +30 -30
- package/skills/extract/references/clean-html.js +90 -90
- package/skills/extract/references/detail.md +54 -54
- package/skills/extract/references/detail.schema.json5 +48 -48
- package/skills/extract/references/extract-detail.js +71 -71
- package/skills/extract/references/extract-regex.js +81 -81
- package/skills/extract/references/extract-sample.js +48 -48
- package/skills/extract/references/list-rule-gen.md +109 -109
- package/skills/extract/references/list.md +134 -134
- package/skills/extract/references/list.schema.json5 +33 -33
- package/skills/extract/references/navi.md +44 -44
- package/skills/extract/references/navi.schema.json5 +23 -23
- package/skills/extract/references/text.md +40 -40
- package/skills/extract/references/text.schema.json5 +21 -21
- package/skills/extract/references/to-text.js +20 -20
- package/skills/extract/references/validate-schema.js +39 -39
- package/skills/jstest/SKILL.md +561 -561
- package/skills/jstest/references/case-create.md +327 -327
- package/skills/jstest/references/case-fix.md +273 -273
- package/skills/jstest/references/config.md +148 -148
- package/skills/jstest/references/coverage-analyze.md +247 -247
- package/skills/jstest/references/env-ensure.md +210 -210
- package/skills/jstest/references/execute.md +168 -168
- package/skills/jstest/references/sample.md +166 -166
- package/skills/jstest/references/scoring-rules.md +75 -75
- package/skills/jstest/references/src/jstest-sample/Calculator.js +80 -80
- package/skills/jstest/references/src/jstest-sample/ConfigManager.js +72 -72
- package/skills/jstest/references/src/jstest-sample/FileProcessor.js +57 -57
- package/skills/jstest/references/src/jstest-sample/OrderService.js +98 -98
- package/skills/jstest/references/src/jstest-sample/TokenGenerator.js +60 -60
- package/skills/jstest/references/src/jstest-sample/UserService.js +56 -56
- package/skills/jstest/references/src/jstest-sample/index.js +6 -6
- package/skills/jstest/references/suitability-check.md +232 -232
- package/skills/jstest/references/test-standards.md +288 -288
- package/skills/lint/SKILL.md +440 -440
- package/skills/lint/references/ai-fix.md +137 -137
- package/skills/lint/references/config-setup.md +102 -102
- package/skills/lint/references/config.md +65 -65
- package/skills/lint/references/detect-language.js +65 -65
- package/skills/lint/references/env-ensure.md +88 -88
- package/skills/lint/references/language-detect.md +75 -75
- package/skills/lint/references/languages/js.md +110 -110
- package/skills/lint/references/languages/py.md +89 -89
- package/skills/lint/references/rules-analyze.md +125 -125
- package/skills/lint/references/suitability-check.md +81 -81
- package/skills/lint/references/tool-fix.md +90 -90
- package/skills/new-skill/SKILL.md +227 -227
- package/skills/new-skill/references/template.md +53 -53
- package/skills/new-skill/references/workflow-patterns.md +104 -104
- package/skills/pytest/SKILL.md +555 -555
- package/skills/pytest/references/case-create.md +324 -324
- package/skills/pytest/references/case-fix.md +271 -271
- package/skills/pytest/references/config.md +145 -145
- package/skills/pytest/references/coverage-analyze.md +223 -223
- package/skills/pytest/references/env-ensure.md +195 -195
- package/skills/pytest/references/execute.md +152 -152
- package/skills/pytest/references/sample.md +159 -159
- package/skills/pytest/references/scoring-rules.md +57 -57
- package/skills/pytest/references/src/pytest-sample/Calculator.py +67 -67
- package/skills/pytest/references/src/pytest-sample/ConfigManager.py +68 -68
- package/skills/pytest/references/src/pytest-sample/FileProcessor.py +53 -53
- package/skills/pytest/references/src/pytest-sample/OrderService.py +82 -82
- package/skills/pytest/references/src/pytest-sample/TokenGenerator.py +50 -50
- package/skills/pytest/references/src/pytest-sample/UserService.py +45 -45
- package/skills/pytest/references/suitability-check.md +220 -220
- package/skills/pytest/references/test-standards.md +244 -244
- package/skills/query/SKILL.md +71 -71
- package/skills/read-docs/SKILL.md +134 -134
- package/skills/read-docs/references/opencode/agents/cases.md +206 -206
- package/skills/read-docs/references/opencode/agents/design-pattern.md +47 -47
- package/skills/read-docs/references/opencode/agents/detail.md +191 -191
- package/skills/read-docs/references/opencode/agents/examples.md +100 -100
- package/skills/read-docs/references/opencode/agents/index.md +309 -309
- package/skills/read-docs/references/opencode/agents/parallel-dispatch.md +149 -149
- package/skills/read-docs/references/opencode/agents/subagent-internals.md +217 -217
- package/skills/read-docs/references/opencode/agents/workflow.md +161 -161
- package/skills/read-docs/references/opencode/cli/commands/acp.md +31 -31
- package/skills/read-docs/references/opencode/cli/commands/agent.md +16 -16
- package/skills/read-docs/references/opencode/cli/commands/attach.md +20 -20
- package/skills/read-docs/references/opencode/cli/commands/mcp.md +37 -37
- package/skills/read-docs/references/opencode/cli/commands/others.md +48 -48
- package/skills/read-docs/references/opencode/cli/commands/plugin.md +12 -12
- package/skills/read-docs/references/opencode/cli/commands/provider.md +43 -43
- package/skills/read-docs/references/opencode/cli/commands/run.md +81 -81
- package/skills/read-docs/references/opencode/cli/commands/serve.md +84 -84
- package/skills/read-docs/references/opencode/cli/commands/session.md +37 -37
- package/skills/read-docs/references/opencode/cli/commands/web.md +14 -14
- package/skills/read-docs/references/opencode/cli/env.md +38 -38
- package/skills/read-docs/references/opencode/cli/index.md +18 -18
- package/skills/read-docs/references/opencode/cli/tui.md +35 -35
- package/skills/read-docs/references/opencode/commands/examples.md +42 -42
- package/skills/read-docs/references/opencode/commands/index.md +185 -185
- package/skills/read-docs/references/opencode/config/provider.md +151 -151
- package/skills/read-docs/references/opencode/formatter/index.md +70 -70
- package/skills/read-docs/references/opencode/guide/config.md +419 -419
- package/skills/read-docs/references/opencode/guide/formatters.md +70 -70
- package/skills/read-docs/references/opencode/guide/index.md +37 -37
- package/skills/read-docs/references/opencode/guide/providers.md +31 -31
- package/skills/read-docs/references/opencode/guide/rules.md +63 -63
- package/skills/read-docs/references/opencode/plugins/examples.md +75 -75
- package/skills/read-docs/references/opencode/plugins/index.md +188 -188
- package/skills/read-docs/references/opencode/reference/index.md +118 -118
- package/skills/read-docs/references/opencode/rule/index.md +77 -77
- package/skills/read-docs/references/opencode/skills/detail.md +113 -113
- package/skills/read-docs/references/opencode/skills/examples.md +141 -141
- package/skills/read-docs/references/opencode/skills/index.md +126 -126
- package/skills/read-docs/references/opencode/skills/workflow.md +146 -146
- package/skills/read-docs/references/opencode/tests/agent.md +9 -9
- package/skills/read-docs/references/opencode/tests/config.md +59 -59
- package/skills/read-docs/references/opencode/tests/file.md +11 -11
- package/skills/read-docs/references/opencode/tests/serve.md +17 -17
- package/skills/read-docs/references/opencode/tests/session.md +30 -30
- package/skills/read-docs/references/opencode/tests/web.md +16 -16
- package/skills/read-docs/references/opencode/tools/arguments.md +305 -305
- package/skills/read-docs/references/opencode/tools/context.md +17 -17
- package/skills/read-docs/references/opencode/tools/custom.md +110 -110
- package/skills/read-docs/references/opencode/tools/detail.md +104 -104
- package/skills/read-docs/references/opencode/tools/examples.md +71 -71
- package/skills/read-docs/references/opencode/tools/index.md +56 -56
- package/skills/read-docs/references/opencode/tools/lsp.md +25 -25
- package/skills/read-docs/references/opencode/tools/mcp.md +132 -132
- package/skills/read-docs/references/opencode/train/README.md +134 -134
- package/skills/read-docs/references/opencode/train/agent-basic.md +771 -771
- package/skills/read-docs/references/opencode/train/command-basic.md +667 -667
- package/skills/read-docs/references/opencode/train/config-basic.md +508 -508
- package/skills/read-docs/references/opencode/train/index.md +163 -163
- package/skills/read-docs/references/opencode/train/practice.md +872 -872
- package/skills/read-docs/references/opencode/train/skill-basic.md +607 -607
- package/skills/read-docs/references/opencode/tui/commands/config.md +31 -31
- package/skills/read-docs/references/opencode/tui/commands/editor.md +46 -46
- package/skills/read-docs/references/opencode/tui/commands/index.md +124 -124
- package/skills/read-docs/references/opencode/tui/commands/init.md +4 -4
- package/skills/read-docs/references/opencode/tui/index.md +26 -26
- package/skills/read-docs/references/superpowers/bootstrap.md +107 -107
- package/skills/read-docs/references/superpowers/comparison.md +77 -77
- package/skills/read-docs/references/superpowers/context.md +71 -71
- package/skills/read-docs/references/superpowers/index.md +58 -58
- package/skills/read-docs/references/superpowers/parallel.md +49 -49
- package/skills/read-docs/references/superpowers/sdd.md +183 -183
- package/skills/read-docs/references/superpowers/skills.md +68 -68
- package/skills/read-docs/references/superpowers/workflow.md +83 -83
- package/skills/revise/SKILL.md +121 -121
- package/skills/revise/references/article.md +36 -36
- package/skills/revise/references/article.schema.json5 +40 -40
- package/skills/revise/references/gallery.md +34 -34
- package/skills/revise/references/gallery.schema.json5 +40 -40
- package/skills/revise/references/question.md +32 -32
- package/skills/revise/references/question.schema.json5 +31 -31
- package/skills/revise/references/status.md +31 -31
- package/skills/revise/references/status.schema.json5 +27 -27
- package/skills/revise/references/validate-schema.js +39 -39
- package/src/config.js +29 -29
- package/src/config.json5 +19 -19
package/commands/net-port.md
CHANGED
|
@@ -1,364 +1,364 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Port management command - list, find (by port or process name), and kill processes by port
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
You are a port management assistant. Execute the following steps strictly.
|
|
6
|
-
|
|
7
|
-
## Command Usage
|
|
8
|
-
|
|
9
|
-
```
|
|
10
|
-
/port [action] [arguments]
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
**Actions**:
|
|
14
|
-
- `list` (default): List all listening ports
|
|
15
|
-
- `find <query>`: Find process by port number(s) or process name (fuzzy match, case-insensitive)
|
|
16
|
-
- `kill <port>`: Kill process using specific port(s)
|
|
17
|
-
- `cmds`: Show copy-ready commands for each OS (find/kill by port)
|
|
18
|
-
- `help`: Show command help and examples
|
|
19
|
-
|
|
20
|
-
---
|
|
21
|
-
|
|
22
|
-
## Step 1: Parse Command Arguments
|
|
23
|
-
|
|
24
|
-
### Argument Extraction Rule (IMPORTANT for LLM)
|
|
25
|
-
|
|
26
|
-
The user input follows the pattern: `/port [action] [arguments]`
|
|
27
|
-
|
|
28
|
-
**Extraction algorithm** (apply this mentally, NOT as shell script):
|
|
29
|
-
|
|
30
|
-
1. Split the user input after `/port` into tokens by whitespace
|
|
31
|
-
2. **First token** -> check against known actions: `list`, `find`, `kill`, `cmds`, `help`
|
|
32
|
-
- If it matches a known action -> `ACTION = that token`, remaining tokens = `QUERY`
|
|
33
|
-
- If it does NOT match (e.g. a number like `5173` or a name like `node`) -> `ACTION = find` (implicit find), this token and all remaining = `QUERY`
|
|
34
|
-
- If NO tokens at all -> `ACTION = list`, `QUERY = ""`
|
|
35
|
-
3. `QUERY` = all remaining tokens joined by space
|
|
36
|
-
|
|
37
|
-
### Query Type Detection (CRITICAL)
|
|
38
|
-
|
|
39
|
-
After extracting QUERY, determine its type to choose the correct find strategy:
|
|
40
|
-
|
|
41
|
-
**Check each token in QUERY**:
|
|
42
|
-
- If token is purely numeric (matches `^[0-9]+$`) -> **port number query**
|
|
43
|
-
- If token contains non-numeric characters -> **process name query** (fuzzy match)
|
|
44
|
-
- If comma-separated tokens are all numeric -> treat each as a port number
|
|
45
|
-
- Mixed: process each token by its own type
|
|
46
|
-
|
|
47
|
-
**Query Type Decision Table**:
|
|
48
|
-
|
|
49
|
-
| QUERY | Type | Strategy |
|
|
50
|
-
|---|---|---|
|
|
51
|
-
| `5173` | Port number | Find by exact port |
|
|
52
|
-
| `5173 5174` | Port numbers | Find by each exact port |
|
|
53
|
-
| `5173,8080` | Port numbers | Find by each exact port (split on comma) |
|
|
54
|
-
| `node` | Process name | Fuzzy match process name (case-insensitive) |
|
|
55
|
-
| `weq` | Process name | Fuzzy match process name (case-insensitive) |
|
|
56
|
-
| `vscode` | Process name | Fuzzy match process name (case-insensitive) |
|
|
57
|
-
| `python` | Process name | Fuzzy match process name (case-insensitive) |
|
|
58
|
-
| `WeLink` | Process name | Fuzzy match process name (case-insensitive) |
|
|
59
|
-
|
|
60
|
-
### Full Decision Table
|
|
61
|
-
|
|
62
|
-
| User Input | ACTION | QUERY | Type |
|
|
63
|
-
|---|---|---|---|
|
|
64
|
-
| `/port` | list | (empty) | - |
|
|
65
|
-
| `/port list` | list | (empty) | - |
|
|
66
|
-
| `/port help` | help | (empty) | - |
|
|
67
|
-
| `/port find 5173` | find | 5173 | port |
|
|
68
|
-
| `/port find 5173 5174` | find | 5173 5174 | port |
|
|
69
|
-
| `/port find 8080,3000` | find | 8080,3000 | port |
|
|
70
|
-
| `/port find node` | find | node | name |
|
|
71
|
-
| `/port find weq` | find | weq | name |
|
|
72
|
-
| `/port find vscode` | find | vscode | name |
|
|
73
|
-
| `/port find python` | find | python | name |
|
|
74
|
-
| `/port cmds` | cmds | (empty) | - |
|
|
75
|
-
| `/port kill 5173` | kill | 5173 | port |
|
|
76
|
-
| `/port kill 5173 5174` | kill | 5173 5174 | port |
|
|
77
|
-
| `/port 5173` | find | 5173 | port |
|
|
78
|
-
| `/port 5173 5174` | find | 5173 5174 | port |
|
|
79
|
-
| `/port node` | find | node | name |
|
|
80
|
-
| `/port 8080,3000` | find | 8080,3000 | port |
|
|
81
|
-
|
|
82
|
-
**Normalize QUERY before processing**: split on commas -> trim whitespace -> classify each token as port or name.
|
|
83
|
-
|
|
84
|
-
---
|
|
85
|
-
|
|
86
|
-
## Step 2: Execute Actions
|
|
87
|
-
|
|
88
|
-
### Action 1: List All Ports
|
|
89
|
-
|
|
90
|
-
**Strategy**: Get all listening ports with process names in one batch query, output as a simple table.
|
|
91
|
-
|
|
92
|
-
**Windows Implementation**:
|
|
93
|
-
1. Run `netstat -ano | grep "LISTENING"` to get port-PID pairs
|
|
94
|
-
2. Run `WMIC PROCESS GET ProcessId,Name /FORMAT:CSV` to get PID-Name mapping
|
|
95
|
-
3. Join and output as table
|
|
96
|
-
|
|
97
|
-
**Linux/macOS Implementation**:
|
|
98
|
-
1. Run `lsof -i -P | grep "LISTEN"` or `ss -tulnp | grep "LISTEN"`
|
|
99
|
-
2. Output as table
|
|
100
|
-
|
|
101
|
-
**Output Format** (simple table, NO extra detail):
|
|
102
|
-
```
|
|
103
|
-
Port Process PID
|
|
104
|
-
80 System 4
|
|
105
|
-
5173 node.exe 16044
|
|
106
|
-
5174 node.exe 30904
|
|
107
|
-
3300 weq.exe 33820
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
---
|
|
111
|
-
|
|
112
|
-
### Action 2: Find Process
|
|
113
|
-
|
|
114
|
-
**Strategy**: Two modes based on query type. Always output a simple table, never list all ports.
|
|
115
|
-
|
|
116
|
-
#### Mode A: Find by Port Number(s)
|
|
117
|
-
|
|
118
|
-
When QUERY contains only numeric tokens, find processes listening on those specific ports.
|
|
119
|
-
|
|
120
|
-
**For each port number**:
|
|
121
|
-
1. Look up PID from netstat for that port
|
|
122
|
-
2. Look up process name for that PID
|
|
123
|
-
3. Include in results table
|
|
124
|
-
|
|
125
|
-
**If no process found on a port**: show that port as "not found" in the table
|
|
126
|
-
|
|
127
|
-
**Output Format** (simple table with status):
|
|
128
|
-
```
|
|
129
|
-
Port Process PID Status
|
|
130
|
-
5173 node.exe 16044 LISTENING
|
|
131
|
-
5174 node.exe 30904 LISTENING
|
|
132
|
-
8080 - - NOT FOUND
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
**IMPORTANT**: Do NOT list all ports when find by port. Only show queried ports.
|
|
136
|
-
|
|
137
|
-
#### Mode B: Find by Process Name (Fuzzy Match)
|
|
138
|
-
|
|
139
|
-
When QUERY contains non-numeric tokens, search all listening processes whose name matches the query (case-insensitive substring match).
|
|
140
|
-
|
|
141
|
-
**Matching Rules**:
|
|
142
|
-
- Case-insensitive: `node` matches `node.exe`, `Node.js`, etc.
|
|
143
|
-
- Substring match: `weq` matches `weq.exe`, `vscode` matches `VSCode-huawei.exe`
|
|
144
|
-
- The `.exe` suffix on Windows is ignored for matching purposes
|
|
145
|
-
- Match against the process name WITHOUT the `.exe` suffix
|
|
146
|
-
|
|
147
|
-
**Windows Implementation**:
|
|
148
|
-
1. Get all listening ports with PIDs from `netstat -ano | grep "LISTENING"`
|
|
149
|
-
2. Get all process names from `WMIC PROCESS GET ProcessId,Name /FORMAT:CSV`
|
|
150
|
-
3. Filter processes whose name (lowercase, without .exe) contains the query (lowercase)
|
|
151
|
-
4. Output matching entries
|
|
152
|
-
|
|
153
|
-
**Linux/macOS Implementation**:
|
|
154
|
-
1. Run `lsof -i -P | grep "LISTEN"`
|
|
155
|
-
2. Filter by process name (case-insensitive substring match)
|
|
156
|
-
3. Output matching entries
|
|
157
|
-
|
|
158
|
-
**Output Format** (same simple table):
|
|
159
|
-
```
|
|
160
|
-
Port Process PID
|
|
161
|
-
3300 weq.exe 33820
|
|
162
|
-
55361 weq.exe 37848
|
|
163
|
-
58995 weq.exe 33820
|
|
164
|
-
61918 weq.exe 26484
|
|
165
|
-
```
|
|
166
|
-
|
|
167
|
-
**If no process matches**: output `[INFO] No process matching '<query>' found`
|
|
168
|
-
|
|
169
|
-
---
|
|
170
|
-
|
|
171
|
-
### Action 3: Kill Process by Port
|
|
172
|
-
|
|
173
|
-
**Input**: Port number(s) only (kill does NOT support process name query)
|
|
174
|
-
|
|
175
|
-
**Important**:
|
|
176
|
-
- Ask for confirmation before proceeding
|
|
177
|
-
- Show process details before killing
|
|
178
|
-
- Report success/failure for each port
|
|
179
|
-
|
|
180
|
-
**Windows Implementation**:
|
|
181
|
-
1. Find PID by port from netstat
|
|
182
|
-
2. Kill using `powershell -NoProfile -Command "Stop-Process -Id $PID -Force"`
|
|
183
|
-
- NOTE: Do NOT use `taskkill /F /PID` in Git Bash on Windows - the `/F` flag gets interpreted as a file path. Always use PowerShell `Stop-Process` instead.
|
|
184
|
-
|
|
185
|
-
**Linux/macOS Implementation**:
|
|
186
|
-
1. Find PID by port from lsof
|
|
187
|
-
2. Kill using `kill $PID`, then `kill -9 $PID` if still running
|
|
188
|
-
|
|
189
|
-
**Output Format**:
|
|
190
|
-
```
|
|
191
|
-
[WARN] Port 5173: About to kill process 'node.exe' (PID: 16044)
|
|
192
|
-
[WARN] Port 5174: About to kill process 'node.exe' (PID: 30904)
|
|
193
|
-
[SUCCESS] Port 5173: Process node.exe (PID: 16044) killed successfully
|
|
194
|
-
[SUCCESS] Port 5174: Process node.exe (PID: 30904) killed successfully
|
|
195
|
-
```
|
|
196
|
-
|
|
197
|
-
---
|
|
198
|
-
|
|
199
|
-
### Action 4: Show Copy-Ready Commands (`cmds`)
|
|
200
|
-
|
|
201
|
-
**Output the following code block as-is, no execution needed.** The user wants to copy-paste these commands to share with others. Port `5173` is used as the example.
|
|
202
|
-
|
|
203
|
-
Output exactly this content:
|
|
204
|
-
|
|
205
|
-
```
|
|
206
|
-
## List all listening ports
|
|
207
|
-
|
|
208
|
-
# Windows (CMD / PowerShell)
|
|
209
|
-
netstat -ano | findstr LISTENING
|
|
210
|
-
|
|
211
|
-
# Windows (PowerShell, with process names)
|
|
212
|
-
Get-NetTCPConnection -State Listen | Select-Object LocalPort, OwningProcess | Sort-Object LocalPort
|
|
213
|
-
|
|
214
|
-
# Linux
|
|
215
|
-
netstat -tulnp
|
|
216
|
-
# or (may not installed on CentOS/RHEL minimal)
|
|
217
|
-
ss -tulnp
|
|
218
|
-
lsof -i -P | grep LISTEN
|
|
219
|
-
|
|
220
|
-
# macOS
|
|
221
|
-
lsof -i -P | grep LISTEN
|
|
222
|
-
|
|
223
|
-
## Find process on port 5173
|
|
224
|
-
|
|
225
|
-
# Windows (CMD / PowerShell)
|
|
226
|
-
netstat -ano | findstr :5173
|
|
227
|
-
tasklist | findstr <PID>
|
|
228
|
-
|
|
229
|
-
# Windows (PowerShell, one-liner)
|
|
230
|
-
Get-NetTCPConnection -LocalPort 5173 | Select-Object LocalPort, OwningProcess
|
|
231
|
-
|
|
232
|
-
# Linux
|
|
233
|
-
netstat -tulnp | grep :5173
|
|
234
|
-
# or
|
|
235
|
-
lsof -i :5173
|
|
236
|
-
ss -tulnp | grep :5173
|
|
237
|
-
|
|
238
|
-
# macOS
|
|
239
|
-
lsof -i :5173
|
|
240
|
-
|
|
241
|
-
## Kill process on port 5173
|
|
242
|
-
|
|
243
|
-
# Windows (CMD / PowerShell - replace <PID> with actual PID)
|
|
244
|
-
taskkill /F /PID <PID>
|
|
245
|
-
|
|
246
|
-
# Windows (PowerShell)
|
|
247
|
-
Stop-Process -Id <PID> -Force
|
|
248
|
-
|
|
249
|
-
# Linux
|
|
250
|
-
kill <PID>
|
|
251
|
-
# force kill if needed
|
|
252
|
-
kill -9 <PID>
|
|
253
|
-
|
|
254
|
-
# macOS
|
|
255
|
-
kill <PID>
|
|
256
|
-
# force kill if needed
|
|
257
|
-
kill -9 <PID>
|
|
258
|
-
```
|
|
259
|
-
|
|
260
|
-
---
|
|
261
|
-
|
|
262
|
-
### Action 5: Show Help
|
|
263
|
-
|
|
264
|
-
```
|
|
265
|
-
USAGE:
|
|
266
|
-
/port [action] [arguments]
|
|
267
|
-
|
|
268
|
-
ACTIONS:
|
|
269
|
-
list List all listening ports (default)
|
|
270
|
-
find <port> Find process by port number(s)
|
|
271
|
-
find <name> Find process by name (fuzzy, case-insensitive)
|
|
272
|
-
kill <port> Kill process by port number(s)
|
|
273
|
-
cmds Show copy-ready commands for each OS
|
|
274
|
-
help Show this help
|
|
275
|
-
|
|
276
|
-
QUERY TYPES (for find):
|
|
277
|
-
Port number: 5173, 8080,3000, 5173 5174
|
|
278
|
-
Process name: node, weq, vscode, python, WeLink
|
|
279
|
-
|
|
280
|
-
EXAMPLES:
|
|
281
|
-
/port List all ports
|
|
282
|
-
/port find 5173 Find by port number
|
|
283
|
-
/port find 5173,5174 Find by multiple ports
|
|
284
|
-
/port find node Find all node processes
|
|
285
|
-
/port find weq Find all weq processes
|
|
286
|
-
/port find vscode Find all VSCode processes
|
|
287
|
-
/port find python Find all python processes
|
|
288
|
-
/port 5173 Shortcut: find by port
|
|
289
|
-
/port node Shortcut: find by name
|
|
290
|
-
/port kill 5173 Kill process on port 5173
|
|
291
|
-
/port kill 5173,5174 Kill processes on multiple ports
|
|
292
|
-
|
|
293
|
-
SYSTEM SUPPORT:
|
|
294
|
-
Windows: netstat + WMIC + PowerShell Stop-Process
|
|
295
|
-
Linux: netstat/ss + lsof + kill
|
|
296
|
-
macOS: lsof + kill
|
|
297
|
-
```
|
|
298
|
-
|
|
299
|
-
---
|
|
300
|
-
|
|
301
|
-
## Step 3: Cross-Platform Command Matrix
|
|
302
|
-
|
|
303
|
-
| Action | Windows | Linux | macOS |
|
|
304
|
-
|--------|---------|-------|-------|
|
|
305
|
-
| **List Ports** | `netstat -ano` + WMIC | `netstat -tuln` / `ss -tuln` | `lsof -i -P` |
|
|
306
|
-
| **Find by Port** | `netstat -ano` + WMIC | `lsof -i :port` | `lsof -i :port` |
|
|
307
|
-
| **Find by Name** | `netstat -ano` + WMIC (filter) | `lsof -i -P` (filter) | `lsof -i -P` (filter) |
|
|
308
|
-
| **Kill Process** | PowerShell `Stop-Process` | `kill PID` | `kill PID` |
|
|
309
|
-
| **Copy-Ready Commands** | `cmds` action | `cmds` action | `cmds` action |
|
|
310
|
-
|
|
311
|
-
---
|
|
312
|
-
|
|
313
|
-
## Step 4: Output Format Standards
|
|
314
|
-
|
|
315
|
-
### All find/list output: Simple table only
|
|
316
|
-
|
|
317
|
-
```
|
|
318
|
-
Port Process PID
|
|
319
|
-
5173 node.exe 16044
|
|
320
|
-
3300 weq.exe 33820
|
|
321
|
-
```
|
|
322
|
-
|
|
323
|
-
### Find by port with not-found entries
|
|
324
|
-
|
|
325
|
-
```
|
|
326
|
-
Port Process PID Status
|
|
327
|
-
5173 node.exe 16044 LISTENING
|
|
328
|
-
8080 - - NOT FOUND
|
|
329
|
-
```
|
|
330
|
-
|
|
331
|
-
### Kill output
|
|
332
|
-
|
|
333
|
-
```
|
|
334
|
-
[WARN] Port 5173: About to kill 'node.exe' (PID: 16044)
|
|
335
|
-
[SUCCESS] Port 5173: Process node.exe (PID: 16044) killed successfully
|
|
336
|
-
```
|
|
337
|
-
|
|
338
|
-
---
|
|
339
|
-
|
|
340
|
-
## Important Notes
|
|
341
|
-
|
|
342
|
-
### Windows Git Bash Caveat
|
|
343
|
-
|
|
344
|
-
- **Do NOT use `taskkill /F /PID`** in Git Bash on Windows. The `/F` flag is interpreted as a file path (e.g., `F:/`).
|
|
345
|
-
- **Always use** `powershell -NoProfile -Command "Stop-Process -Id $PID -Force"` instead.
|
|
346
|
-
|
|
347
|
-
### Find by Process Name
|
|
348
|
-
|
|
349
|
-
- Case-insensitive substring match against process name (without `.exe` suffix)
|
|
350
|
-
- Returns ALL listening ports whose process matches
|
|
351
|
-
- If no match found, output `[INFO] No process matching '<query>' found`
|
|
352
|
-
- Common use cases: `node`, `python`, `weq`, `vscode`, `java`
|
|
353
|
-
|
|
354
|
-
### Kill Action
|
|
355
|
-
|
|
356
|
-
- Kill only supports port number arguments, NOT process names
|
|
357
|
-
- This is intentional: killing by name could terminate too many processes
|
|
358
|
-
- Always ask for user confirmation before killing
|
|
359
|
-
|
|
360
|
-
### Output Simplicity
|
|
361
|
-
|
|
362
|
-
- **find** always outputs a simple table with columns: Port, Process, PID (and Status for port-not-found)
|
|
363
|
-
- **Never** list all ports when user asked to find a specific port or process
|
|
364
|
-
- **Never** output verbose PowerShell format lists
|
|
1
|
+
---
|
|
2
|
+
description: Port management command - list, find (by port or process name), and kill processes by port
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
You are a port management assistant. Execute the following steps strictly.
|
|
6
|
+
|
|
7
|
+
## Command Usage
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
/port [action] [arguments]
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
**Actions**:
|
|
14
|
+
- `list` (default): List all listening ports
|
|
15
|
+
- `find <query>`: Find process by port number(s) or process name (fuzzy match, case-insensitive)
|
|
16
|
+
- `kill <port>`: Kill process using specific port(s)
|
|
17
|
+
- `cmds`: Show copy-ready commands for each OS (find/kill by port)
|
|
18
|
+
- `help`: Show command help and examples
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Step 1: Parse Command Arguments
|
|
23
|
+
|
|
24
|
+
### Argument Extraction Rule (IMPORTANT for LLM)
|
|
25
|
+
|
|
26
|
+
The user input follows the pattern: `/port [action] [arguments]`
|
|
27
|
+
|
|
28
|
+
**Extraction algorithm** (apply this mentally, NOT as shell script):
|
|
29
|
+
|
|
30
|
+
1. Split the user input after `/port` into tokens by whitespace
|
|
31
|
+
2. **First token** -> check against known actions: `list`, `find`, `kill`, `cmds`, `help`
|
|
32
|
+
- If it matches a known action -> `ACTION = that token`, remaining tokens = `QUERY`
|
|
33
|
+
- If it does NOT match (e.g. a number like `5173` or a name like `node`) -> `ACTION = find` (implicit find), this token and all remaining = `QUERY`
|
|
34
|
+
- If NO tokens at all -> `ACTION = list`, `QUERY = ""`
|
|
35
|
+
3. `QUERY` = all remaining tokens joined by space
|
|
36
|
+
|
|
37
|
+
### Query Type Detection (CRITICAL)
|
|
38
|
+
|
|
39
|
+
After extracting QUERY, determine its type to choose the correct find strategy:
|
|
40
|
+
|
|
41
|
+
**Check each token in QUERY**:
|
|
42
|
+
- If token is purely numeric (matches `^[0-9]+$`) -> **port number query**
|
|
43
|
+
- If token contains non-numeric characters -> **process name query** (fuzzy match)
|
|
44
|
+
- If comma-separated tokens are all numeric -> treat each as a port number
|
|
45
|
+
- Mixed: process each token by its own type
|
|
46
|
+
|
|
47
|
+
**Query Type Decision Table**:
|
|
48
|
+
|
|
49
|
+
| QUERY | Type | Strategy |
|
|
50
|
+
|---|---|---|
|
|
51
|
+
| `5173` | Port number | Find by exact port |
|
|
52
|
+
| `5173 5174` | Port numbers | Find by each exact port |
|
|
53
|
+
| `5173,8080` | Port numbers | Find by each exact port (split on comma) |
|
|
54
|
+
| `node` | Process name | Fuzzy match process name (case-insensitive) |
|
|
55
|
+
| `weq` | Process name | Fuzzy match process name (case-insensitive) |
|
|
56
|
+
| `vscode` | Process name | Fuzzy match process name (case-insensitive) |
|
|
57
|
+
| `python` | Process name | Fuzzy match process name (case-insensitive) |
|
|
58
|
+
| `WeLink` | Process name | Fuzzy match process name (case-insensitive) |
|
|
59
|
+
|
|
60
|
+
### Full Decision Table
|
|
61
|
+
|
|
62
|
+
| User Input | ACTION | QUERY | Type |
|
|
63
|
+
|---|---|---|---|
|
|
64
|
+
| `/port` | list | (empty) | - |
|
|
65
|
+
| `/port list` | list | (empty) | - |
|
|
66
|
+
| `/port help` | help | (empty) | - |
|
|
67
|
+
| `/port find 5173` | find | 5173 | port |
|
|
68
|
+
| `/port find 5173 5174` | find | 5173 5174 | port |
|
|
69
|
+
| `/port find 8080,3000` | find | 8080,3000 | port |
|
|
70
|
+
| `/port find node` | find | node | name |
|
|
71
|
+
| `/port find weq` | find | weq | name |
|
|
72
|
+
| `/port find vscode` | find | vscode | name |
|
|
73
|
+
| `/port find python` | find | python | name |
|
|
74
|
+
| `/port cmds` | cmds | (empty) | - |
|
|
75
|
+
| `/port kill 5173` | kill | 5173 | port |
|
|
76
|
+
| `/port kill 5173 5174` | kill | 5173 5174 | port |
|
|
77
|
+
| `/port 5173` | find | 5173 | port |
|
|
78
|
+
| `/port 5173 5174` | find | 5173 5174 | port |
|
|
79
|
+
| `/port node` | find | node | name |
|
|
80
|
+
| `/port 8080,3000` | find | 8080,3000 | port |
|
|
81
|
+
|
|
82
|
+
**Normalize QUERY before processing**: split on commas -> trim whitespace -> classify each token as port or name.
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
## Step 2: Execute Actions
|
|
87
|
+
|
|
88
|
+
### Action 1: List All Ports
|
|
89
|
+
|
|
90
|
+
**Strategy**: Get all listening ports with process names in one batch query, output as a simple table.
|
|
91
|
+
|
|
92
|
+
**Windows Implementation**:
|
|
93
|
+
1. Run `netstat -ano | grep "LISTENING"` to get port-PID pairs
|
|
94
|
+
2. Run `WMIC PROCESS GET ProcessId,Name /FORMAT:CSV` to get PID-Name mapping
|
|
95
|
+
3. Join and output as table
|
|
96
|
+
|
|
97
|
+
**Linux/macOS Implementation**:
|
|
98
|
+
1. Run `lsof -i -P | grep "LISTEN"` or `ss -tulnp | grep "LISTEN"`
|
|
99
|
+
2. Output as table
|
|
100
|
+
|
|
101
|
+
**Output Format** (simple table, NO extra detail):
|
|
102
|
+
```
|
|
103
|
+
Port Process PID
|
|
104
|
+
80 System 4
|
|
105
|
+
5173 node.exe 16044
|
|
106
|
+
5174 node.exe 30904
|
|
107
|
+
3300 weq.exe 33820
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
### Action 2: Find Process
|
|
113
|
+
|
|
114
|
+
**Strategy**: Two modes based on query type. Always output a simple table, never list all ports.
|
|
115
|
+
|
|
116
|
+
#### Mode A: Find by Port Number(s)
|
|
117
|
+
|
|
118
|
+
When QUERY contains only numeric tokens, find processes listening on those specific ports.
|
|
119
|
+
|
|
120
|
+
**For each port number**:
|
|
121
|
+
1. Look up PID from netstat for that port
|
|
122
|
+
2. Look up process name for that PID
|
|
123
|
+
3. Include in results table
|
|
124
|
+
|
|
125
|
+
**If no process found on a port**: show that port as "not found" in the table
|
|
126
|
+
|
|
127
|
+
**Output Format** (simple table with status):
|
|
128
|
+
```
|
|
129
|
+
Port Process PID Status
|
|
130
|
+
5173 node.exe 16044 LISTENING
|
|
131
|
+
5174 node.exe 30904 LISTENING
|
|
132
|
+
8080 - - NOT FOUND
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
**IMPORTANT**: Do NOT list all ports when find by port. Only show queried ports.
|
|
136
|
+
|
|
137
|
+
#### Mode B: Find by Process Name (Fuzzy Match)
|
|
138
|
+
|
|
139
|
+
When QUERY contains non-numeric tokens, search all listening processes whose name matches the query (case-insensitive substring match).
|
|
140
|
+
|
|
141
|
+
**Matching Rules**:
|
|
142
|
+
- Case-insensitive: `node` matches `node.exe`, `Node.js`, etc.
|
|
143
|
+
- Substring match: `weq` matches `weq.exe`, `vscode` matches `VSCode-huawei.exe`
|
|
144
|
+
- The `.exe` suffix on Windows is ignored for matching purposes
|
|
145
|
+
- Match against the process name WITHOUT the `.exe` suffix
|
|
146
|
+
|
|
147
|
+
**Windows Implementation**:
|
|
148
|
+
1. Get all listening ports with PIDs from `netstat -ano | grep "LISTENING"`
|
|
149
|
+
2. Get all process names from `WMIC PROCESS GET ProcessId,Name /FORMAT:CSV`
|
|
150
|
+
3. Filter processes whose name (lowercase, without .exe) contains the query (lowercase)
|
|
151
|
+
4. Output matching entries
|
|
152
|
+
|
|
153
|
+
**Linux/macOS Implementation**:
|
|
154
|
+
1. Run `lsof -i -P | grep "LISTEN"`
|
|
155
|
+
2. Filter by process name (case-insensitive substring match)
|
|
156
|
+
3. Output matching entries
|
|
157
|
+
|
|
158
|
+
**Output Format** (same simple table):
|
|
159
|
+
```
|
|
160
|
+
Port Process PID
|
|
161
|
+
3300 weq.exe 33820
|
|
162
|
+
55361 weq.exe 37848
|
|
163
|
+
58995 weq.exe 33820
|
|
164
|
+
61918 weq.exe 26484
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
**If no process matches**: output `[INFO] No process matching '<query>' found`
|
|
168
|
+
|
|
169
|
+
---
|
|
170
|
+
|
|
171
|
+
### Action 3: Kill Process by Port
|
|
172
|
+
|
|
173
|
+
**Input**: Port number(s) only (kill does NOT support process name query)
|
|
174
|
+
|
|
175
|
+
**Important**:
|
|
176
|
+
- Ask for confirmation before proceeding
|
|
177
|
+
- Show process details before killing
|
|
178
|
+
- Report success/failure for each port
|
|
179
|
+
|
|
180
|
+
**Windows Implementation**:
|
|
181
|
+
1. Find PID by port from netstat
|
|
182
|
+
2. Kill using `powershell -NoProfile -Command "Stop-Process -Id $PID -Force"`
|
|
183
|
+
- NOTE: Do NOT use `taskkill /F /PID` in Git Bash on Windows - the `/F` flag gets interpreted as a file path. Always use PowerShell `Stop-Process` instead.
|
|
184
|
+
|
|
185
|
+
**Linux/macOS Implementation**:
|
|
186
|
+
1. Find PID by port from lsof
|
|
187
|
+
2. Kill using `kill $PID`, then `kill -9 $PID` if still running
|
|
188
|
+
|
|
189
|
+
**Output Format**:
|
|
190
|
+
```
|
|
191
|
+
[WARN] Port 5173: About to kill process 'node.exe' (PID: 16044)
|
|
192
|
+
[WARN] Port 5174: About to kill process 'node.exe' (PID: 30904)
|
|
193
|
+
[SUCCESS] Port 5173: Process node.exe (PID: 16044) killed successfully
|
|
194
|
+
[SUCCESS] Port 5174: Process node.exe (PID: 30904) killed successfully
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
---
|
|
198
|
+
|
|
199
|
+
### Action 4: Show Copy-Ready Commands (`cmds`)
|
|
200
|
+
|
|
201
|
+
**Output the following code block as-is, no execution needed.** The user wants to copy-paste these commands to share with others. Port `5173` is used as the example.
|
|
202
|
+
|
|
203
|
+
Output exactly this content:
|
|
204
|
+
|
|
205
|
+
```
|
|
206
|
+
## List all listening ports
|
|
207
|
+
|
|
208
|
+
# Windows (CMD / PowerShell)
|
|
209
|
+
netstat -ano | findstr LISTENING
|
|
210
|
+
|
|
211
|
+
# Windows (PowerShell, with process names)
|
|
212
|
+
Get-NetTCPConnection -State Listen | Select-Object LocalPort, OwningProcess | Sort-Object LocalPort
|
|
213
|
+
|
|
214
|
+
# Linux
|
|
215
|
+
netstat -tulnp
|
|
216
|
+
# or (may not installed on CentOS/RHEL minimal)
|
|
217
|
+
ss -tulnp
|
|
218
|
+
lsof -i -P | grep LISTEN
|
|
219
|
+
|
|
220
|
+
# macOS
|
|
221
|
+
lsof -i -P | grep LISTEN
|
|
222
|
+
|
|
223
|
+
## Find process on port 5173
|
|
224
|
+
|
|
225
|
+
# Windows (CMD / PowerShell)
|
|
226
|
+
netstat -ano | findstr :5173
|
|
227
|
+
tasklist | findstr <PID>
|
|
228
|
+
|
|
229
|
+
# Windows (PowerShell, one-liner)
|
|
230
|
+
Get-NetTCPConnection -LocalPort 5173 | Select-Object LocalPort, OwningProcess
|
|
231
|
+
|
|
232
|
+
# Linux
|
|
233
|
+
netstat -tulnp | grep :5173
|
|
234
|
+
# or
|
|
235
|
+
lsof -i :5173
|
|
236
|
+
ss -tulnp | grep :5173
|
|
237
|
+
|
|
238
|
+
# macOS
|
|
239
|
+
lsof -i :5173
|
|
240
|
+
|
|
241
|
+
## Kill process on port 5173
|
|
242
|
+
|
|
243
|
+
# Windows (CMD / PowerShell - replace <PID> with actual PID)
|
|
244
|
+
taskkill /F /PID <PID>
|
|
245
|
+
|
|
246
|
+
# Windows (PowerShell)
|
|
247
|
+
Stop-Process -Id <PID> -Force
|
|
248
|
+
|
|
249
|
+
# Linux
|
|
250
|
+
kill <PID>
|
|
251
|
+
# force kill if needed
|
|
252
|
+
kill -9 <PID>
|
|
253
|
+
|
|
254
|
+
# macOS
|
|
255
|
+
kill <PID>
|
|
256
|
+
# force kill if needed
|
|
257
|
+
kill -9 <PID>
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
---
|
|
261
|
+
|
|
262
|
+
### Action 5: Show Help
|
|
263
|
+
|
|
264
|
+
```
|
|
265
|
+
USAGE:
|
|
266
|
+
/port [action] [arguments]
|
|
267
|
+
|
|
268
|
+
ACTIONS:
|
|
269
|
+
list List all listening ports (default)
|
|
270
|
+
find <port> Find process by port number(s)
|
|
271
|
+
find <name> Find process by name (fuzzy, case-insensitive)
|
|
272
|
+
kill <port> Kill process by port number(s)
|
|
273
|
+
cmds Show copy-ready commands for each OS
|
|
274
|
+
help Show this help
|
|
275
|
+
|
|
276
|
+
QUERY TYPES (for find):
|
|
277
|
+
Port number: 5173, 8080,3000, 5173 5174
|
|
278
|
+
Process name: node, weq, vscode, python, WeLink
|
|
279
|
+
|
|
280
|
+
EXAMPLES:
|
|
281
|
+
/port List all ports
|
|
282
|
+
/port find 5173 Find by port number
|
|
283
|
+
/port find 5173,5174 Find by multiple ports
|
|
284
|
+
/port find node Find all node processes
|
|
285
|
+
/port find weq Find all weq processes
|
|
286
|
+
/port find vscode Find all VSCode processes
|
|
287
|
+
/port find python Find all python processes
|
|
288
|
+
/port 5173 Shortcut: find by port
|
|
289
|
+
/port node Shortcut: find by name
|
|
290
|
+
/port kill 5173 Kill process on port 5173
|
|
291
|
+
/port kill 5173,5174 Kill processes on multiple ports
|
|
292
|
+
|
|
293
|
+
SYSTEM SUPPORT:
|
|
294
|
+
Windows: netstat + WMIC + PowerShell Stop-Process
|
|
295
|
+
Linux: netstat/ss + lsof + kill
|
|
296
|
+
macOS: lsof + kill
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
---
|
|
300
|
+
|
|
301
|
+
## Step 3: Cross-Platform Command Matrix
|
|
302
|
+
|
|
303
|
+
| Action | Windows | Linux | macOS |
|
|
304
|
+
|--------|---------|-------|-------|
|
|
305
|
+
| **List Ports** | `netstat -ano` + WMIC | `netstat -tuln` / `ss -tuln` | `lsof -i -P` |
|
|
306
|
+
| **Find by Port** | `netstat -ano` + WMIC | `lsof -i :port` | `lsof -i :port` |
|
|
307
|
+
| **Find by Name** | `netstat -ano` + WMIC (filter) | `lsof -i -P` (filter) | `lsof -i -P` (filter) |
|
|
308
|
+
| **Kill Process** | PowerShell `Stop-Process` | `kill PID` | `kill PID` |
|
|
309
|
+
| **Copy-Ready Commands** | `cmds` action | `cmds` action | `cmds` action |
|
|
310
|
+
|
|
311
|
+
---
|
|
312
|
+
|
|
313
|
+
## Step 4: Output Format Standards
|
|
314
|
+
|
|
315
|
+
### All find/list output: Simple table only
|
|
316
|
+
|
|
317
|
+
```
|
|
318
|
+
Port Process PID
|
|
319
|
+
5173 node.exe 16044
|
|
320
|
+
3300 weq.exe 33820
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
### Find by port with not-found entries
|
|
324
|
+
|
|
325
|
+
```
|
|
326
|
+
Port Process PID Status
|
|
327
|
+
5173 node.exe 16044 LISTENING
|
|
328
|
+
8080 - - NOT FOUND
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
### Kill output
|
|
332
|
+
|
|
333
|
+
```
|
|
334
|
+
[WARN] Port 5173: About to kill 'node.exe' (PID: 16044)
|
|
335
|
+
[SUCCESS] Port 5173: Process node.exe (PID: 16044) killed successfully
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
---
|
|
339
|
+
|
|
340
|
+
## Important Notes
|
|
341
|
+
|
|
342
|
+
### Windows Git Bash Caveat
|
|
343
|
+
|
|
344
|
+
- **Do NOT use `taskkill /F /PID`** in Git Bash on Windows. The `/F` flag is interpreted as a file path (e.g., `F:/`).
|
|
345
|
+
- **Always use** `powershell -NoProfile -Command "Stop-Process -Id $PID -Force"` instead.
|
|
346
|
+
|
|
347
|
+
### Find by Process Name
|
|
348
|
+
|
|
349
|
+
- Case-insensitive substring match against process name (without `.exe` suffix)
|
|
350
|
+
- Returns ALL listening ports whose process matches
|
|
351
|
+
- If no match found, output `[INFO] No process matching '<query>' found`
|
|
352
|
+
- Common use cases: `node`, `python`, `weq`, `vscode`, `java`
|
|
353
|
+
|
|
354
|
+
### Kill Action
|
|
355
|
+
|
|
356
|
+
- Kill only supports port number arguments, NOT process names
|
|
357
|
+
- This is intentional: killing by name could terminate too many processes
|
|
358
|
+
- Always ask for user confirmation before killing
|
|
359
|
+
|
|
360
|
+
### Output Simplicity
|
|
361
|
+
|
|
362
|
+
- **find** always outputs a simple table with columns: Port, Process, PID (and Status for port-not-found)
|
|
363
|
+
- **Never** list all ports when user asked to find a specific port or process
|
|
364
|
+
- **Never** output verbose PowerShell format lists
|