trak
StudioNEW

trak verify

Aliases:trak testtrak check

Executes native language test suites against your local exercise code, validates test assertions, and automatically marks completed modules in trak.json.

$ trak verify [module] [-a, --all] [-d, --detail] [-l, --list]

Command Overview

The verify command runs automated test harnesses directly on your system using your installed compilers and runtime toolchains. If all tests for an exercise pass, Trak updates trak.json to mark the module complete, updates your workspace progress percentage, renders the visual progress bar, and recommends your next module. For hands-on laboratory tracks (Docker, Kubernetes, AWS, PostgreSQL, Linux, Git), Trak informs you that these tracks are architectural environments without compilers and guides you to use 'trak done <module>' instead.

Smart Module Resolution (No Full Names Required)

Prefix & Fuzzy Matching

Typing or copying full folder names like 00-setup-toolchain-and-first-program is completely optional. Trak CLI automatically resolves module targets through 4 multi-tier matching rules:

01. Numeric Prefix

Type unpadded numbers or numeric prefixes. Trak normalizes leading zeros and trailing hyphens.

$ trak verify 00
$ trak verify 00-
$ trak verify 1
02. Shell Tab-Completion

Terminal tab-completion with relative paths and trailing slashes (.\ or /) is cleanly sanitized.

$ trak verify .\00-setup*\
$ trak verify 01-var*/
03. Keyword Search

Type any distinct keyword or topic from the module name. Case-insensitive substring matching.

$ trak verify toolchain
$ trak verify pointer
$ trak verify memory
Ambiguity Guard: If a keyword matches multiple modules (for example, typing a generic query like test), Trak stops execution safely, displays all matching module candidates in your terminal, and prompts you to specify.

Supported Language Verification Runtimes

7 Automated Tracks

Trak automatically detects the required toolchains in your system PATH and executes native test harnesses with zero external configuration.

LanguageTrack PatternRequired BinaryTest RunnerArchitecture Note
Golang/gogogo test -v ./...Native Go test runner testing all packages in current module.
Pythonlang/pythonpython / python3unittest discoverZero-dependency test discovery using standard library unittest module.
Rustlang/rustcargocargo testInvokes cargo test using the module Cargo.toml manifest.
JavaScriptlang/javascript (lang/js)node / bunnode --testBuilt-in Node.js native test runner (Node 18+ / 20+), zero npm install needed.
TypeScriptlang/typescript (lang/ts)node / bunnode --testNative Node.js test runner with built-in TypeScript execution support.
Clang/cgcc / clanggcc / clangCompiles test harness and implementation using -Wall -Wextra -std=c11 -lm.
C++lang/cppg++ / clang++g++ / clang++Compiles test harness and implementation using -Wall -Wextra -std=c++17.

Subcommands

trak verify allowlistsAliases: allowlist, list, supported, runtimes

Displays a tabular matrix of all 7 supported programming language tracks, their native test runner commands, and checks your system PATH to report whether each compiler or interpreter is installed and ready.

$trak verify allowlists

Execution Lifecycle

1
Workspace Verification — Locates trak.json in current directory to confirm active learning workspace context.
2
Track Type Detection — Parses template ID to determine whether current track is a compiled language track ('lang') or architectural hands-on lab.
3
Hands-On Track Handling — If track is non-lang (Docker, AWS, PostgreSQL, Linux), explains that architectural labs use 'trak done <module>' instead of compilers.
4
Toolchain Resolution — Checks system PATH for the required compiler or interpreter (e.g. gcc, cargo, node, python, go). If missing, prompts installation instructions.
5
Module Target Selection — If argument is omitted, finds first pending module. If argument is provided, resolves by exact name, numeric prefix (e.g. '00', '1'), or keyword (e.g. 'escape'). If --all is passed, queues all modules.
6
Automated Execution — Runs native test harness directly on local filesystem with real-time CLI spinner.
7
Progress Synchronization — If tests pass, updates trak.json (module_breakdown = true), recalculates metrics, prints updated progress bar, and suggests next exercise via 'trak next'.
8
Diagnostics Output — If tests fail, prints failure alert. With --detail flag, streams compiler stderr and test failure assertion messages.

Available Flags

-a, --allType: boolean • Default: false

Verify all modules sequentially across the workspace and display full summary.

-d, --detailType: boolean • Default: false

Show detailed compiler and test assertion output when tests fail.

-l, --listType: boolean • Default: false

