trak init

Fetches the requested curriculum blueprint from trak-registry and recursively generates all directories, files, and trak.json on disk.

$ trak init <category>/<template> [flags]

Command Overview

When running 'trak init <category>/<template>', Trak performs category normalization (e.g. mapping 'mac' to 'macos'), validates the target template against the remote catalog, and builds the entire nested directory tree in the destination directory. If --path is omitted, it defaults to './learn-<template>' in the current working directory.

Execution Lifecycle

1
Resolves template URL: https://raw.githubusercontent.com/ndk123-web/trak-registry/main/templates/<category>/<template>.json
2
Parses JSON blueprint AST containing nested Node objects (directories & files)
3
Creates target directory and recursively writes all files with UTF-8 encoding
4
Stamps immutable trak.json manifest containing template ID, version, and UTC timestamp
5
Prints success banner with total resource count and recommended next steps

Available Flags

-p, --pathType: string • Default: ./learn-<template>

Target directory path where the workspace will be materialized.

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

Show help message and command examples.

Usage Examples

Default Current Directory Initialization
$trak init lang/go

Generates the Go workspace in ./learn-go in your current folder.

Custom Workspace Path
$trak init db/postgres --path ./my-postgres-lab

Materializes the PostgreSQL track inside ./my-postgres-lab.

Absolute Path on Windows/Linux
$trak init tool/docker -p D:/devops/docker-curriculum

Generates the container architecture lab at an absolute location.