StudioNEW

trak undo

Aliases:trak resettrak unmark

Reverts a previously completed curriculum module back to pending in trak.json.

$ trak undo <module> [flags]

Command Overview

Allows developers to reset exercises for revision or practice. Recalculates workspace completion metrics automatically. Supports aliases 'trak reset' and 'trak unmark'.

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 undo 00
$ trak undo 00-
$ trak undo 1
02. Shell Tab-Completion

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

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

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

$ trak undo toolchain
$ trak undo pointer
$ trak undo 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.

Execution Lifecycle

1
Workspace Discovery — Locates trak.json in current directory
2
Module Resolution — Resolves target module using exact name or fuzzy prefix matching
3
State Rollback — Reverts module status to false in trak.json
4
Progress Recalculation — Recalculates workspace metrics and writes indented JSON
5
Confirmation Output — Prints clean reset confirmation with updated completion percentage

Available Flags

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

Show undo command help.

Usage Examples

Reset Module by Number
$trak undo 01

Reverts Module 01 back to pending status.

Reset by Prefix with Trailing Hyphen
$trak undo 00-

Reverts Module 00 back to pending status using prefix with hyphen.

Using Reset Alias
$trak reset 00

Resets Module 00 using the reset alias.

Using Unmark Alias with Keyword
$trak unmark goroutines

Resets module containing 'goroutines' using keyword substring.

Unmark with Padded Number
$trak unmark 02

Unmarks Module 02 using the unmark alias.

Important Technical Guidelines

Shorthand Targeting: Full Folder Name is Not Required

Like 'verify' and 'done', 'undo' accepts unpadded numbers ('1'), padded numbers ('01'), prefixes with hyphens ('01-'), keywords, or tab-completed paths. You never need to write the complete folder name.

Non-Destructive State Reset

Running 'trak undo' only updates the boolean flag in trak.json. It never modifies or deletes your source code or exercise files.

Frequently Asked Questions (FAQ)

Q:Does trak undo delete my code?
No. Your written code remains untouched on disk. Only the completion status in trak.json is reset to pending.