environment-setup-guide
Guide developers through setting up development environments with proper tools, dependencies, and configurations
twinmind-ci-integration
Integrate TwinMind into CI/CD pipelines for automated testing and deployment. Use when setting up GitHub Actions, GitLab CI, or other CI systems with TwinMind API testing and validation. Trigger with phrases like "twinmind ci", "twinmind github actions", "twinmind pipeline", "automate twinmind te...
Full skill instructions
Integrate TwinMind testing and validation into CI/CD pipelines.
# .github/workflows/twinmind-tests.yml
name: TwinMind Integration Tests
on:
push:
branches: [main, develop]
paths:
- 'src/twinmind/**'
- 'tests/twinmind/**'
pull_request:
branches: [main]
schedule:
# Run daily at 6 AM UTC
- cron: '0 6 * * *'
env:
NODE_VERSION: '20'
jobs:
lint-and-typecheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run linter
run: npm run lint
- name: Run typecheck
run: npm run typecheck
unit-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run unit tests
run: npm run test:unit
env:
TWINMIND_API_KEY: ${{ secrets.TWINMIND_API_KEY_TEST }}
integration-tests:
runs-on: ubuntu-latest
needs: [lint-and-typecheck, unit-tests]
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run integration tests
run: npm run test:integration
env:
TWINMIND_API_KEY: ${{ secrets.TWINMIND_API_KEY_TEST }}
TWINMIND_WEBHOOK_SECRET: ${{ secrets.TWINMIND_WEBHOOK_SECRET }}
timeout-minutes: 10
- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: test-results
path: coverage/
api-health-check:
runs-on: ubuntu-latest
steps:
- name: Check TwinMind API Health
run: |
RESPONSE=$(curl -s -w "\n%{http_code}" \
-H "Authorization: Bearer ${{ secrets.TWINMIND_API_KEY_TEST }}" \
https://api.twinmind.com/v1/health)
HTTP_CODE=$(echo "$RESPONSE" | tail -1)
BODY=$(echo "$RESPONSE" | head -n -1)
echo "HTTP Status: $HTTP_CODE"
echo "Response: $BODY"
if [ "$HTTP_CODE" != "200" ]; then
echo "API health check failed"
exit 1
fi
transcription-smoke-test:
runs-on: ubuntu-latest
needs: [integration-tests, api-health-check]
if: github.event_name == 'schedule' || github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run transcription smoke test
run: npm run test:smoke
env:
TWINMIND_API_KEY: ${{ secrets.TWINMIND_API_KEY_TEST }}
TEST_AUDIO_URL: ${{ secrets.TEST_AUDIO_URL }}
timeout-minutes: 5
// tests/unit/twinmind/client.test.ts
import { describe, it, expect, beforeEach, vi } from 'vitest';
import { TwinMindClient } from '../../../src/twinmind/client';
describe('TwinMindClient', () => {
let client: TwinMindClient;
beforeEach(() => {
client = new TwinMindClient({
apiKey: 'test_api_key',
baseUrl: 'https://api.twinmind.com/v1',
});
});
describe('transcribe', () => {
it('should send correct request for transcription', async () => {
const mockFetch = vi.fn().mockResolvedValue({
ok: true,
json: () => Promise.resolve({
id: 'tr_123',
status: 'processing',
}),
});
global.fetch = mockFetch;
const result = await client.transcribe('https://example.com/audio.mp3');
expect(mockFetch).toHaveBeenCalledWith(
expect.stringContaining('/transcribe'),
expect.objectContaining({
method: 'POST',
headers: expect.objectContaining({
'Authorization': 'Bearer test_api_key',
}),
})
);
});
it('should handle rate limit errors', async () => {
const mockFetch = vi.fn().mockResolvedValue({
ok: false,
status: 429,
headers: new Headers({ 'Retry-After': '60' }),
});
global.fetch = mockFetch;
await expect(client.transcribe('https://example.com/audio.mp3'))
.rejects.toThrow(/rate limit/i);
});
});
describe('summarize', () => {
it('should generate summary from transcript', async () => {
const mockFetch = vi.fn().mockResolvedValue({
ok: true,
json: () => Promise.resolve({
summary: 'Meeting discussed project timeline.',
action_items: [{ text: 'Review budget', assignee: 'John' }],
}),
});
global.fetch = mockFetch;
const result = await client.summarize('tr_123');
expect(result.summary).toContain('project timeline');
expect(result.action_items).toHaveLength(1);
});
});
});
// tests/integration/twinmind/transcription.test.ts
import { describe, it, expect, beforeAll } from 'vitest';
import { TwinMindClient } from '../../../src/twinmind/client';
describe('TwinMind Transcription Integration', () => {
let client: TwinMindClient;
beforeAll(() => {
const apiKey = process.env.TWINMIND_API_KEY;
if (!apiKey) {
throw new Error('TWINMIND_API_KEY required for integration tests');
}
client = new TwinMindClient({ apiKey });
});
describe('API Health', () => {
it('should return healthy status', async () => {
const health = await client.healthCheck();
expect(health).toBe(true);
});
});
describe('Account', () => {
it('should return account info', async () => {
const account = await client.getAccount();
expect(account.id).toBeDefined();
expect(account.plan).toBeDefined();
});
});
describe('Transcription', () => {
it('should transcribe test audio', async () => {
const audioUrl = process.env.TEST_AUDIO_URL;
if (!audioUrl) {
console.log('Skipping: TEST_AUDIO_URL not set');
return;
}
const transcript = await client.transcribe(audioUrl, {
language: 'en',
diarization: false,
});
expect(transcript.id).toBeDefined();
expect(transcript.text.length).toBeGreaterThan(0);
}, 60000); // 60 second timeout
});
});
// tests/smoke/twinmind-smoke.ts
import { TwinMindClient } from '../../src/twinmind/client';
interface SmokeTestResult {
name: string;
passed: boolean;
duration: number;
error?: string;
}
async function runSmokeTests(): Promise<SmokeTestResult[]> {
const results: SmokeTestResult[] = [];
const client = new TwinMindClient({
apiKey: process.env.TWINMIND_API_KEY!,
});
// Test 1: Health Check
const healthStart = Date.now();
try {
await client.healthCheck();
results.push({
name: 'API Health Check',
passed: true,
duration: Date.now() - healthStart,
});
} catch (error: any) {
results.push({
name: 'API Health Check',
passed: false,
duration: Date.now() - healthStart,
error: error.message,
});
}
// Test 2: Account Access
const accountStart = Date.now();
try {
const account = await client.getAccount();
results.push({
name: 'Account Access',
passed: !!account.id,
duration: Date.now() - accountStart,
});
} catch (error: any) {
results.push({
name: 'Account Access',
passed: false,
duration: Date.now() - accountStart,
error: error.message,
});
}
// Test 3: Transcription (if test audio available)
if (process.env.TEST_AUDIO_URL) {
const transcribeStart = Date.now();
try {
const transcript = await client.transcribe(process.env.TEST_AUDIO_URL, {
model: 'ear-3',
});
results.push({
name: 'Transcription',
passed: !!transcript.id && transcript.text.length > 0,
duration: Date.now() - transcribeStart,
});
} catch (error: any) {
results.push({
name: 'Transcription',
passed: false,
duration: Date.now() - transcribeStart,
error: error.message,
});
}
}
return results;
}
// Main execution
async function main() {
console.log('Running TwinMind Smoke Tests...\n');
const results = await runSmokeTests();
console.log('Results:');
console.log('========');
let allPassed = true;
for (const result of results) {
const status = result.passed ? 'PASS' : 'FAIL';
console.log(`[${status}] ${result.name} (${result.duration}ms)`);
if (result.error) {
console.log(` Error: ${result.error}`);
}
if (!result.passed) allPassed = false;
}
console.log('\n' + (allPassed ? 'All tests passed!' : 'Some tests failed.'));
process.exit(allPassed ? 0 : 1);
}
main().catch(console.error);
# .gitlab-ci.yml
stages:
- lint
- test
- integration
- deploy
variables:
NODE_VERSION: "20"
.node-template: &node-template
image: node:${NODE_VERSION}
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- node_modules/
lint:
<<: *node-template
stage: lint
script:
- npm ci
- npm run lint
- npm run typecheck
unit-tests:
<<: *node-template
stage: test
script:
- npm ci
- npm run test:unit
coverage: '/All files[^|]*\|[^|]*\s+([\d\.]+)/'
artifacts:
reports:
coverage_report:
coverage_format: cobertura
path: coverage/cobertura-coverage.xml
integration-tests:
<<: *node-template
stage: integration
variables:
TWINMIND_API_KEY: $TWINMIND_API_KEY_TEST
script:
- npm ci
- npm run test:integration
rules:
- if: $CI_COMMIT_BRANCH == "main"
- if: $CI_PIPELINE_SOURCE == "schedule"
api-health:
stage: integration
image: curlimages/curl:latest
script:
- |
curl -f -H "Authorization: Bearer $TWINMIND_API_KEY_TEST" \
https://api.twinmind.com/v1/health
rules:
- if: $CI_COMMIT_BRANCH == "main"
// vitest.config.ts
import { defineConfig } from 'vitest/config';
export default defineConfig({
test: {
globals: true,
environment: 'node',
coverage: {
provider: 'v8',
reporter: ['text', 'json', 'html', 'cobertura'],
exclude: [
'node_modules/',
'tests/',
'dist/',
],
},
testTimeout: 30000,
hookTimeout: 30000,
},
});
// package.json scripts
{
"scripts": {
"test": "vitest",
"test:unit": "vitest run tests/unit",
"test:integration": "vitest run tests/integration",
"test:smoke": "ts-node tests/smoke/twinmind-smoke.ts",
"test:coverage": "vitest run --coverage"
}
}
| Issue | Cause | Solution |
|---|---|---|
| Secret not found | Not configured | Add to GitHub Secrets |
| Test timeout | Large audio file | Use short test samples |
| Rate limited | Too many CI runs | Use test account limits |
| API unavailable | TwinMind outage | Add retry logic |
For deployment integration, see twinmind-deploy-integration.
Guide developers through setting up development environments with proper tools, dependencies, and configurations
Implement Exa lint rules, policy enforcement, and automated guardrails. Use when setting up code quality rules for Exa integrations, implementing pre-commit hooks, or configuring CI policy checks for Exa best practices. Trigger with phrases like "exa policy", "exa lint", "exa guardrails", "exa be...
Configure CI/CD pipelines for Documenso integrations. Use when setting up automated testing, deployment pipelines, or continuous integration for Documenso projects. Trigger with phrases like "documenso CI", "documenso GitHub Actions", "documenso pipeline", "documenso automated testing".
Build check model availability and implement fallback chains. Use when building resilient systems or handling model outages. Trigger with phrases like 'openrouter availability', 'openrouter fallback', 'openrouter model down', 'openrouter health check'.
Configure Langfuse enterprise organization management and access control. Use when implementing team access controls, configuring organization settings, or setting up role-based permissions for Langfuse projects. Trigger with phrases like "langfuse RBAC", "langfuse teams", "langfuse organization"...
Execute compliance and security auditing for Cursor usage. Triggers on "cursor compliance", "cursor audit", "cursor security review", "cursor soc2", "cursor gdpr". Use when analyzing or auditing cursor compliance audit. Trigger with phrases like "cursor compliance audit", "cursor audit", "cursor".
Configure Apollo.io CI/CD integration. Use when setting up automated testing, continuous integration, or deployment pipelines for Apollo integrations. Trigger with phrases like "apollo ci", "apollo github actions", "apollo pipeline", "apollo ci/cd", "apollo automated tests".
Create robust Python automation with full logging and safety checks. Use when tasks need complex data processing, authenticated API work, conditional file operations, or error handling beyond simple shell commands.
Configure PostHog across development, staging, and production environments. Use when setting up multi-environment deployments, configuring per-environment secrets, or implementing environment-specific PostHog configurations. Trigger with phrases like "posthog environments", "posthog staging", "po...
Expert in designing and building autonomous AI agents. Masters tool use, memory systems, planning strategies, and multi-agent orchestration. Use when: build agent, AI agent, autonomous agent, tool use, function calling.
Validate insecure deserialization checker operations. Auto-activating skill for Security Fundamentals. Triggers on: insecure deserialization checker, insecure deserialization checker Part of the Security Fundamentals skill category. Use when working with insecure deserialization checker functiona...
Manage path traversal finder operations. Auto-activating skill for Security Fundamentals. Triggers on: path traversal finder, path traversal finder Part of the Security Fundamentals skill category. Use when working with path traversal finder functionality. Trigger with phrases like "path traversa...
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience