file_path stringlengths 3 280 | file_language stringclasses 66
values | content stringlengths 1 1.04M | repo_name stringlengths 5 92 | repo_stars int64 0 154k | repo_description stringlengths 0 402 | repo_primary_language stringclasses 108
values | developer_username stringlengths 1 25 | developer_name stringlengths 0 30 | developer_company stringlengths 0 82 |
|---|---|---|---|---|---|---|---|---|---|
gemini_tts_stream_test.py | Python | #!/usr/bin/env python3
import base64
import os
import mimetypes
import wave
import struct
import argparse
from dotenv import load_dotenv
try:
import pyaudio
from google import genai
from google.genai import types
except ImportError:
print("Please install the required packages: pip install google-genera... | ykdojo/osh | 7 | OSH - Automate 99% of your typing for free | Python | ykdojo | YK | Eventual |
gemini_tts_test.py | Python | #!/usr/bin/env python3
import argparse
import asyncio
import traceback
import os
import sys
import pyaudio
import websockets
from dotenv import load_dotenv
try:
from google import genai
from google.genai import types
except ImportError:
print("Please install the required packages: pip install google-gener... | ykdojo/osh | 7 | OSH - Automate 99% of your typing for free | Python | ykdojo | YK | Eventual |
image_clipboard_test.py | Python | #!/usr/bin/env python3
"""
Test for clipboard image operations.
Creates a simple colored rectangle, copies it to clipboard,
and verifies we can retrieve it.
"""
import platform
import copykitten
import time
from PIL import Image, ImageDraw
import io
import subprocess
import os
print(f"Running on: {platform.system()} ... | ykdojo/osh | 7 | OSH - Automate 99% of your typing for free | Python | ykdojo | YK | Eventual |
keyboard_handler.py | Python | #!/usr/bin/env python3
"""
Keyboard shortcut handler module for terminal applications
Provides keyboard shortcut detection and callback execution
"""
from pynput import keyboard
from pynput.keyboard import Controller, Key
class KeyboardShortcutHandler:
"""Handles keyboard shortcuts for terminal applications"""
... | ykdojo/osh | 7 | OSH - Automate 99% of your typing for free | Python | ykdojo | YK | Eventual |
reading_metrics_web.py | Python | #!/usr/bin/env python3
"""
Web visualization for reading metrics.
Provides a web dashboard to display text-to-speech conversion statistics.
"""
import os
import csv
import json
import threading
import random
from datetime import datetime, timedelta
from flask import Flask, render_template, jsonify, redirect, url_for
f... | ykdojo/osh | 7 | OSH - Automate 99% of your typing for free | Python | ykdojo | YK | Eventual |
recorders/__init__.py | Python | """
Recorders module for handling screen and audio recording
"""
# Import core functionality to make it available at package level
from recorders.utils import list_audio_devices, list_screen_devices, combine_audio_video
from recorders.recorder import record_audio, record_screen | ykdojo/osh | 7 | OSH - Automate 99% of your typing for free | Python | ykdojo | YK | Eventual |
recorders/recorder.py | Python | #!/usr/bin/env python3
"""
Core recording functions for screen and audio capture
"""
import ffmpeg
import sounddevice as sd
import soundfile as sf
import numpy as np
import time
# Import utility functions from utils module
from recorders.utils import list_audio_devices, list_screen_devices
def record_audio(output_fi... | ykdojo/osh | 7 | OSH - Automate 99% of your typing for free | Python | ykdojo | YK | Eventual |
recorders/recording_handler.py | Python | #!/usr/bin/env python3
"""
Recording handler module to manage audio and video recording sessions
"""
import os
import time
import threading
from audio_recorder import record_audio_only
from screen_audio_recorder import record_screen_and_audio
class RecordingSession:
"""Manages a recording session with audio and v... | ykdojo/osh | 7 | OSH - Automate 99% of your typing for free | Python | ykdojo | YK | Eventual |
recorders/utils.py | Python | #!/usr/bin/env python3
"""
Utility functions for recording devices
"""
import sounddevice as sd
import subprocess
import ffmpeg
def list_audio_devices():
"""List all available audio input devices"""
print("Available audio input devices:")
devices = sd.query_devices()
for i, device in enumerate(devices... | ykdojo/osh | 7 | OSH - Automate 99% of your typing for free | Python | ykdojo | YK | Eventual |
run.sh | Shell | #!/bin/bash
# Source the virtual environment directly
source "$(dirname "$0")/venv/bin/activate"
# Remind user about requirements
echo "Reminder: Install requirements with 'pip install -r requirements.txt' if needed"
# Check for portaudio
if command -v brew &> /dev/null && ! brew list portaudio &> /dev/null; then
... | ykdojo/osh | 7 | OSH - Automate 99% of your typing for free | Python | ykdojo | YK | Eventual |
run_clipboard_to_llm.sh | Shell | #!/bin/bash
# Source the environment activation script
source "$(dirname "$0")/activate_env.sh"
# Run the clipboard to LLM script
echo "Starting Clipboard to LLM with TTS..."
echo "Press Shift+Alt+A (Å) to read clipboard content with TTS"
echo "Press Ctrl+C to exit"
python clipboard_to_llm.py | ykdojo/osh | 7 | OSH - Automate 99% of your typing for free | Python | ykdojo | YK | Eventual |
run_with_env.sh | Shell | #!/bin/bash
# Check if .env file exists
if [ ! -f .env ]; then
echo ".env file not found!"
exit 1
fi
# Toggle comments on lines 3 and 4
awk '{
if (NR == 3 || NR == 4) {
if ($0 ~ /^#/) {
print substr($0, 2)
} else {
print "#" $0
}
} else {
print $... | ykdojo/osh | 7 | OSH - Automate 99% of your typing for free | Python | ykdojo | YK | Eventual |
screen_audio_recorder.py | Python | #!/usr/bin/env python3
"""
High-quality screen and audio recorder
Records screen with ffmpeg and audio with sounddevice separately,
then combines them for optimal quality
"""
import subprocess
import time
import os
import tempfile
import threading
import ffmpeg
# Import utility functions and core recording functions
... | ykdojo/osh | 7 | OSH - Automate 99% of your typing for free | Python | ykdojo | YK | Eventual |
scrollable_chat.py | Python | #!/usr/bin/env python3
import curses
import time
def main(stdscr):
# Initialize curses
curses.curs_set(0) # Hide cursor
stdscr.clear()
stdscr.refresh()
# Initialize colors
curses.start_color()
curses.use_default_colors()
curses.init_pair(1, 74, -1) # Light dusty blue for user me... | ykdojo/osh | 7 | OSH - Automate 99% of your typing for free | Python | ykdojo | YK | Eventual |
show_files.py | Python | #!/usr/bin/env python3
"""
Show contents of multiple files with clear formatting.
Usage:
python show_files.py file1.py file2.py file3.py | pbcopy
"""
import sys
import os
def show_file_content(file_path):
"""Display file path and content with clear formatting"""
try:
# Only process if file exists
... | ykdojo/osh | 7 | OSH - Automate 99% of your typing for free | Python | ykdojo | YK | Eventual |
speed_up_audio.py | Python | #!/usr/bin/env python3
import argparse
import librosa
import soundfile as sf
import os
def speed_up_audio(input_file, output_file=None, speed_factor=1.5, preserve_pitch=True):
"""
Speed up an audio file without changing the pitch.
Args:
input_file (str): Path to the input audio file
ou... | ykdojo/osh | 7 | OSH - Automate 99% of your typing for free | Python | ykdojo | YK | Eventual |
start_dashboards.sh | Shell | #!/bin/bash
# Script to launch both typing and reading metrics web dashboards in parallel
# This starts the typing metrics server on port 5050 and reading metrics on port 5051
# Determine the script directory
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "$SCRIPT_DIR"
# Activate the virtual envir... | ykdojo/osh | 7 | OSH - Automate 99% of your typing for free | Python | ykdojo | YK | Eventual |
start_reading_metrics_web.sh | Shell | #!/bin/bash
# Script to launch the reading metrics web dashboard
# This starts the web server on port 5051
# Determine the script directory
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "$SCRIPT_DIR"
# Activate the virtual environment if it exists
if [ -f "./venv/bin/activate" ]; then
echo "A... | ykdojo/osh | 7 | OSH - Automate 99% of your typing for free | Python | ykdojo | YK | Eventual |
start_typing_metrics_web.sh | Shell | #!/bin/bash
# Script to launch the typing metrics web dashboard
# This starts the web server on port 5050
# Determine the script directory
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "$SCRIPT_DIR"
# Activate the virtual environment if it exists
if [ -f "./venv/bin/activate" ]; then
echo "Ac... | ykdojo/osh | 7 | OSH - Automate 99% of your typing for free | Python | ykdojo | YK | Eventual |
templates/dashboard.html | HTML | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Typing Time Saved</title>
<link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-s... | ykdojo/osh | 7 | OSH - Automate 99% of your typing for free | Python | ykdojo | YK | Eventual |
templates/reading_dashboard.html | HTML | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Reading Time Saved</title>
<link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-... | ykdojo/osh | 7 | OSH - Automate 99% of your typing for free | Python | ykdojo | YK | Eventual |
terminal_ui.py | Python | #!/usr/bin/env python3
"""
Terminal UI module for curses-based interfaces.
Provides reusable UI components and display functions.
"""
import curses
def init_curses(stdscr):
"""Initialize curses environment"""
curses.noecho() # Don't echo keypresses
curses.cbreak() # React to keys instantly
stdscr.ke... | ykdojo/osh | 7 | OSH - Automate 99% of your typing for free | Python | ykdojo | YK | Eventual |
terminal_video_voice_recorder.py | Python | #!/usr/bin/env python3
"""
Terminal-based voice recording handler with simple UI
Uses curses for proper terminal management
"""
import curses
import threading
import time
import os
from keyboard_handler import KeyboardShortcutHandler
from terminal_ui import init_curses, cleanup_curses, display_screen_template
from re... | ykdojo/osh | 7 | OSH - Automate 99% of your typing for free | Python | ykdojo | YK | Eventual |
test_error_handling.py | Python | #!/usr/bin/env python3
import unittest
from unittest.mock import MagicMock
def test_error_handler():
"""
Simplified test function that mimics the error handling in recorder.py
"""
process = MagicMock()
process.returncode = 1
# Test case 1: Normal error with stderr
process.stderr = Magi... | ykdojo/osh | 7 | OSH - Automate 99% of your typing for free | Python | ykdojo | YK | Eventual |
test_typing_metrics.py | Python | #!/usr/bin/env python3
"""
Test script for typing metrics functionality.
Generates sample data and starts the web server.
"""
import os
import time
import random
from datetime import datetime, timedelta
from typing_metrics import record_transcription
from typing_metrics_web import start_web_server
def generate_sample... | ykdojo/osh | 7 | OSH - Automate 99% of your typing for free | Python | ykdojo | YK | Eventual |
transcription_handler.py | Python | #!/usr/bin/env python3
"""
Transcription handler for audio and video recordings.
Manages the transcription process and results presentation.
"""
import os
import threading
import time
from audio_transcription import transcribe_audio
from video_transcription import transcribe_video
from type_text import type_text
from ... | ykdojo/osh | 7 | OSH - Automate 99% of your typing for free | Python | ykdojo | YK | Eventual |
transcription_prompts.py | Python | #!/usr/bin/env python3
"""
Shared transcription prompts and utilities for Gemini AI transcription
"""
import os
def load_common_words():
"""
Load common words from the common_words.txt file
Returns:
list: List of common words to incorporate in prompts
"""
common_words = []
common_... | ykdojo/osh | 7 | OSH - Automate 99% of your typing for free | Python | ykdojo | YK | Eventual |
type_text.py | Python | #!/usr/bin/env python3
"""
Module for typing text at the cursor position.
Using clipboard-based approach with text-only preservation.
"""
import time
import sys
import platform
import traceback
from pynput.keyboard import Controller, Key, Listener
import copykitten
# Check if we're on macOS
is_macos = platform.system... | ykdojo/osh | 7 | OSH - Automate 99% of your typing for free | Python | ykdojo | YK | Eventual |
typing_metrics.py | Python | #!/usr/bin/env python3
"""
Simple typing metrics tracker module.
Records character and word counts from transcriptions.
"""
import os
import csv
from datetime import datetime
def ensure_csv_exists(csv_path):
"""
Create CSV file with headers if it doesn't exist
Args:
csv_path (str): Path to CS... | ykdojo/osh | 7 | OSH - Automate 99% of your typing for free | Python | ykdojo | YK | Eventual |
typing_metrics_web.py | Python | #!/usr/bin/env python3
"""
Web visualization for typing metrics.
Provides a simple web dashboard to display typing time saved statistics.
"""
import os
import csv
import json
import threading
from datetime import datetime, timedelta
from flask import Flask, render_template, jsonify
from collections import defaultdict
... | ykdojo/osh | 7 | OSH - Automate 99% of your typing for free | Python | ykdojo | YK | Eventual |
video_transcription.py | Python | #!/usr/bin/env python3
"""
Video transcription module for Gemini 2.0 Flash Thinking
Processes video files and returns transcribed text with minimal debug output
"""
import os
import sys
import base64
from dotenv import load_dotenv
import google.generativeai as genai
from transcription_prompts import get_video_transcri... | ykdojo/osh | 7 | OSH - Automate 99% of your typing for free | Python | ykdojo | YK | Eventual |
dashboard/server.js | JavaScript | const http = require('http');
const fs = require('fs');
const path = require('path');
const { execSync, spawn } = require('child_process');
// SSE clients
const sseClients = new Set();
// Watch Docker events for safeclaw containers
let dockerEvents;
function startDockerEvents() {
dockerEvents = spawn('docker', ['... | ykdojo/safeclaw | 90 | The easiest way to run multiple Claude Code sessions, each in its own container, with a dashboard to manage them all. Quick setup with battle-tested sensible defaults and skills. | HTML | ykdojo | YK | Eventual |
dashboard/template.html | HTML | <!DOCTYPE html>
<html>
<head>
<title>SafeClaw</title>
<style>
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, monospace;
background: #141210;
color: #c9c5c0;
padding: 16px clamp(... | ykdojo/safeclaw | 90 | The easiest way to run multiple Claude Code sessions, each in its own container, with a dashboard to manage them all. Quick setup with battle-tested sensible defaults and skills. | HTML | ykdojo | YK | Eventual |
scripts/build.sh | Shell | #!/bin/bash
# Build the safeclaw image and remove stale container
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
PROJECT_DIR="$(dirname "$SCRIPT_DIR")"
CONTAINER_NAME="safeclaw"
echo "Building image..."
docker build -t safeclaw "$PROJECT_DIR" || exit 1
# Remove old container so run.sh creates a fresh one from the new i... | ykdojo/safeclaw | 90 | The easiest way to run multiple Claude Code sessions, each in its own container, with a dashboard to manage them all. Quick setup with battle-tested sensible defaults and skills. | HTML | ykdojo | YK | Eventual |
scripts/manage-env.js | JavaScript | #!/usr/bin/env node
// Manage SafeClaw environment variables
const fs = require('fs');
const path = require('path');
const { select, input, password, confirm } = require('@inquirer/prompts');
const SECRETS_DIR = path.join(
process.env.XDG_CONFIG_HOME || path.join(process.env.HOME, '.config'),
'safeclaw',
'.secr... | ykdojo/safeclaw | 90 | The easiest way to run multiple Claude Code sessions, each in its own container, with a dashboard to manage them all. Quick setup with battle-tested sensible defaults and skills. | HTML | ykdojo | YK | Eventual |
scripts/new.sh | Shell | #!/bin/bash
# Create a new session (called from dashboard UI)
# Checks for required tokens before calling run.sh
SECRETS_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/safeclaw/.secrets"
# Check for required token
if [ ! -f "$SECRETS_DIR/CLAUDE_CODE_OAUTH_TOKEN" ]; then
echo "ERROR: No Claude Code token found." >&2
e... | ykdojo/safeclaw | 90 | The easiest way to run multiple Claude Code sessions, each in its own container, with a dashboard to manage them all. Quick setup with battle-tested sensible defaults and skills. | HTML | ykdojo | YK | Eventual |
scripts/run.sh | Shell | #!/bin/bash
# Start/reuse container, inject auth tokens, start ttyd web terminal
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
SAFECLAW_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/safeclaw"
SECRETS_DIR="$SAFECLAW_DIR/.secrets"
SESSIONS_DIR="$SAFECLAW_DIR/sessions"
SESSION_NAME=""
VOLUME_MOUNT=""
NO_OPEN=false
QUERY=""
# Par... | ykdojo/safeclaw | 90 | The easiest way to run multiple Claude Code sessions, each in its own container, with a dashboard to manage them all. Quick setup with battle-tested sensible defaults and skills. | HTML | ykdojo | YK | Eventual |
scripts/setup-gemini.sh | Shell | #!/bin/bash
# Set up Gemini CLI API key for SafeClaw
SECRETS_DIR="$HOME/.config/safeclaw/.secrets"
TOKEN_FILE="$SECRETS_DIR/GEMINI_API_KEY"
mkdir -p "$SECRETS_DIR"
echo "Gemini CLI Setup"
echo "================"
echo ""
echo "Get your API key from: https://aistudio.google.com/apikey"
echo ""
read -p "Paste your Gemi... | ykdojo/safeclaw | 90 | The easiest way to run multiple Claude Code sessions, each in its own container, with a dashboard to manage them all. Quick setup with battle-tested sensible defaults and skills. | HTML | ykdojo | YK | Eventual |
scripts/setup-slack.sh | Shell | #!/bin/bash
# Set up Slack integration for SafeClaw
SECRETS_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/safeclaw/.secrets"
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
MANIFEST="$SCRIPT_DIR/../setup/slack-manifest.json"
echo ""
echo "=== Slack Setup ==="
echo ""
echo "Setup method:"
echo " [Q] Quick - create app from ma... | ykdojo/safeclaw | 90 | The easiest way to run multiple Claude Code sessions, each in its own container, with a dashboard to manage them all. Quick setup with battle-tested sensible defaults and skills. | HTML | ykdojo | YK | Eventual |
setup/tools/slack-read.js | JavaScript | #!/usr/bin/env node
// Slack Read-Only Tool
// Usage: node slack-read.js <command> [args]
const { WebClient } = require('@slack/web-api');
// Get token from env var
function getToken(envVarName = 'SLACK_TOKEN') {
const token = process.env[envVarName];
if (!token) {
console.error(`${envVarName} env va... | ykdojo/safeclaw | 90 | The easiest way to run multiple Claude Code sessions, each in its own container, with a dashboard to manage them all. Quick setup with battle-tested sensible defaults and skills. | HTML | ykdojo | YK | Eventual |
setup/ttyd-wrapper.sh | Shell | #!/bin/bash
# Start tmux session with claude
# Attach to existing session, or create new one with claude
if tmux has-session -t main 2>/dev/null; then
exec tmux attach -t main
else
# Create session
tmux -f /dev/null new -d -s main
tmux set -t main status off
tmux set -t main mouse on
# Start c... | ykdojo/safeclaw | 90 | The easiest way to run multiple Claude Code sessions, each in its own container, with a dashboard to manage them all. Quick setup with battle-tested sensible defaults and skills. | HTML | ykdojo | YK | Eventual |
index.html | HTML | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Simple Invaders</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="game-container">
<div id="gameInfo">
<div id="s... | ykdojo/space-invaders | 2 | JavaScript | ykdojo | YK | Eventual | |
script.js | JavaScript | const canvas = document.getElementById('gameCanvas');
const scoreBoard = document.getElementById('scoreBoard');
const stageDisplay = document.getElementById('stageDisplay');
const ctx = canvas.getContext('2d');
// --- Game Configuration ---
const canvasWidth = 800;
const canvasHeight = 600;
canvas.width = canvasWidth;... | ykdojo/space-invaders | 2 | JavaScript | ykdojo | YK | Eventual | |
style.css | CSS | body {
margin: 0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background-color: #f0f0f0; /* Light grey background */
}
.game-container {
position: relative;
}
canvas {
border: 1px solid #ccc; /* Subtle border */
background-color: #ffffff; /* White ca... | ykdojo/space-invaders | 2 | JavaScript | ykdojo | YK | Eventual | |
jest.config.js | JavaScript | export default {
preset: 'ts-jest/presets/js-with-ts-esm',
testEnvironment: 'node',
transform: {
'^.+\\.tsx?$': ['ts-jest', {
useESM: true,
tsconfig: 'tsconfig.test.json'
}]
},
extensionsToTreatAsEsm: ['.ts', '.tsx'],
moduleNameMapper: {
'^(\\.{1,2}/.*)\\.js$': '$1'
},
testTimeou... | ykdojo/turing | 0 | An open source alternative to Claude Code | TypeScript | ykdojo | YK | Eventual |
src/chat-cli.tsx | TypeScript (TSX) | #!/usr/bin/env node
import React from 'react';
import { render, Box, Text } from 'ink';
import { ChatApp } from './chat-ui.js';
// Check if stdin is TTY (interactive terminal)
if (process.stdin.isTTY) {
// Use standard render with no options for interactive terminals
render(<ChatApp />);
} else {
// Fallback for... | ykdojo/turing | 0 | An open source alternative to Claude Code | TypeScript | ykdojo | YK | Eventual |
src/chat-controller.ts | TypeScript | import { useState } from 'react';
import { GeminiAPI } from './gemini-api.js';
import { formatMessagesForGeminiAPI, Message as FormatterMessage } from './utils/message-formatter.js';
import { executeCommand } from './services/terminal-service.js';
export type Message = FormatterMessage;
// System instruction for the ... | ykdojo/turing | 0 | An open source alternative to Claude Code | TypeScript | ykdojo | YK | Eventual |
src/chat-ui.tsx | TypeScript (TSX) | import React from 'react';
import { Box, Text, useInput, useApp } from 'ink';
import Spinner from 'ink-spinner';
import { useChatController } from './chat-controller.js';
export const ChatApp = () => {
const {
messages,
inputText,
handleEnterKey,
appendToInputText,
backspaceInputText
} = use... | ykdojo/turing | 0 | An open source alternative to Claude Code | TypeScript | ykdojo | YK | Eventual |
src/gemini-api.ts | TypeScript | import { config } from 'dotenv';
import { GoogleGenAI } from '@google/genai';
import fs from 'node:fs';
import mime from 'mime-types';
import { getAvailableTools, terminalCommandTool } from './tools.js';
// Initialize environment variables
config();
// API key verification
const getApiKey = (): string => {
const ap... | ykdojo/turing | 0 | An open source alternative to Claude Code | TypeScript | ykdojo | YK | Eventual |
src/services/terminal-service.ts | TypeScript | import { exec } from 'child_process';
import { GeminiAPI } from '../gemini-api.js';
// Function to execute a terminal command and handle function call loop
export function executeCommand(
command: string,
messageIndex: number,
callIndex: number,
chatSession: any,
geminiApi: GeminiAPI,
setMessages: (call... | ykdojo/turing | 0 | An open source alternative to Claude Code | TypeScript | ykdojo | YK | Eventual |
src/tools.ts | TypeScript | export interface ToolDefinition {
functionDeclarations: FunctionDeclaration[];
}
export interface FunctionDeclaration {
name: string;
description: string;
parameters: {
type: string;
properties: Record<string, any>;
required: string[];
};
}
// Terminal command tool definition
export const termin... | ykdojo/turing | 0 | An open source alternative to Claude Code | TypeScript | ykdojo | YK | Eventual |
src/utils/message-formatter.ts | TypeScript | // Utility for formatting messages for the Gemini API
type MessagePart = {
text: string;
};
export interface FormattedMessage {
role: 'user' | 'model';
parts: MessagePart[];
}
export interface Message {
role: 'user' | 'assistant' | 'system';
content: string;
isLoading?: boolean;
functionCalls?: Array<{... | ykdojo/turing | 0 | An open source alternative to Claude Code | TypeScript | ykdojo | YK | Eventual |
tests/chat-controller.test.ts | TypeScript | /**
* @jest-environment node
*/
import { GeminiAPI } from '../src/gemini-api.js';
import { jest } from '@jest/globals';
// Define types for mocking purposes to resolve TypeScript errors
type MockResponse = {
response: {
text: () => string;
candidates?: Array<{
content: {
parts: Array<{
... | ykdojo/turing | 0 | An open source alternative to Claude Code | TypeScript | ykdojo | YK | Eventual |
tests/chat-ui.test.tsx | TypeScript (TSX) | /**
* @jest-environment node
*/
import React from 'react';
import { render } from 'ink-testing-library';
import { jest } from '@jest/globals';
// We need to test the implementation of line 19:
// if (key.ctrl && input === 'c') { exit(); return; }
// Create our mocks before importing
const mockExit = jest.fn();
let ... | ykdojo/turing | 0 | An open source alternative to Claude Code | TypeScript | ykdojo | YK | Eventual |
tests/gemini-api-function-call.test.ts | TypeScript | import 'dotenv/config';
import { GeminiAPI } from '../src/gemini-api';
// Don't use jest.setTimeout here; it's set in the config
describe('GeminiAPI Function Calling Tests', () => {
test('should handle basic function calling setup with custom tool', async () => {
// Initialize the Gemini API with function ca... | ykdojo/turing | 0 | An open source alternative to Claude Code | TypeScript | ykdojo | YK | Eventual |
tests/gemini-api-system-instructions.test.ts | TypeScript | /**
* @jest-environment node
*/
import { GeminiAPI } from '../src/gemini-api';
import dotenv from 'dotenv';
// Load environment variables from .env file
dotenv.config();
// Skip all tests if API key isn't set
const hasApiKey = !!process.env.GEMINI_API_KEY;
describe('GeminiAPI System Instructions Test', () => {
... | ykdojo/turing | 0 | An open source alternative to Claude Code | TypeScript | ykdojo | YK | Eventual |
tests/gemini-function-call.test.ts | TypeScript | import { GoogleGenAI, Type } from '@google/genai';
import 'dotenv/config';
import { GeminiAPI } from '../src/gemini-api';
// Don't use jest.setTimeout here; it's set in the config
// Using a longer timeout is handled in jest.config.js
describe('Gemini Function Calling Tests', () => {
test('should make a direct ... | ykdojo/turing | 0 | An open source alternative to Claude Code | TypeScript | ykdojo | YK | Eventual |
tests/gemini-system-instructions.test.ts | TypeScript | /**
* @jest-environment node
*/
import { GoogleGenAI } from '@google/genai';
import dotenv from 'dotenv';
// Load environment variables from .env file
dotenv.config();
// Skip all tests if API key isn't set
const hasApiKey = !!process.env.GEMINI_API_KEY;
describe('Gemini API System Instructions Test', () => {
... | ykdojo/turing | 0 | An open source alternative to Claude Code | TypeScript | ykdojo | YK | Eventual |
tests/gemini-terminal-command.test.ts | TypeScript | import 'dotenv/config';
import { GeminiAPI } from '../src/gemini-api';
describe('Gemini Terminal Command Function Tests', () => {
test('should handle terminal command function configuration', async () => {
// Initialize the Gemini API with function calling enabled
const gemini = new GeminiAPI('gemini-2.0-... | ykdojo/turing | 0 | An open source alternative to Claude Code | TypeScript | ykdojo | YK | Eventual |
tests/gemini.test.ts | TypeScript | import { GeminiAPI } from '../src/gemini-api.js';
// Don't use jest.setTimeout here; it's set in the config
describe('Gemini API Tests', () => {
let gemini: GeminiAPI;
beforeAll(() => {
// Initialize the API before all tests
gemini = new GeminiAPI("gemini-2.0-flash-lite");
});
test('API should succe... | ykdojo/turing | 0 | An open source alternative to Claude Code | TypeScript | ykdojo | YK | Eventual |
tests/message-formatter.test.ts | TypeScript | /**
* @jest-environment node
*/
import { formatMessagesForGeminiAPI, Message } from '../src/utils/message-formatter';
describe('Message Formatter Utility', () => {
test('should format regular messages correctly', () => {
const messages: Message[] = [
{ role: 'user', content: 'Hello' },
{ role: 'ass... | ykdojo/turing | 0 | An open source alternative to Claude Code | TypeScript | ykdojo | YK | Eventual |
tests/terminal-service.test.ts | TypeScript | /**
* @jest-environment node
*/
import { jest } from '@jest/globals';
import { GeminiAPI } from '../src/gemini-api.js';
import { executeCommand } from '../src/services/terminal-service.js';
// Import after mocking
import * as childProcess from 'child_process';
// Create direct mock functions
const mockExec = jest.fn... | ykdojo/turing | 0 | An open source alternative to Claude Code | TypeScript | ykdojo | YK | Eventual |
apps/expo/app.config.ts | TypeScript | import type { ConfigContext, ExpoConfig } from "expo/config";
export default ({ config }: ConfigContext): ExpoConfig => ({
...config,
name: "expo",
slug: "expo",
scheme: "expo",
version: "0.1.0",
orientation: "portrait",
icon: "./assets/icon-light.png",
userInterfaceStyle: "automatic",
updates: {
... | ymc9/my-t3-turbo | 0 | TypeScript | ymc9 | Yiming Cao | zenstackhq | |
apps/expo/babel.config.js | JavaScript | /** @type {import("@babel/core").ConfigFunction} */
module.exports = (api) => {
api.cache(true);
return {
presets: [
["babel-preset-expo", { jsxImportSource: "nativewind" }],
"nativewind/babel",
],
plugins: ["react-native-reanimated/plugin"],
};
};
| ymc9/my-t3-turbo | 0 | TypeScript | ymc9 | Yiming Cao | zenstackhq | |
apps/expo/eslint.config.mjs | JavaScript | import baseConfig from "@acme/eslint-config/base";
import reactConfig from "@acme/eslint-config/react";
/** @type {import('typescript-eslint').Config} */
export default [
{
ignores: [".expo/**", "expo-plugins/**"],
},
...baseConfig,
...reactConfig,
];
| ymc9/my-t3-turbo | 0 | TypeScript | ymc9 | Yiming Cao | zenstackhq | |
apps/expo/index.ts | TypeScript | import "expo-router/entry";
| ymc9/my-t3-turbo | 0 | TypeScript | ymc9 | Yiming Cao | zenstackhq | |
apps/expo/metro.config.js | JavaScript | // Learn more: https://docs.expo.dev/guides/monorepos/
const { getDefaultConfig } = require("expo/metro-config");
const { FileStore } = require("metro-cache");
const { withNativeWind } = require("nativewind/metro");
const path = require("node:path");
const config = withTurborepoManagedCache(
withNativeWind(getDefau... | ymc9/my-t3-turbo | 0 | TypeScript | ymc9 | Yiming Cao | zenstackhq | |
apps/expo/nativewind-env.d.ts | TypeScript | /// <reference types="nativewind/types" />
// NOTE: This file should not be edited and should be committed with your source code. It is generated by NativeWind.
| ymc9/my-t3-turbo | 0 | TypeScript | ymc9 | Yiming Cao | zenstackhq | |
apps/expo/src/app/_layout.tsx | TypeScript (TSX) | import { Stack } from "expo-router";
import { StatusBar } from "expo-status-bar";
import { useColorScheme } from "nativewind";
import { queryClient } from "~/utils/api";
import "../styles.css";
import { QueryClientProvider } from "@tanstack/react-query";
// This is the main layout of the app
// It wraps your pages ... | ymc9/my-t3-turbo | 0 | TypeScript | ymc9 | Yiming Cao | zenstackhq | |
apps/expo/src/app/index.tsx | TypeScript (TSX) | import React, { useState } from "react";
import { Button, Pressable, Text, TextInput, View } from "react-native";
import { SafeAreaView } from "react-native-safe-area-context";
import { Link, Stack } from "expo-router";
import { LegendList } from "@legendapp/list";
import { useMutation, useQuery, useQueryClient } from ... | ymc9/my-t3-turbo | 0 | TypeScript | ymc9 | Yiming Cao | zenstackhq | |
apps/expo/src/app/post/[id].tsx | TypeScript (TSX) | import { SafeAreaView, Text, View } from "react-native";
import { Stack, useGlobalSearchParams } from "expo-router";
import { useQuery } from "@tanstack/react-query";
import { trpc } from "~/utils/api";
export default function Post() {
const { id } = useGlobalSearchParams();
if (!id || typeof id !== "string") thr... | ymc9/my-t3-turbo | 0 | TypeScript | ymc9 | Yiming Cao | zenstackhq | |
apps/expo/src/styles.css | CSS | @tailwind base;
@tailwind components;
@tailwind utilities;
:root {
--background: 0 0% 100%;
--foreground: 240 10% 3.9%;
--card: 0 0% 100%;
--card-foreground: 240 10% 3.9%;
--popover: 0 0% 100%;
--popover-foreground: 240 10% 3.9%;
--primary: 327 66% 69%;
--primary-foreground: 337 65.5% 17.1%;
--second... | ymc9/my-t3-turbo | 0 | TypeScript | ymc9 | Yiming Cao | zenstackhq | |
apps/expo/src/utils/api.tsx | TypeScript (TSX) | import { QueryClient } from "@tanstack/react-query";
import { createTRPCClient, httpBatchLink, loggerLink } from "@trpc/client";
import { createTRPCOptionsProxy } from "@trpc/tanstack-react-query";
import superjson from "superjson";
import type { AppRouter } from "@acme/api";
import { authClient } from "./auth";
impo... | ymc9/my-t3-turbo | 0 | TypeScript | ymc9 | Yiming Cao | zenstackhq | |
apps/expo/src/utils/auth.ts | TypeScript | import * as SecureStore from "expo-secure-store";
import { expoClient } from "@better-auth/expo/client";
import { createAuthClient } from "better-auth/react";
import { getBaseUrl } from "./base-url";
console.log("getBaseUrl", getBaseUrl());
export const authClient = createAuthClient({
baseURL: getBaseUrl(),
plug... | ymc9/my-t3-turbo | 0 | TypeScript | ymc9 | Yiming Cao | zenstackhq | |
apps/expo/src/utils/base-url.ts | TypeScript | import Constants from "expo-constants";
/**
* Extend this function when going to production by
* setting the baseUrl to your production API URL.
*/
export const getBaseUrl = () => {
/**
* Gets the IP address of your host-machine. If it cannot automatically find it,
* you'll have to manually set it. NOTE: Po... | ymc9/my-t3-turbo | 0 | TypeScript | ymc9 | Yiming Cao | zenstackhq | |
apps/expo/src/utils/session-store.ts | TypeScript | import * as SecureStore from "expo-secure-store";
const key = "session_token";
export const getToken = () => SecureStore.getItem(key);
export const deleteToken = () => SecureStore.deleteItemAsync(key);
export const setToken = (v: string) => SecureStore.setItem(key, v);
| ymc9/my-t3-turbo | 0 | TypeScript | ymc9 | Yiming Cao | zenstackhq | |
apps/expo/tailwind.config.ts | TypeScript | import type { Config } from "tailwindcss";
// @ts-expect-error - no types
import nativewind from "nativewind/preset";
import baseConfig from "@acme/tailwind-config/native";
export default {
content: ["./src/**/*.{ts,tsx}"],
presets: [baseConfig, nativewind],
} satisfies Config;
| ymc9/my-t3-turbo | 0 | TypeScript | ymc9 | Yiming Cao | zenstackhq | |
apps/nextjs/eslint.config.js | JavaScript | import baseConfig, { restrictEnvAccess } from "@acme/eslint-config/base";
import nextjsConfig from "@acme/eslint-config/nextjs";
import reactConfig from "@acme/eslint-config/react";
/** @type {import('typescript-eslint').Config} */
export default [
{
ignores: [".next/**"],
},
...baseConfig,
...reactConfig,... | ymc9/my-t3-turbo | 0 | TypeScript | ymc9 | Yiming Cao | zenstackhq | |
apps/nextjs/next.config.js | JavaScript | import { createJiti } from "jiti";
const jiti = createJiti(import.meta.url);
// Import env files to validate at build time. Use jiti so we can load .ts files in here.
await jiti.import("./src/env");
/** @type {import("next").NextConfig} */
const config = {
/** Enables hot reloading for local packages without a bui... | ymc9/my-t3-turbo | 0 | TypeScript | ymc9 | Yiming Cao | zenstackhq | |
apps/nextjs/postcss.config.cjs | JavaScript | module.exports = {
plugins: {
tailwindcss: {},
},
};
| ymc9/my-t3-turbo | 0 | TypeScript | ymc9 | Yiming Cao | zenstackhq | |
apps/nextjs/src/app/_components/auth-showcase.tsx | TypeScript (TSX) | import { headers } from "next/headers";
import { redirect } from "next/navigation";
import { Button } from "@acme/ui/button";
import { auth, getSession } from "~/auth/server";
export async function AuthShowcase() {
const session = await getSession();
if (!session) {
return (
<form>
<Button
... | ymc9/my-t3-turbo | 0 | TypeScript | ymc9 | Yiming Cao | zenstackhq | |
apps/nextjs/src/app/_components/posts.tsx | TypeScript (TSX) | "use client";
import {
useMutation,
useQueryClient,
useSuspenseQuery,
} from "@tanstack/react-query";
import type { RouterOutputs } from "@acme/api";
import { CreatePostSchema } from "@acme/db/schema";
import { cn } from "@acme/ui";
import { Button } from "@acme/ui/button";
import {
Form,
FormControl,
For... | ymc9/my-t3-turbo | 0 | TypeScript | ymc9 | Yiming Cao | zenstackhq | |
apps/nextjs/src/app/api/auth/[...all]/route.ts | TypeScript | import { auth } from "~/auth/server";
export const GET = auth.handler;
export const POST = auth.handler;
| ymc9/my-t3-turbo | 0 | TypeScript | ymc9 | Yiming Cao | zenstackhq | |
apps/nextjs/src/app/api/trpc/[trpc]/route.ts | TypeScript | import type { NextRequest } from "next/server";
import { fetchRequestHandler } from "@trpc/server/adapters/fetch";
import { appRouter, createTRPCContext } from "@acme/api";
import { auth } from "~/auth/server";
/**
* Configure basic CORS headers
* You should extend this to match your needs
*/
const setCorsHeaders... | ymc9/my-t3-turbo | 0 | TypeScript | ymc9 | Yiming Cao | zenstackhq | |
apps/nextjs/src/app/globals.css | CSS | @tailwind base;
@tailwind components;
@tailwind utilities;
@layer base {
:root {
--background: 0 0% 100%;
--foreground: 240 10% 3.9%;
--card: 0 0% 100%;
--card-foreground: 240 10% 3.9%;
--popover: 0 0% 100%;
--popover-foreground: 240 10% 3.9%;
--primary: 327 66% 69%;
--primary-foregro... | ymc9/my-t3-turbo | 0 | TypeScript | ymc9 | Yiming Cao | zenstackhq | |
apps/nextjs/src/app/layout.tsx | TypeScript (TSX) | import type { Metadata, Viewport } from "next";
import { Geist, Geist_Mono } from "next/font/google";
import { cn } from "@acme/ui";
import { ThemeProvider, ThemeToggle } from "@acme/ui/theme";
import { Toaster } from "@acme/ui/toast";
import { TRPCReactProvider } from "~/trpc/react";
import "~/app/globals.css";
im... | ymc9/my-t3-turbo | 0 | TypeScript | ymc9 | Yiming Cao | zenstackhq | |
apps/nextjs/src/app/page.tsx | TypeScript (TSX) | import { Suspense } from "react";
import { HydrateClient, prefetch, trpc } from "~/trpc/server";
import { AuthShowcase } from "./_components/auth-showcase";
import {
CreatePostForm,
PostCardSkeleton,
PostList,
} from "./_components/posts";
export default function HomePage() {
prefetch(trpc.post.all.queryOptio... | ymc9/my-t3-turbo | 0 | TypeScript | ymc9 | Yiming Cao | zenstackhq | |
apps/nextjs/src/auth/client.ts | TypeScript | import { createAuthClient } from "better-auth/react";
export const authClient = createAuthClient();
| ymc9/my-t3-turbo | 0 | TypeScript | ymc9 | Yiming Cao | zenstackhq | |
apps/nextjs/src/auth/server.ts | TypeScript | import "server-only";
import { cache } from "react";
import { headers } from "next/headers";
import { initAuth } from "@acme/auth";
import { env } from "~/env";
const baseUrl =
env.VERCEL_ENV === "production"
? `https://${env.VERCEL_PROJECT_PRODUCTION_URL}`
: env.VERCEL_ENV === "preview"
? `https://... | ymc9/my-t3-turbo | 0 | TypeScript | ymc9 | Yiming Cao | zenstackhq | |
apps/nextjs/src/env.ts | TypeScript | import { createEnv } from "@t3-oss/env-nextjs";
import { vercel } from "@t3-oss/env-nextjs/presets-zod";
import { z } from "zod/v4";
import { authEnv } from "@acme/auth/env";
export const env = createEnv({
extends: [authEnv(), vercel()],
shared: {
NODE_ENV: z
.enum(["development", "production", "test"])... | ymc9/my-t3-turbo | 0 | TypeScript | ymc9 | Yiming Cao | zenstackhq | |
apps/nextjs/src/trpc/query-client.ts | TypeScript | import {
defaultShouldDehydrateQuery,
QueryClient,
} from "@tanstack/react-query";
import SuperJSON from "superjson";
export const createQueryClient = () =>
new QueryClient({
defaultOptions: {
queries: {
// With SSR, we usually want to set some default staleTime
// above 0 to avoid refe... | ymc9/my-t3-turbo | 0 | TypeScript | ymc9 | Yiming Cao | zenstackhq | |
apps/nextjs/src/trpc/react.tsx | TypeScript (TSX) | "use client";
import type { QueryClient } from "@tanstack/react-query";
import { useState } from "react";
import { QueryClientProvider } from "@tanstack/react-query";
import {
createTRPCClient,
httpBatchStreamLink,
loggerLink,
} from "@trpc/client";
import { createTRPCContext } from "@trpc/tanstack-react-query";... | ymc9/my-t3-turbo | 0 | TypeScript | ymc9 | Yiming Cao | zenstackhq | |
apps/nextjs/src/trpc/server.tsx | TypeScript (TSX) | import type { TRPCQueryOptions } from "@trpc/tanstack-react-query";
import { cache } from "react";
import { headers } from "next/headers";
import { dehydrate, HydrationBoundary } from "@tanstack/react-query";
import { createTRPCOptionsProxy } from "@trpc/tanstack-react-query";
import type { AppRouter } from "@acme/api... | ymc9/my-t3-turbo | 0 | TypeScript | ymc9 | Yiming Cao | zenstackhq | |
apps/nextjs/tailwind.config.ts | TypeScript | import type { Config } from "tailwindcss";
import { fontFamily } from "tailwindcss/defaultTheme";
import baseConfig from "@acme/tailwind-config/web";
export default {
// We need to append the path to the UI package to the content array so that
// those classes are included correctly.
content: [...baseConfig.con... | ymc9/my-t3-turbo | 0 | TypeScript | ymc9 | Yiming Cao | zenstackhq | |
tooling/eslint/base.js | JavaScript | /// <reference types="./types.d.ts" />
import * as path from "node:path";
import { includeIgnoreFile } from "@eslint/compat";
import eslint from "@eslint/js";
import importPlugin from "eslint-plugin-import";
import turboPlugin from "eslint-plugin-turbo";
import tseslint from "typescript-eslint";
/**
* All packages t... | ymc9/my-t3-turbo | 0 | TypeScript | ymc9 | Yiming Cao | zenstackhq | |
tooling/eslint/nextjs.js | JavaScript | import nextPlugin from "@next/eslint-plugin-next";
/** @type {Awaited<import('typescript-eslint').Config>} */
export default [
{
files: ["**/*.ts", "**/*.tsx"],
plugins: {
"@next/next": nextPlugin,
},
rules: {
...nextPlugin.configs.recommended.rules,
...nextPlugin.configs["core-web-... | ymc9/my-t3-turbo | 0 | TypeScript | ymc9 | Yiming Cao | zenstackhq | |
tooling/eslint/react.js | JavaScript | import reactPlugin from "eslint-plugin-react";
import * as reactHooks from "eslint-plugin-react-hooks";
/** @type {Awaited<import('typescript-eslint').Config>} */
export default [
reactHooks.configs.recommended,
{
files: ["**/*.ts", "**/*.tsx"],
plugins: {
react: reactPlugin,
},
rules: {
... | ymc9/my-t3-turbo | 0 | TypeScript | ymc9 | Yiming Cao | zenstackhq | |
tooling/eslint/types.d.ts | TypeScript | /**
* Since the ecosystem hasn't fully migrated to ESLint's new FlatConfig system yet,
* we "need" to type some of the plugins manually :(
*/
declare module "eslint-plugin-import" {
import type { Linter, Rule } from "eslint";
export const configs: {
recommended: { rules: Linter.RulesRecord };
};
export... | ymc9/my-t3-turbo | 0 | TypeScript | ymc9 | Yiming Cao | zenstackhq | |
tooling/prettier/index.js | JavaScript | import { fileURLToPath } from "node:url";
/** @typedef {import("prettier").Config} PrettierConfig */
/** @typedef {import("prettier-plugin-tailwindcss").PluginOptions} TailwindConfig */
/** @typedef {import("@ianvs/prettier-plugin-sort-imports").PluginConfig} SortImportsConfig */
/** @type { PrettierConfig | SortImpo... | ymc9/my-t3-turbo | 0 | TypeScript | ymc9 | Yiming Cao | zenstackhq | |
tooling/tailwind/base.ts | TypeScript | import type { Config } from "tailwindcss";
export default {
darkMode: ["class"],
content: ["src/**/*.{ts,tsx}"],
theme: {
extend: {
colors: {
border: "hsl(var(--border))",
input: "hsl(var(--input))",
ring: "hsl(var(--ring))",
background: "hsl(var(--background))",
... | ymc9/my-t3-turbo | 0 | TypeScript | ymc9 | Yiming Cao | zenstackhq |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.