Getting Started
Prerequisites
- Go 1.21+ (for building from source and SDK usage)
- A terminal (Linux / macOS / Windows)
Install the CLI
bash
go install github.com/cyberspacesec/request-mock-skills/cmd/request-mock@latestOr build from source:
bash
git clone https://github.com/cyberspacesec/request-mock-skills.git
cd request-mock-skills
go build -o request-mock ./cmd/request-mockVerify:
bash
request-mock version
# request-mock-skills 0.1.0Use the SDK
bash
go get github.com/cyberspacesec/request-mock-skillsgo
package main
import (
"fmt"
"github.com/cyberspacesec/request-mock-skills/pkg/mock"
)
func main() {
spec := mock.Login("https://api.example.com/login", "alice", "secret")
h, _ := mock.GenerateOne(spec)
curl, _ := mock.Export(h, mock.FormatCurl)
fmt.Println(curl)
}First run
bash
# JSON envelope (default, AI-friendly)
request-mock generate -X POST -u https://api.example.com/login \
-H 'Content-Type: application/json' \
-d '{"username":"alice","password":"secret"}'Output:
json
{"ok":true,"count":1,"format":"json","data":"..."}Add --raw for the bare payload (no envelope).
Lifecycle of a generated request
mermaid
stateDiagram-v2
[*] --> Spec: spec from flags / template
Spec --> Generate: GenerateOne / Generate
Generate --> Har: *har.Har built
Har --> Optional: transforms / batch?
Optional --> Har: derived specs regenerated
Har --> Export: Export / ExportToFile
Export --> [*]: curl / har / postman / ...Next
- CLI commands — every subcommand explained
- SDK guide — full API walkthrough
- Examples — runnable code