List all 7 supported language verification runtimes and local toolchain readiness.

-h, --helpType: boolean • Default: false

Show verify command synopsis, aliases, and usage examples.

Usage Examples

Verify Current Pending Exercise
$trak verify

Automatically detects and verifies the first incomplete module in your curriculum.

Verify Module by Numeric Prefix
$trak verify 00

Verifies Module 00 using numeric prefix matching.

Verify Module with Unpadded Number
$trak verify 2

Matches and runs tests for Module 02 automatically.

Verify by Prefix with Trailing Hyphen
$trak verify 00-

Matches Module 00 using prefix notation with trailing hyphen.

Verify Using Tab-Completed Folder Path
$trak verify .\00-setup-toolchain-and-first-program\

Trak automatically cleans trailing slashes, backslashes, and relative dots from shell autocompletion.

Verify by Keyword Substring
$trak verify toolchain

Matches module containing the keyword 'toolchain' in its directory name.

Verify with Detailed Failure Logs
$trak verify 01 --detail

Displays compiler errors and assertion failure output to diagnose test failures.

Verify All Modules Across Workspace
$trak verify --all

Runs tests on every module in the workspace sequentially and outputs pass/fail statistics.

Inspect Supported Runtimes & Toolchains
$trak verify allowlists

Checks which language compilers and test runners are installed on your machine.

Important Technical Guidelines

Full Folder Names are Never Required (Prefix & Fuzzy Matching)

You never need to copy or type full directory names. Trak resolves targets using multi-tier matching: '00', '00-', '1', relative paths with trailing slashes (.\00-setup*\), or keyword substrings ('toolchain', 'pointer', 'memory'). This same smart matching works across 'trak verify', 'trak done', and 'trak undo'.

Toolchain Availability in System PATH

Trak uses your local operating system toolchains rather than downloading massive bundled compilers. To verify Go exercises, install Go; for Rust, install Cargo; for JavaScript/TypeScript, install Node.js; for Python, install Python; and for C/C++, install GCC/Clang or MinGW. Run 'trak verify allowlists' to audit your machine.

Zero External Dependencies Design

All language test suites are authored using native built-in runners (node --test, standard python unittest, go test, cargo test, and native C/C++ assertion runners). Learners never need to run 'npm install' or configure third-party test frameworks to complete exercises.

Compiled Language Tracks vs Hands-On Architectural Labs

Automated test verification is designed for programming language tracks (lang/go, lang/rust, lang/python, lang/javascript, lang/typescript, lang/c, lang/cpp). Architectural tracks (tool/docker, db/postgres, cloud/aws, os/linux) are practical environments without compiler test suites; use 'trak done <module>' to mark these completed after following their README instructions.

Automatic State Persistence in trak.json

When a test succeeds, Trak immediately writes the completed status to trak.json with 2-space indentation. You do not need to manually run 'trak done' on verified code.

Frequently Asked Questions (FAQ)

Q:How does Trak verify my code?
Trak inspects trak.json in your current directory, detects the language track (e.g. lang/go, lang/c), looks up the required compiler in your PATH, and runs the test harness against your exercise files.
Q:What should I do if a test fails?
Run the command with the detail flag: 'trak verify <module> --detail' (or '-d'). Trak will print the compiler error or failed assertion details directly in your terminal, showing exactly which line or test case failed.
Q:What happens if a compiler or runtime is not installed on my computer?
Trak will display a clear 'Toolchain Not Found' notice specifying the required binary name and instructing you to install the corresponding language compiler. Run 'trak verify allowlists' at any time to see which runtimes are ready on your machine.
Q:Can I test all modules at the same time?
Yes, use 'trak verify --all' (or 'trak verify -a'). Trak will run tests sequentially through every module folder, show pass/fail results for each, update trak.json for passing modules, and print a final summary.
Q:How does module matching work?
You do not need to type the full module folder name. Trak supports exact names, padded numeric prefixes ('00', '01'), single digits ('1', '2'), and keyword substrings (e.g. 'trak verify pointers').
Q:Can I use trak verify on Docker, AWS, or PostgreSQL tracks?
No. Architectural and infrastructure tracks are hands-on configuration environments that do not have automated code compilers. If you run 'trak verify' on these tracks, Trak reminds you to complete the module steps and use 'trak done <module>' to record completion.
Q:Does trak verify modify my code?
No. Trak never modifies your exercise or starter code. It only compiles and executes your code against the module test harness, and updates completion status in trak.json.