@straussenl/opencode-ask-mode 1.0.4
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 -0
- package/README.md +50 -0
- package/index.ts +40 -0
- package/package.json +22 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026
|
|
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,50 @@
|
|
|
1
|
+
# opencode-ask-mode
|
|
2
|
+
|
|
3
|
+
Read-only **Ask Mode** plugin for [OpenCode](https://opencode.ai). Switch to Ask mode when you want to explore a codebase without risking accidental edits.
|
|
4
|
+
|
|
5
|
+
## What it does
|
|
6
|
+
|
|
7
|
+
- Registers a new **Ask** agent as a primary mode (selectable in the mode switcher)
|
|
8
|
+
- **Denies all file edits** — cannot create, modify, or delete files
|
|
9
|
+
- **Denies all shell commands** — no bash, no terminal access
|
|
10
|
+
- Pure read-only: search, read, explain, answer questions
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npm install -g opencode-ask-mode
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Then add to your global opencode config (`~/.config/opencode/opencode.json`):
|
|
19
|
+
|
|
20
|
+
```json
|
|
21
|
+
{
|
|
22
|
+
"plugin": ["opencode-ask-mode"]
|
|
23
|
+
}
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Restart opencode. The **Ask** mode will appear in your mode switcher.
|
|
27
|
+
|
|
28
|
+
## Usage
|
|
29
|
+
|
|
30
|
+
Switch to Ask mode in the opencode TUI, or use `/mode ask`. The assistant can:
|
|
31
|
+
|
|
32
|
+
- Read files and search the codebase
|
|
33
|
+
- Explain how code works
|
|
34
|
+
- Look up documentation
|
|
35
|
+
- Help debug by reading error output
|
|
36
|
+
|
|
37
|
+
It **cannot** edit files, run commands, or create plans.
|
|
38
|
+
|
|
39
|
+
## vs Plan Mode
|
|
40
|
+
|
|
41
|
+
| Feature | Ask Mode | Plan Mode |
|
|
42
|
+
|---------|----------|-----------|
|
|
43
|
+
| File edits | Denied | Denied |
|
|
44
|
+
| Shell commands | Denied | Allowed |
|
|
45
|
+
| Create plans | No | Yes |
|
|
46
|
+
| Read code | Yes | Yes |
|
|
47
|
+
|
|
48
|
+
## License
|
|
49
|
+
|
|
50
|
+
MIT
|
package/index.ts
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { Plugin } from "@opencode-ai/plugin"
|
|
2
|
+
|
|
3
|
+
const askPlugin: Plugin = async (_ctx) => {
|
|
4
|
+
return {
|
|
5
|
+
config: (cfg: Record<string, unknown>) => {
|
|
6
|
+
const agents = (cfg.agent ?? {}) as Record<string, unknown>
|
|
7
|
+
cfg.agent = agents
|
|
8
|
+
|
|
9
|
+
agents["ask"] = {
|
|
10
|
+
description: "Read-only assistant — ask questions about your codebase. No file edits, no shell commands.",
|
|
11
|
+
mode: "primary",
|
|
12
|
+
color: "#22c55e",
|
|
13
|
+
permission: { edit: "deny", bash: "deny" },
|
|
14
|
+
prompt: [
|
|
15
|
+
"You are Ask Mode — a purely read-only assistant.",
|
|
16
|
+
"",
|
|
17
|
+
"## What you CAN do",
|
|
18
|
+
"- Read files and search the codebase",
|
|
19
|
+
"- Answer questions about the code",
|
|
20
|
+
"- Explain how things work",
|
|
21
|
+
"- Look up documentation and references",
|
|
22
|
+
"- Help understand errors and debug output",
|
|
23
|
+
"",
|
|
24
|
+
"## What you CANNOT do",
|
|
25
|
+
"- Edit, create, or delete any files",
|
|
26
|
+
"- Run shell commands (no bash, no terminal)",
|
|
27
|
+
"- Create craft plans or task lists",
|
|
28
|
+
"- Make any changes to the project",
|
|
29
|
+
"",
|
|
30
|
+
"## Behavior",
|
|
31
|
+
"- When asked to make changes, politely remind the user to switch to a different mode (e.g. Build mode).",
|
|
32
|
+
"- You may suggest what changes could be made, but always clarify that you cannot execute them.",
|
|
33
|
+
"- Focus on explanation, analysis, and guidance — not execution.",
|
|
34
|
+
].join("\n"),
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export default askPlugin
|
package/package.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@straussenl/opencode-ask-mode",
|
|
3
|
+
"version": "1.0.4",
|
|
4
|
+
"description": "Read-only Ask mode plugin for OpenCode — no edits, no shell commands, just answers.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"exports": "./index.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"index.ts"
|
|
9
|
+
],
|
|
10
|
+
"scripts": {},
|
|
11
|
+
"keywords": [
|
|
12
|
+
"opencode",
|
|
13
|
+
"opencode-plugin",
|
|
14
|
+
"ask",
|
|
15
|
+
"readonly",
|
|
16
|
+
"agent"
|
|
17
|
+
],
|
|
18
|
+
"license": "MIT",
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"@opencode-ai/plugin": "latest"
|
|
21
|
+
}
|
|
22
|
+
}
|