The following guide will show you how to connect a local model served with MLX to OpenCode for local coding.
1. Install OpenCode
curl -fsSL https://opencode.ai/install | bash
| # Create a new worktree and branch from within current git directory. | |
| ga() { | |
| if [[ -z "$1" ]]; then | |
| echo "Usage: ga [branch name]" | |
| exit 1 | |
| fi | |
| local branch="$1" | |
| local base="$(basename "$PWD")" | |
| local path="../${base}--${branch}" |
| description | tools | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|
Automated TDD workflow: write failing test, implement feature, verify passing test |
|
You are a Test-Driven Development automation expert. Your role is to execute the complete TDD cycle autonomously: Red → Green → Refactor.
🚨 NEVER write production code before writing a failing test.
You are an autonomous agent - please keep going until the user’s query is completely resolved, before ending your turn and yielding back to the user.
Your thinking should be thorough and so it's fine if it's very long. Whenever you need to think more deeply, use the @thinking tool. However, avoid unnecessary repetition and verbosity. You should be concise, but thorough.
You MUST iterate and keep going until the problem is solved.
You have everything you need to resolve this problem. I want you to fully solve this autonomously before coming back to me.
Only terminate your turn when you are sure that the problem is solved and all items have been checked off. Go through the problem step by step, and make sure to verify that your changes are correct. NEVER end your turn without having truly and completely solved the problem, and when you say you are going to make a tool call, make sure you ACTUALLY make the tool call, instead of ending your turn.
| // Types for the result object with discriminated union | |
| type Success<T> = { | |
| data: T; | |
| error: null; | |
| }; | |
| type Failure<E> = { | |
| data: null; | |
| error: E; | |
| }; |
| import { index, prefix, route } from "@react-router/dev/routes"; | |
| import { camelize, pluralize, singularize } from "inflected"; | |
| function createCrud(base = "./views") { | |
| /** | |
| * Create a CRUD route configuration. | |
| * @param name The name of the resource. It will be pluralized for the path. | |
| * @param options The options for the crud. | |
| * @param options.member Extra routes to add to each member. | |
| * @param options.collection Extra routes to add to the collection. |
| { | |
| // Config for VsCode Tailwind CSS IntelliSense extension for React | |
| // Type hints for className and class attributes | |
| "tailwindCSS.classAttributes": [ | |
| "class", | |
| "className", | |
| ], | |
| // Type hints for variables and properties ending with *className | |
| "tailwindCSS.experimental.classRegex": [ |
| #!/bin/bash | |
| # Script to update a firewall rule in a Hetzner Firewall with your current IP address. | |
| # Good if you would like to restrict SSH access only for your current IP address (secure). | |
| ################# | |
| # WARNING: This script will overwrite all rules in the firewall rules, so make sure you | |
| # added all the required rules. | |
| # I use a separate firewall rule just for SSH access. | |
| ################# |
| # SETUP # | |
| DOMAIN=example.com | |
| PROJECT_REPO="[email protected]:example.com/app.git" | |
| AMOUNT_KEEP_RELEASES=5 | |
| RELEASE_NAME=$(date +%s--%Y_%m_%d--%H_%M_%S) | |
| RELEASES_DIRECTORY=~/$DOMAIN/releases | |
| DEPLOYMENT_DIRECTORY=$RELEASES_DIRECTORY/$RELEASE_NAME | |
| # stop script on error signal (-e) and undefined variables (-u) |