@ordis_co_th/execute-powershell 1.0.1 → 1.0.3
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 +61 -9
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -12,25 +12,24 @@ bun install @ordis_co_th/execute-powershell
|
|
|
12
12
|
|
|
13
13
|
### Register in `opencode.json`
|
|
14
14
|
|
|
15
|
-
Add the plugin to your OpenCode configuration:
|
|
15
|
+
Add the plugin to your OpenCode configuration. OpenCode expects the `plugin` key (singular) with a string array:
|
|
16
16
|
|
|
17
17
|
```json
|
|
18
18
|
{
|
|
19
19
|
"plugin": [
|
|
20
|
-
"@ordis_co_th/execute-powershell@1.0.
|
|
20
|
+
"@ordis_co_th/execute-powershell@1.0.3"
|
|
21
21
|
]
|
|
22
22
|
}
|
|
23
23
|
```
|
|
24
24
|
|
|
25
|
-
###
|
|
25
|
+
### Tool
|
|
26
26
|
|
|
27
|
-
Once registered, the plugin provides
|
|
27
|
+
Once registered, the plugin provides one tool: `execute_powershell`.
|
|
28
28
|
|
|
29
|
-
-
|
|
30
|
-
-
|
|
31
|
-
-
|
|
32
|
-
-
|
|
33
|
-
- **Output Streaming**: Real-time stdout/stderr capture
|
|
29
|
+
- Required params: `command`, `description`
|
|
30
|
+
- Optional params: `timeout_ms`, `workdir`
|
|
31
|
+
- `timeout_ms` default: `120000` (2 minutes)
|
|
32
|
+
- `workdir` default: current OpenCode directory (`context.directory`)
|
|
34
33
|
|
|
35
34
|
### Example Tool Call
|
|
36
35
|
|
|
@@ -45,6 +44,59 @@ Once registered, the plugin provides the `execute_powershell` tool with the foll
|
|
|
45
44
|
}
|
|
46
45
|
```
|
|
47
46
|
|
|
47
|
+
### Permission Integration (`ask` / `allow` / `deny`)
|
|
48
|
+
|
|
49
|
+
This plugin uses OpenCode's native permission engine and asks for permission key `execute_powershell` before spawning any command.
|
|
50
|
+
|
|
51
|
+
```json
|
|
52
|
+
{
|
|
53
|
+
"permission": {
|
|
54
|
+
"execute_powershell": {
|
|
55
|
+
"*": "ask",
|
|
56
|
+
"Get-Process*": "allow",
|
|
57
|
+
"Get-ChildItem*": "allow",
|
|
58
|
+
"Invoke-Expression*": "deny",
|
|
59
|
+
"Remove-Item*": "deny"
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
OpenCode evaluates rules with "last matching rule wins", so put broad defaults first and specific overrides later.
|
|
66
|
+
|
|
67
|
+
### External Directory Permission
|
|
68
|
+
|
|
69
|
+
If `workdir` resolves outside the active project/worktree boundary, the tool asks for OpenCode permission key `external_directory` using a recursive glob pattern.
|
|
70
|
+
|
|
71
|
+
```json
|
|
72
|
+
{
|
|
73
|
+
"permission": {
|
|
74
|
+
"execute_powershell": "ask",
|
|
75
|
+
"external_directory": "ask"
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Output Metadata Footer
|
|
81
|
+
|
|
82
|
+
Tool output includes a metadata footer:
|
|
83
|
+
|
|
84
|
+
`<powershell_metadata>{...}</powershell_metadata>`
|
|
85
|
+
|
|
86
|
+
Metadata fields:
|
|
87
|
+
- `exitCode`
|
|
88
|
+
- `endedBy` (`exit`, `timeout`, or `abort`)
|
|
89
|
+
- `shell` (`pwsh`, `powershell`, or `unknown`)
|
|
90
|
+
- `resolvedWorkdir`
|
|
91
|
+
- `timeoutMs`
|
|
92
|
+
- `durationMs`
|
|
93
|
+
|
|
94
|
+
### Platform and Security Notes
|
|
95
|
+
|
|
96
|
+
- Intended for Windows PowerShell command execution.
|
|
97
|
+
- Permission checks run before execution.
|
|
98
|
+
- For safer defaults, deny high-risk command patterns such as `Invoke-Expression*` and `Remove-Item*`.
|
|
99
|
+
|
|
48
100
|
## Development
|
|
49
101
|
|
|
50
102
|
```bash
|