Skip to content

Commit 0ce06b6

Browse files
committed
fix: resolve CI build errors
- Fix Astro template parsing for mermaid diagrams with {{}} syntax - Add test environment detection to avoid OPENROUTER_API_KEY requirement in CI
1 parent 5818602 commit 0ce06b6

File tree

3 files changed

+24
-6
lines changed

3 files changed

+24
-6
lines changed

docs/.astro/types.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
/// <reference types="astro/client" />
2+
/// <reference path="content.d.ts" />

docs/src/pages/docs/architecture.astro

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ flowchart TB
131131
</p>
132132

133133
<div class="diagram">
134-
<pre class="mermaid">
134+
<pre class="mermaid" set:html={`
135135
flowchart LR
136136
A["User Message"] --> B["Add to History"]
137137
B --> C["Truncate Context"]
@@ -141,7 +141,7 @@ flowchart LR
141141
F --> G["Add Results"]
142142
G --> D
143143
E -->|"Final Answer"| H["Return Response"]
144-
</pre>
144+
`}></pre>
145145
</div>
146146

147147
<p>Key aspects of the loop:</p>
@@ -201,7 +201,7 @@ sequenceDiagram
201201
</p>
202202

203203
<div class="diagram">
204-
<pre class="mermaid">
204+
<pre class="mermaid" set:html={`
205205
flowchart TD
206206
A["Tool Call Received"] --> B{{"Requires Confirmation?"}}
207207
B -->|No| E["Execute Tool"]
@@ -215,7 +215,7 @@ flowchart TD
215215
H --> I["Run Tool Function"]
216216
I --> J["Return Result"]
217217
G --> J
218-
</pre>
218+
`}></pre>
219219
</div>
220220

221221
<h2>Context Window Management</h2>
@@ -225,7 +225,7 @@ flowchart TD
225225
</p>
226226

227227
<div class="diagram">
228-
<pre class="mermaid">
228+
<pre class="mermaid" set:html={`
229229
flowchart TD
230230
A["Estimate Conversation Tokens"] --> B{{"Exceeds Limit?"}}
231231
B -->|No| C["Return Messages As-Is"]
@@ -238,7 +238,7 @@ flowchart TD
238238
H["User Message"]
239239
I["Assistant + Tool Results"]
240240
end
241-
</pre>
241+
`}></pre>
242242
</div>
243243

244244
<p>

src/config/index.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,27 @@ const envSchema = z.object({
2020

2121
export type EnvConfig = z.infer<typeof envSchema>;
2222

23+
/**
24+
* Check if we're running in a test environment
25+
*/
26+
const isTestEnv = process.env.NODE_ENV === "test" || typeof Bun !== "undefined" && Bun.env.BUN_ENV === "test" || process.argv.some(arg => arg.includes("bun") && arg.includes("test"));
27+
2328
/**
2429
* Validate and parse environment variables
2530
*/
2631
function loadConfig(): EnvConfig {
32+
// In test environment, use defaults if API key not provided
33+
if (isTestEnv && !process.env.OPENROUTER_API_KEY) {
34+
return {
35+
OPENROUTER_API_KEY: "test-api-key",
36+
OPENROUTER_MODEL: "anthropic/claude-sonnet-4",
37+
APP_NAME: "Clarissa",
38+
APP_URL: undefined,
39+
MAX_ITERATIONS: 10,
40+
DEBUG: false,
41+
};
42+
}
43+
2744
const result = envSchema.safeParse(process.env);
2845

2946
if (!result.success) {

0 commit comments

Comments
 (0)