Skip to content

Installation

Threat Model Spec can be used as a Go library or as a standalone CLI tool.

Requirements

  • Go 1.24 or later
  • D2 v0.6+ (for SVG rendering)

Go Library

Add the library to your Go project:

go get github.com/grokify/threat-model-spec

Import packages as needed:

import (
    "github.com/grokify/threat-model-spec/ir"
    "github.com/grokify/threat-model-spec/diagram"
    "github.com/grokify/threat-model-spec/stix"
    "github.com/grokify/threat-model-spec/stride"
    "github.com/grokify/threat-model-spec/killchain"
)

CLI Tool

Install the tms command-line tool:

go install github.com/grokify/threat-model-spec/cmd/tms@latest

Verify the installation:

tms version
# Output: tms version 0.1.0

D2 Installation

The --svg flag requires the D2 CLI to be installed. See d2lang.com for installation instructions.

brew install d2
curl -fsSL https://d2lang.com/install.sh | sh -s --
winget install terrastruct.d2
go install oss.terrastruct.com/d2@latest

Verify D2 installation:

d2 --version

Next Steps