@paulp-o/opencode-auq 0.1.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/LICENSE ADDED
@@ -0,0 +1,25 @@
1
+ The MIT License (MIT)
2
+ =====================
3
+
4
+ Copyright © 2025 Frank Fiegel (frank@glama.ai)
5
+
6
+ Permission is hereby granted, free of charge, to any person
7
+ obtaining a copy of this software and associated documentation
8
+ files (the “Software”), to deal in the Software without
9
+ restriction, including without limitation the rights to use,
10
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ copies of the Software, and to permit persons to whom the
12
+ Software is furnished to do so, subject to the following
13
+ conditions:
14
+
15
+ The above copyright notice and this permission notice shall be
16
+ included in all copies or substantial portions of the Software.
17
+
18
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
19
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
20
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
22
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25
+ OTHER DEALINGS IN THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,26 @@
1
+ # AUQ OpenCode Plugin
2
+
3
+ OpenCode plugin that forwards `ask_user_questions` to the `auq ask` CLI.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install -g auq-mcp-server
9
+ npm install -g @paulp-o/opencode-auq
10
+ ```
11
+
12
+ ## Configure OpenCode
13
+
14
+ Add to `opencode.json`:
15
+
16
+ ```json
17
+ {
18
+ "$schema": "https://opencode.ai/config.json",
19
+ "plugin": ["@paulp-o/opencode-auq"]
20
+ }
21
+ ```
22
+
23
+ ## Notes
24
+
25
+ - The plugin expects `auq` to be on `PATH` (global install or equivalent).
26
+ - The tool name and parameters match the MCP server (`ask_user_questions`).
@@ -0,0 +1,4 @@
1
+ import { type Plugin } from "@opencode-ai/plugin";
2
+ export declare const AskUserQuestionsPlugin: Plugin;
3
+ export default AskUserQuestionsPlugin;
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAuGlD,eAAO,MAAM,sBAAsB,EAAE,MAoCnC,CAAC;AAEH,eAAe,sBAAsB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,110 @@
1
+ import { spawn } from "child_process";
2
+ import { tool } from "@opencode-ai/plugin/tool";
3
+ const z = tool.schema;
4
+ const OptionSchema = z.object({
5
+ label: z
6
+ .string()
7
+ .describe("The display text for this option that the user will see and select. " +
8
+ "Should be concise (1-5 words) and clearly describe the choice."),
9
+ description: z
10
+ .string()
11
+ .optional()
12
+ .describe("Explanation of what this option means or what will happen if chosen. " +
13
+ "Useful for providing context about trade-offs or implications."),
14
+ });
15
+ const QuestionSchema = z.object({
16
+ prompt: z
17
+ .string()
18
+ .describe("The complete question to ask the user. Should be clear, specific, and end with a question mark. " +
19
+ "Example: 'Which programming language do you want to use?' " +
20
+ "If multiSelect is true, phrase it accordingly, e.g. 'Which features do you want to enable?'"),
21
+ title: z
22
+ .string()
23
+ .min(1, "Question title is required. Provide a short summary like 'Language' or 'Framework'.")
24
+ .describe("Very short label displayed as a chip/tag (max 12 chars). " +
25
+ "Examples: 'Auth method', 'Library', 'Approach'. " +
26
+ "This title appears in the interface to help users quickly identify questions."),
27
+ options: z
28
+ .array(OptionSchema)
29
+ .min(2)
30
+ .max(4)
31
+ .describe("The available choices for this question. Must have 2-4 options. " +
32
+ "Each option should be a distinct, mutually exclusive choice (unless multiSelect is enabled). " +
33
+ "There should be no 'Other' option, that will be provided automatically."),
34
+ multiSelect: z
35
+ .boolean()
36
+ .describe("Set to true to allow the user to select multiple options instead of just one. " +
37
+ "Use when choices are not mutually exclusive. Default: false (single-select)"),
38
+ });
39
+ const QuestionsSchema = z.array(QuestionSchema).min(1).max(4);
40
+ const runAuqAsk = async (payload) => new Promise((resolve, reject) => {
41
+ const child = spawn("auq", ["ask"], {
42
+ stdio: ["pipe", "pipe", "pipe"],
43
+ });
44
+ let stdout = "";
45
+ let stderr = "";
46
+ child.stdout.setEncoding("utf8");
47
+ child.stderr.setEncoding("utf8");
48
+ child.stdout.on("data", (chunk) => {
49
+ stdout += chunk;
50
+ });
51
+ child.stderr.on("data", (chunk) => {
52
+ stderr += chunk;
53
+ });
54
+ child.on("error", (error) => {
55
+ reject(new Error(`Failed to run \"auq ask\": ${error.message}. Is the auq CLI installed globally?`));
56
+ });
57
+ child.on("close", (code) => {
58
+ if (code === 0) {
59
+ resolve(stdout.trim());
60
+ return;
61
+ }
62
+ const detail = stderr.trim() || stdout.trim();
63
+ reject(new Error(detail || `auq ask exited with code ${code}`));
64
+ });
65
+ try {
66
+ child.stdin.write(JSON.stringify(payload));
67
+ child.stdin.end();
68
+ }
69
+ catch (error) {
70
+ reject(error);
71
+ }
72
+ });
73
+ export const AskUserQuestionsPlugin = async () => ({
74
+ tool: {
75
+ ask_user_questions: tool({
76
+ description: "Use this tool when you need to ask the user questions during execution. " +
77
+ "This allows you to:\n" +
78
+ "1. Gather user preferences or requirements\n" +
79
+ "2. Clarify ambiguous instructions\n" +
80
+ "3. Get decisions on implementation choices as you work\n" +
81
+ "4. Offer choices to the user about what direction to take\n\n" +
82
+ "FEATURES:\n" +
83
+ "- Ask 1-4 structured questions via an interactive terminal interface\n" +
84
+ "- Each question includes 2-4 multiple-choice options with explanatory descriptions\n" +
85
+ "- Users can always provide custom free-text input as an alternative to predefined options\n" +
86
+ "- Single-select mode (default): User picks ONE option or provides custom text\n" +
87
+ "- Multi-select mode (multiSelect: true): User can select MULTIPLE options\n\n" +
88
+ "USAGE NOTES:\n" +
89
+ "- Always provide a descriptive 'title' field (max 12 chars) for each question\n" +
90
+ "- Use multiSelect: true when choices are not mutually exclusive\n" +
91
+ "- Option labels should be concise (1-5 words)\n" +
92
+ "- Questions should end with a question mark\n" +
93
+ "- Don't include an 'Other' option - it's provided automatically\n\n" +
94
+ "- If user seems not aware how to answer the question, inform them that they need to install the 'auq' cli tool.\n\n" +
95
+ "Returns a formatted summary of all questions and answers.",
96
+ args: {
97
+ questions: QuestionsSchema,
98
+ },
99
+ async execute(args) {
100
+ try {
101
+ return await runAuqAsk({ questions: args.questions });
102
+ }
103
+ catch (error) {
104
+ return `Error in session: ${String(error)}`;
105
+ }
106
+ },
107
+ }),
108
+ },
109
+ });
110
+ export default AskUserQuestionsPlugin;
package/package.json ADDED
@@ -0,0 +1,40 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/package.json",
3
+ "name": "@paulp-o/opencode-auq",
4
+ "version": "0.1.0",
5
+ "description": "OpenCode plugin that forwards ask_user_questions to the auq CLI",
6
+ "type": "module",
7
+ "main": "dist/index.js",
8
+ "types": "dist/index.d.ts",
9
+ "files": [
10
+ "dist",
11
+ "README.md",
12
+ "LICENSE"
13
+ ],
14
+ "scripts": {
15
+ "build": "tsc -p tsconfig.json",
16
+ "prepublishOnly": "npm run build",
17
+ "typecheck": "tsc -p tsconfig.json --noEmit"
18
+ },
19
+ "keywords": [
20
+ "opencode",
21
+ "opencode-plugin",
22
+ "auq",
23
+ "ask-user-questions"
24
+ ],
25
+ "repository": {
26
+ "type": "git",
27
+ "url": "git+https://github.com/paulp-o/ask-user-questions-mcp.git",
28
+ "directory": "packages/opencode-plugin"
29
+ },
30
+ "license": "MIT",
31
+ "peerDependencies": {
32
+ "@opencode-ai/plugin": ">=1.0.0"
33
+ },
34
+ "devDependencies": {
35
+ "@opencode-ai/plugin": "^1.1.3",
36
+ "@tsconfig/node22": "^22.0.1",
37
+ "@types/node": "^22.13.0",
38
+ "typescript": "^5.8.3"
39
+ }
40
+ }