Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Temicide/thcode/llms.txt

Use this file to discover all available pages before exploring further.

This guide takes you from a fresh clone to your first Thai coding request. By the end you will have built the CLI, passed the startup preflight gate, configured your Typhoon credential, and sent a task to the agent. Each step below maps to a concrete action you can verify in your terminal.
1

Check prerequisites

Before building, confirm both prerequisites are in place. Open a PowerShell 7 (pwsh.exe) session in Windows Terminal and run:
node --version
pwsh --version
Expected output (versions may be newer):
v24.0.0
PowerShell 7.6.0
You need Node.js 22 or newer and PowerShell 7.4 or newer (pwsh.exe). If either check fails, install the missing prerequisite before continuing:
  • Node.js: download from nodejs.org — Node.js 24 LTS is the recommended baseline.
  • PowerShell 7: install via WinGet with winget install Microsoft.PowerShell.
Do not use PowerShell 5.1, Git Bash, or WSL. The preflight gate explicitly blocks those environments and will exit with cause unsupported-shell before the interactive UI ever loads.
2

Build the CLI

Follow the Installation guide to build from source. In brief:
cd path\to\thcode\cli
npm install
npm run build
npm test
When npm test passes, the compiled entry point is at dist/index.js and the build is ready.
All tests run offline — no credentials are needed at this stage. A passing test run confirms that the compiled output is correct before you launch the interactive UI.
3

Run thcode and pass the preflight gate

Start the interactive UI from inside the repository or project directory you want thcode to work on:
node dist/index.js
Before Ink or React loads, a startup preflight gate runs synchronously. It executes five probes in order and exits with a typed result if any hard blocker is found:
The gate runs the following probes in sequence. The first hard failure short-circuits the rest.
#ProbeHard blocker?
1Platform + shellwin32/pwsh.exe or darwin/zsh; Git Bash, WSL, and cmd.exe are rejectedYes
2Node version — must be >=22Yes
3Output mode — must be an interactive TTY (not redirected/headless)Yes
4Local store posture — SQLite state directory availabilityBest-effort
5Credential store posture — OS credential store reachabilityBest-effort
If all probes pass and the output mode is interactive, the gate emits a one-line safe summary and falls through to main():
thcode: Supported: win32 / powershell.exe / v24.0.0
If a hard blocker fires, the gate emits a typed diagnostic to stderr and exits before importing Ink. For example, running under Node 20 produces:
thcode: Blocked: unsupported-node-version
cause: unsupported-node-version
recovery: Install Node.js 22 or newer (Node.js 24 LTS is the clean-machine baseline).
platform=win32 shell=powershell.exe node=v20.0.0 mode=interactive
Exit codes are deterministic: 0 (SUCCESS), 20 (BLOCKED), 30 (probe FAILED).
A successful preflight leaves you at the interactive UI. You will see the status bar, an empty transcript area, and the prompt composer at the bottom of the screen.
4

Configure your Typhoon credential

Typhoon is the primary reasoning provider. On first run (or whenever no key is stored), thcode will begin credential onboarding automatically.The onboarding flow:
  1. Prompts for your Typhoon API key — input is masked; the key is never written to disk as plaintext.
  2. Stores the key in the Windows OS credential store — the DPAPI-backed local storage means the key is tied to your Windows user account and not accessible to other users on the machine.
  3. Runs a health check — thcode contacts the Typhoon endpoint and confirms it is reachable and the key is valid before proceeding.
Keep your Typhoon key out of source control. thcode is designed to obtain keys through its credential-store interface rather than from configuration files, environment variables written to .env, logs, or session data.
Once the health check passes, the status bar will show the provider as active. You can re-inspect credential and provider state at any time with /status.
5

Send your first task

You are now in the interactive UI. New sessions open in Build mode with the Manual permission profile — the most conservative setting, where every mutating action requires your approval.Type a Thai or English coding request in the prompt composer and press Enter to submit:
เขียนฟังก์ชัน Python ที่รับรายการตัวเลขและคืนค่าผลรวม
Or in English:
Write a Python function that takes a list of numbers and returns their sum.
thcode will send the request to Typhoon, stream the reasoning back into the transcript, and — if it proposes any file changes — ask for your approval before applying them (in Manual mode).

Switching work modes

ActionEffect
Shift+TabCycles between Plan and Build
/planSwitches to read-only Plan mode
/buildSwitches back to mutating Build mode
Switch to Plan mode if you want thcode to inspect and describe without making any changes:
/plan

Useful commands

CommandPurpose
/helpList the supported command grammar
/statusShow current mode, provider, health, and context state
/planSwitch to read-only Plan work mode
/buildSwitch to mutating Build work mode
/permissionsInspect the active permission matrix
/modelsInspect the selected model configuration
/toolsInspect catalog and diagnostic controls
/contextInspect active model context
/usageShow cumulative provider usage
/rollbackInspect rollback checkpoints
/recoverInspect interrupted operations
Commands are parsed through a fixed grammar. Shell expansion, command substitution, and arbitrary executable dispatch are intentionally refused.
Check session status:
/status
The status output includes the active work mode, provider name and health, permission profile, and context state.Get help with the command grammar:
/help
Quit the session:Press Ctrl+C to exit cleanly.

What to Explore Next

Work Modes

Understand the full difference between Plan and Build mode, and when each is the right choice.

Permission Profiles

Move beyond Manual to Assisted or Full Access once you are comfortable with how thcode handles approvals.

AI for Thai Overview

Discover the catalogued Thai specialist services available for OCR, speech-to-text, and more.

Introduction

Go back to the full architecture overview: agent loop, provider registry, and project layout.

Build docs developers (and LLMs) love