Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .github/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,8 @@ branches:
strict: true
contexts:
- "test"
- "build"
- "build-check"
- "provider-safety-net"
# AI code review — fails only on a Yama BLOCKED verdict (see
# .github/workflows/yama-review.yml + yama.config.yaml).
- "Yama PR Review"
Expand All @@ -196,7 +197,8 @@ branches:
strict: true
contexts:
- "test"
- "build"
- "build-check"
- "provider-safety-net"
# AI code review — fails only on a Yama BLOCKED verdict (see
# .github/workflows/yama-review.yml + yama.config.yaml).
- "Yama PR Review"
Expand Down
48 changes: 36 additions & 12 deletions .github/workflows/ci.yml

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 MINOR: Hardcoded node version in CI workflow

The ci.yml workflow hardcodes Node.js version 20 and 22 directly in the YAML files instead of using environment variables or matrix configuration. This reduces flexibility when Node.js LTS versions change and requires manual updates to the workflows when new LTS versions are released.

Suggested fix: Consider using matrix strategy or environment variables for Node.js versions to allow automatic updates when new LTS versions are released.

Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20]

steps:
- name: Checkout code
uses: actions/checkout@v4
Expand All @@ -22,10 +18,10 @@
with:
version: 10.15.1

- name: Setup Node.js ${{ matrix.node-version }}
- name: Setup Node.js 20
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
node-version: "20"
cache: "pnpm"

- name: Install ffmpeg
Expand Down Expand Up @@ -83,66 +79,100 @@
pnpm run build:cli
node dist/cli/index.js --help

provider-safety-net:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup PNPM
uses: pnpm/action-setup@v4
with:
version: 10.15.1

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "22"
cache: "pnpm"
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved

- name: Install dependencies
run: pnpm install

- name: 🔄 SvelteKit Sync
run: |
echo "🔄 Running SvelteKit sync to generate TypeScript configs..."
pnpm exec svelte-kit sync

- name: Build package
run: pnpm run build

- name: Mocked provider contract tests (no API keys required)
run: pnpm run test:providers-mocked

- name: Provider structure tests (registry ↔ filesystem, no API keys required)
run: pnpm run test:provider-structure

# action-smoke-test:
# name: GitHub Action Smoke Test
# runs-on: ubuntu-latest
# needs: [test]
# steps:
# - name: Checkout code
# uses: actions/checkout@v4

# - name: Setup PNPM
# uses: pnpm/action-setup@v4
# with:
# version: 9

# - name: Setup Node.js
# uses: actions/setup-node@v4
# with:
# node-version: "20"
# cache: "pnpm"

# - name: Install dependencies
# run: pnpm install

# - name: SvelteKit Sync
# run: pnpm exec svelte-kit sync

# - name: Build GitHub Action
# run: pnpm run build:action

# - name: Test NeuroLink Action
# id: neurolink
# uses: ./
# with:
# prompt: "Respond with exactly: Hello from smoke test"
# provider: google-ai
# google_ai_api_key: ${{ secrets.GOOGLE_AI_API_KEY }}
# max_tokens: "20"
# temperature: "0"
# debug: "true"

# - name: Verify response
# env:
# RESPONSE: ${{ steps.neurolink.outputs.response }}
# PROVIDER: ${{ steps.neurolink.outputs.provider }}
# run: |
# echo "Response: $RESPONSE"
# echo "Provider: $PROVIDER"

# if [ -z "$RESPONSE" ]; then
# echo "ERROR: No response received"
# exit 1
# fi

# if [ -z "$PROVIDER" ]; then
# echo "ERROR: Provider not reported"
# exit 1
# fi

# echo "✅ Action smoke test passed!"

build-check:

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
runs-on: ubuntu-latest
steps:
- name: Checkout code
Expand Down Expand Up @@ -298,12 +328,6 @@
echo "📈 Running TypeScript compiler strict checks on source files..."
npx tsc --noEmit --strict --project tsconfig.json

- name: 🎯 Test Suite Validation
run: |
echo "🎯 Continuous test suites are run separately with API keys"
echo "Skipping automated test execution in CI"
continue-on-error: true

- name: 📋 Quality Summary
run: |
echo "📋 Build Rule Enforcement Summary:"
Expand Down
75 changes: 75 additions & 0 deletions .github/workflows/live-matrix.yml

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💬 SUGGESTION: New workflow lacks error handling documentation

