@gopersonal/advisor 1.0.2 → 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 +5 -0
- package/build/index.js +13 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -65,6 +65,11 @@ claude mcp add advisor -- npx -y @gopersonal/advisor
|
|
|
65
65
|
| `ADVISOR_MODEL` | Model name | `gpt-4o`, `claude-sonnet-4-5` |
|
|
66
66
|
| `ADVISOR_API_KEY` | API key for the provider | `sk-...` |
|
|
67
67
|
| `ADVISOR_BASE_URL` | Custom base URL (optional) | `https://proxy.example.com` |
|
|
68
|
+
| `ADVISOR_DIRECTORY` | Project directory for opencode context (optional) | `/Users/me/myproject` |
|
|
69
|
+
| `ADVISOR_INSTRUCTIONS` | Path to instructions/AGENTS.md file (optional) | `/Users/me/myproject/AGENTS.md` |
|
|
70
|
+
|
|
71
|
+
`ADVISOR_DIRECTORY` gives the advisor context about your project (file structure, code, etc.).
|
|
72
|
+
`ADVISOR_INSTRUCTIONS` loads a custom instructions file (like AGENTS.md) so the advisor knows your project conventions.
|
|
68
73
|
|
|
69
74
|
If no env vars are set, the advisor connects to a running opencode instance or starts one using your default opencode config.
|
|
70
75
|
|
package/build/index.js
CHANGED
|
@@ -19,8 +19,9 @@ import { createOpencode, createOpencodeClient } from "@opencode-ai/sdk/v2";
|
|
|
19
19
|
// ADVISOR_API_KEY = "sk-ant-..."
|
|
20
20
|
// ADVISOR_BASE_URL = "https://api.anthropic.com"
|
|
21
21
|
//
|
|
22
|
-
//
|
|
23
|
-
//
|
|
22
|
+
// Optional:
|
|
23
|
+
// ADVISOR_DIRECTORY = project directory for opencode context (e.g. "/Users/me/myproject")
|
|
24
|
+
// ADVISOR_INSTRUCTIONS = path to instructions file (e.g. "/Users/me/myproject/AGENTS.md")
|
|
24
25
|
//
|
|
25
26
|
function resolveProviderAndModel() {
|
|
26
27
|
const explicitProvider = process.env.ADVISOR_PROVIDER?.toLowerCase();
|
|
@@ -67,10 +68,15 @@ function buildOpencodeConfig() {
|
|
|
67
68
|
const apiKey = process.env.ADVISOR_API_KEY;
|
|
68
69
|
const baseURL = process.env.ADVISOR_BASE_URL;
|
|
69
70
|
const npm = process.env.ADVISOR_NPM || resolved?.npm;
|
|
71
|
+
const instructions = process.env.ADVISOR_INSTRUCTIONS;
|
|
70
72
|
const config = {
|
|
71
73
|
// Disable title generation (it uses small_model which may not work with custom providers)
|
|
72
74
|
small_model: resolved?.fullModel || undefined,
|
|
75
|
+
// Additional instruction files (e.g. AGENTS.md)
|
|
76
|
+
...(instructions ? { instructions: [instructions] } : {}),
|
|
73
77
|
};
|
|
78
|
+
if (instructions)
|
|
79
|
+
console.error(`[advisor] Instructions: ${instructions}`);
|
|
74
80
|
if (resolved) {
|
|
75
81
|
config.model = resolved.fullModel;
|
|
76
82
|
console.error(`[advisor] Provider: ${resolved.provider}, Model: ${resolved.model}`);
|
|
@@ -162,8 +168,10 @@ function sleep(ms) {
|
|
|
162
168
|
}
|
|
163
169
|
async function askOpencode(prompt, systemPrompt) {
|
|
164
170
|
const client = await getOpencodeClient();
|
|
171
|
+
const directory = process.env.ADVISOR_DIRECTORY;
|
|
165
172
|
const sessionResult = await client.session.create({
|
|
166
173
|
title: "Advisor Query",
|
|
174
|
+
...(directory ? { directory } : {}),
|
|
167
175
|
});
|
|
168
176
|
if (!sessionResult.data) {
|
|
169
177
|
throw new Error("Failed to create opencode session");
|
|
@@ -177,6 +185,7 @@ async function askOpencode(prompt, systemPrompt) {
|
|
|
177
185
|
sessionID: sessionId,
|
|
178
186
|
system: systemPrompt,
|
|
179
187
|
...(modelOverride ? { model: modelOverride } : {}),
|
|
188
|
+
...(directory ? { directory } : {}),
|
|
180
189
|
parts: [{ type: "text", text: prompt }],
|
|
181
190
|
});
|
|
182
191
|
console.error(`[advisor] Prompt submitted async`);
|
|
@@ -392,7 +401,8 @@ server.registerTool("get_second_opinion", {
|
|
|
392
401
|
async function main() {
|
|
393
402
|
const transport = new StdioServerTransport();
|
|
394
403
|
await server.connect(transport);
|
|
395
|
-
|
|
404
|
+
const dir = process.env.ADVISOR_DIRECTORY;
|
|
405
|
+
console.error(`[advisor] MCP Advisor server running on stdio${dir ? ` (directory: ${dir})` : ""}`);
|
|
396
406
|
}
|
|
397
407
|
main().catch((error) => {
|
|
398
408
|
console.error("[advisor] Fatal error:", error);
|