claudeboard 1.0.0 → 1.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/agents/claude-api.js +18 -2
- package/bin/cli.js +14 -1
- package/package.json +1 -1
package/agents/claude-api.js
CHANGED
|
@@ -6,6 +6,22 @@
|
|
|
6
6
|
const MODEL = "claude-sonnet-4-20250514";
|
|
7
7
|
const MAX_TOKENS = 8096;
|
|
8
8
|
|
|
9
|
+
function getHeaders() {
|
|
10
|
+
const key = process.env.ANTHROPIC_API_KEY;
|
|
11
|
+
if (!key) {
|
|
12
|
+
throw new Error(
|
|
13
|
+
"ANTHROPIC_API_KEY not set.\n" +
|
|
14
|
+
"Run: claudeboard init (and enter your API key)\n" +
|
|
15
|
+
"Or: export ANTHROPIC_API_KEY=sk-ant-..."
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
return {
|
|
19
|
+
"Content-Type": "application/json",
|
|
20
|
+
"x-api-key": key,
|
|
21
|
+
"anthropic-version": "2023-06-01",
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
|
|
9
25
|
/**
|
|
10
26
|
* Call Claude API and get text response
|
|
11
27
|
*/
|
|
@@ -21,7 +37,7 @@ export async function callClaude(systemPrompt, userMessage, options = {}) {
|
|
|
21
37
|
|
|
22
38
|
const response = await fetch("https://api.anthropic.com/v1/messages", {
|
|
23
39
|
method: "POST",
|
|
24
|
-
headers:
|
|
40
|
+
headers: getHeaders(),
|
|
25
41
|
body: JSON.stringify(body),
|
|
26
42
|
});
|
|
27
43
|
|
|
@@ -81,7 +97,7 @@ export async function callClaudeWithImage(systemPrompt, userMessage, imageBase64
|
|
|
81
97
|
|
|
82
98
|
const response = await fetch("https://api.anthropic.com/v1/messages", {
|
|
83
99
|
method: "POST",
|
|
84
|
-
headers:
|
|
100
|
+
headers: getHeaders(),
|
|
85
101
|
body: JSON.stringify(body),
|
|
86
102
|
});
|
|
87
103
|
|
package/bin/cli.js
CHANGED
|
@@ -19,7 +19,17 @@ ${chalk.cyan("╚═════════════════════
|
|
|
19
19
|
|
|
20
20
|
function loadConfig() {
|
|
21
21
|
try {
|
|
22
|
-
|
|
22
|
+
const config = JSON.parse(fs.readFileSync(path.join(process.cwd(), ".claudeboard.json"), "utf8"));
|
|
23
|
+
// Inject API key into environment automatically
|
|
24
|
+
if (config.anthropicKey) {
|
|
25
|
+
process.env.ANTHROPIC_API_KEY = config.anthropicKey;
|
|
26
|
+
}
|
|
27
|
+
if (!process.env.ANTHROPIC_API_KEY) {
|
|
28
|
+
console.log(chalk.yellow("⚠️ ANTHROPIC_API_KEY not found."));
|
|
29
|
+
console.log(chalk.dim(" Run claudeboard init again, or: export ANTHROPIC_API_KEY=sk-ant-..."));
|
|
30
|
+
process.exit(1);
|
|
31
|
+
}
|
|
32
|
+
return config;
|
|
23
33
|
} catch {
|
|
24
34
|
console.log(chalk.yellow("No .claudeboard.json found. Run: claudeboard init"));
|
|
25
35
|
process.exit(1);
|
|
@@ -40,6 +50,7 @@ program
|
|
|
40
50
|
{ type: "input", name: "projectName", message: "Project name:", initial: path.basename(process.cwd()) },
|
|
41
51
|
{ type: "input", name: "supabaseUrl", message: "Supabase URL:", hint: "https://xxxx.supabase.co" },
|
|
42
52
|
{ type: "input", name: "supabaseKey", message: "Supabase anon key:" },
|
|
53
|
+
{ type: "password", name: "anthropicKey", message: "Anthropic API key:", hint: "sk-ant-..." },
|
|
43
54
|
{ type: "input", name: "port", message: "Dashboard port:", initial: "3131" },
|
|
44
55
|
]);
|
|
45
56
|
|
|
@@ -50,6 +61,7 @@ program
|
|
|
50
61
|
port: parseInt(answers.port),
|
|
51
62
|
supabaseUrl: answers.supabaseUrl,
|
|
52
63
|
supabaseKey: answers.supabaseKey,
|
|
64
|
+
anthropicKey: answers.anthropicKey,
|
|
53
65
|
createdAt: new Date().toISOString(),
|
|
54
66
|
};
|
|
55
67
|
|
|
@@ -91,6 +103,7 @@ program
|
|
|
91
103
|
...process.env,
|
|
92
104
|
SUPABASE_URL: config.supabaseUrl,
|
|
93
105
|
SUPABASE_KEY: config.supabaseKey,
|
|
106
|
+
ANTHROPIC_API_KEY: config.anthropicKey || process.env.ANTHROPIC_API_KEY || "",
|
|
94
107
|
PORT: String(port),
|
|
95
108
|
PROJECT_NAME: config.projectName,
|
|
96
109
|
},
|