The new .github/workflows/live-matrix.yml workflow doesn't include any failure notification mechanism or documentation about expected behavior when providers are unavailable. Since this workflow tests all 30 providers and many will fail without credentials, it would be helpful to add conditional logging or alerts for when live tests fail due to missing credentials or provider unavailability, and consider adding workflow-level description/comment about self-gating behavior.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in #1903: live-matrix.yml has a notify job that needs every live job, runs only on failure, holds issues: write on that job alone, and comments on one rolling live-matrix-fail issue (or opens it). It has not run yet: the first real run is the first failing nightly after the merge. It was checked by a YAML parse and bash -n; actionlint was not available.

Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Live Provider Matrix (Nightly)

on:
schedule:
# 03:00 UTC daily — off-peak, avoids colliding with PR CI load.
- cron: "0 3 * * *"
workflow_dispatch: {}

permissions:
contents: read

jobs:
live-matrix:
name: 🌐 Live Provider Matrix Sweep
runs-on: ubuntu-latest
# Not a required check — this workflow never appears in
# .github/settings.yml's branch-protection contexts. It exercises real
# provider credentials against real APIs and must not block merges on
# transient upstream outages or missing repo secrets.
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup PNPM
uses: pnpm/action-setup@v4
with:
version: 10.15.1

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "22"
cache: "pnpm"

- name: Install dependencies
run: pnpm install

- name: 🔄 SvelteKit Sync
run: pnpm exec svelte-kit sync

- name: Build package
run: pnpm run build

- name: Live provider matrix sweep (self-gates cleanly when keys are absent)
run: pnpm run test:matrix
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
GOOGLE_AI_API_KEY: ${{ secrets.GOOGLE_AI_API_KEY }}
GOOGLE_SERVICE_ACCOUNT_KEY: ${{ secrets.GOOGLE_SERVICE_ACCOUNT_KEY }}
GOOGLE_VERTEX_PROJECT: ${{ secrets.GOOGLE_VERTEX_PROJECT }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
SAGEMAKER_ENDPOINT: ${{ secrets.SAGEMAKER_ENDPOINT }}
AZURE_OPENAI_API_KEY: ${{ secrets.AZURE_OPENAI_API_KEY }}
AZURE_OPENAI_ENDPOINT: ${{ secrets.AZURE_OPENAI_ENDPOINT }}
MISTRAL_API_KEY: ${{ secrets.MISTRAL_API_KEY }}
HUGGINGFACE_API_KEY: ${{ secrets.HUGGINGFACE_API_KEY }}
OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }}
DEEPSEEK_API_KEY: ${{ secrets.DEEPSEEK_API_KEY }}
GROQ_API_KEY: ${{ secrets.GROQ_API_KEY }}
COHERE_API_KEY: ${{ secrets.COHERE_API_KEY }}
FIREWORKS_API_KEY: ${{ secrets.FIREWORKS_API_KEY }}
PERPLEXITY_API_KEY: ${{ secrets.PERPLEXITY_API_KEY }}
XAI_API_KEY: ${{ secrets.XAI_API_KEY }}
NVIDIA_NIM_API_KEY: ${{ secrets.NVIDIA_NIM_API_KEY }}
TOGETHER_AI_API_KEY: ${{ secrets.TOGETHER_AI_API_KEY }}
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
VOYAGE_API_KEY: ${{ secrets.VOYAGE_API_KEY }}
JINA_API_KEY: ${{ secrets.JINA_API_KEY }}
STABILITY_API_KEY: ${{ secrets.STABILITY_API_KEY }}
IDEOGRAM_API_KEY: ${{ secrets.IDEOGRAM_API_KEY }}
RECRAFT_API_KEY: ${{ secrets.RECRAFT_API_KEY }}
REPLICATE_API_TOKEN: ${{ secrets.REPLICATE_API_TOKEN }}
7 changes: 7 additions & 0 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

# Cheap no-API tier: build freshness + mocked provider contracts + registry
# structure. Keeps local pushes fast; live-credential suites run in the
# separate nightly live-matrix.yml workflow, not on every push.
pnpm run pre-push
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,6 @@ recovered-docs/

# Temporary investigation artifacts
fix/

# SDD scratch workspaces (git-ignored agent working files)
.superpowers/
5 changes: 3 additions & 2 deletions CLAUDE.md

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 MINOR: CLAUDE.md type vs interface change could use migration guide reference

The CLAUDE.md file was updated to remove all 'interface' declarations in favor of 'type', but there's no mention of existing code that might still use interfaces and how they should be migrated or refactored. This makes it harder for contributors to understand the full scope of changes needed when adopting this rule.

Suggested fix: Add a section explaining the rationale for using types over interfaces and potentially provide guidance on migrating existing interface declarations.

Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,9 @@ User input (text + files)
| `src/lib/mcp/mcpClientFactory.ts` | Creates MCP clients for all transport types |
| `src/lib/processors/registry/ProcessorRegistry.ts` | Selects file processor by MIME type + priority |
| `src/lib/types/index.ts` | Main type exports (start here for any type lookup) |
| `src/lib/types/providers.ts` | `AIProvider` interface, `AIProviderName` enum |
| `src/lib/types/providers.ts` | `AIProvider` type |
| `src/lib/types/mcp.ts` | `MCPTransportType` and MCP config types |
| `src/lib/constants/enums.ts` | `AIProviderName` enum |
| `src/lib/constants/contextWindows.ts` | Per-provider, per-model context window sizes |
| `src/lib/context/contextCompactor.ts` | Multi-stage context reduction orchestrator |
| `src/lib/context/budgetChecker.ts` | Pre-call budget validation |
Expand Down Expand Up @@ -263,7 +264,7 @@ confirming it reports `✗` and exits non-zero rather than `⊘`.
### Adding a New Provider

1. Create `src/lib/providers/yourProvider.ts` — extend `BaseProvider`
2. Add name to `AIProviderName` enum in `src/lib/types/providers.ts`
2. Add name to `AIProviderName` enum in `src/lib/constants/enums.ts`
3. Add model constants to `src/lib/models/`
4. Register in `ProviderRegistry.registerAllProviders()` using a dynamic import:

Expand Down
51 changes: 21 additions & 30 deletions docs/provider-integration/06-testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,35 +11,26 @@

### A. `test/continuous-test-suite-providers.ts`

This is the main provider suite. The relevant section is the `ALL_PROVIDERS` array (around line 73):

```diff
const ALL_PROVIDERS = [
"openai",
"anthropic",
"vertex",
"google-ai",
"openrouter",
"bedrock",
"azure",
"mistral",
"ollama",
"litellm",
"huggingface",
+ "deepseek",
+ "nvidia-nim",
+ "lm-studio",
+ "llamacpp",
] as const;
```

The all-provider loop at the bottom of this file iterates `ALL_PROVIDERS` and:

1. Calls `validateConfiguration()` on the provider
2. Skips with `[SKIP] env not configured` if it returns false
3. Otherwise runs `generate("Hi")` and `stream("Hi")`

For local providers (LM Studio, llama.cpp), the skip behavior already works because `validateConfiguration()` does an HTTP probe of `/v1/models` or `/health`. If the server isn't running, returns false → tests skip.
**Updated 2026-08-15:** the `ALL_PROVIDERS` array described below no longer
exists — `continuous-test-suite-providers.ts` deleted it once provider
coverage moved to two more targeted places:

1. **Structural completeness** (zero API keys, runs in CI on every commit):
`test/continuous-test-suite-provider-structure.ts`
(`pnpm run test:provider-structure`) asserts every value in the
canonical `AIProviderName` enum resolves via `ProviderFactory`, and every
`src/lib/providers/*.ts` module has exactly one dynamic import in
`providerRegistry.ts`.
2. **Live per-provider generate/stream sweep** (needs API keys, runs
nightly via `.github/workflows/live-matrix.yml`, not a PR gate):
`test/continuous-test-suite-provider-matrix.ts` (`pnpm run test:matrix`)
iterates `test/helpers/providerMatrix.ts`'s `PROVIDERS` map — see that
file's header comment for the current provider count and coverage gaps.

If you're adding a new provider, add it to `providerMatrix.ts`'s
`PROVIDERS` map so `test:matrix` picks it up automatically;
`test:provider-structure` needs no edits — it derives its expectations from
the `AIProviderName` enum and the filesystem, not a hand-maintained list.

### B. `test/continuous-test-suite-credentials.ts`

Expand Down Expand Up @@ -134,7 +125,7 @@ Likely no changes needed — it invokes per-domain suites which are already wire

### D. `package.json`

The canonical entrypoint for the four new providers is **`pnpm run test:new-providers`**, which runs the dedicated suite `test/continuous-test-suite-new-providers.ts` (full feature surface per provider — generate, stream, tools, structured, reasoning, vision-where-supported, abort, timeout, per-call creds, telemetry, error formatting). The existing `test:providers` (`ALL_PROVIDERS` loop) and `test:credentials` are still useful for cross-provider checks but the new suite is the primary coverage for the integration.
The canonical entrypoint for the four new providers is **`pnpm run test:new-providers`**, which runs the dedicated suite `test/continuous-test-suite-new-providers.ts` (full feature surface per provider — generate, stream, tools, structured, reasoning, vision-where-supported, abort, timeout, per-call creds, telemetry, error formatting). The existing `test:providers` and `test:credentials` are still useful for cross-provider checks but the new suite is the primary coverage for the integration.

## NVIDIA NIM-specific test (the only one that needs custom assertions)

Expand Down
Loading
Loading