Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Lint & Tests

on:
push:
branches: [main]
pull_request:
branches: [main]

permissions:
contents: read

jobs:
lint_and_test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.24"

- name: Lint
uses: golangci/golangci-lint-action@v6
with:
version: latest

- name: Build
run: go build ./...

- name: Test
run: go test ./...
48 changes: 37 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ tyk --version
```bash
git clone https://github.com/sedkis/tyk-cli.git
cd tyk-cli
go build -o tyk .
go build -o tyk ./cmd/
sudo mv tyk /usr/local/bin/
```

Expand Down Expand Up @@ -121,6 +121,30 @@ tyk api delete <api-id> --yes # Delete without confirmation
tyk api convert --file api.yaml --format apidef # Convert OAS to Tyk format
```

### Policy Management
```bash
# Scaffold a new policy file
tyk policy init --id gold --name "Gold Plan"

# List policies
tyk policy list # Paginated table
tyk policy list --json # JSON output

# Get a policy (outputs CLI-schema YAML)
tyk policy get <policy-id> # YAML to stdout, summary to stderr
tyk policy get <policy-id> --json # JSON output

# Apply a policy (idempotent upsert — creates or updates)
tyk policy apply -f policy.yaml # From file
tyk policy apply -f - # From stdin

# Delete a policy
tyk policy delete <policy-id> # Interactive confirmation
tyk policy delete <policy-id> --yes # Skip confirmation
```

Policies use a human-friendly **CLI schema** with readable durations (`30d`, `1h`) and API selectors by name, listen path, or tags. The CLI converts to Dashboard wire format on apply. See the [Policy Guide](https://sedkis.github.io/tyk-cli/manage-policies) for the full YAML reference.

## ⚙️ Configuration

The Tyk CLI uses a unified environment/configuration system with the following precedence (highest to lowest):
Expand Down Expand Up @@ -196,7 +220,7 @@ cd tyk-cli
go mod download

# Build the CLI
go build -o tyk .
go build -o tyk ./cmd/

# Run tests
go test ./...
Expand All @@ -210,20 +234,22 @@ make test

```
tyk-cli/
├── cmd/ # CLI commands and subcommands
├── internal/ # Internal packages
│ ├── config/ # Configuration management
│ ├── client/ # HTTP client for Tyk Dashboard API
│ └── util/ # Utilities and helpers
├── pkg/ # Public packages (if any)
├── test/ # Integration tests
└── docs/ # Documentation
├── cmd/ # Entry point
├── internal/ # Internal packages
│ ├── cli/ # Cobra command definitions (api, policy, config)
│ ├── config/ # Configuration management
│ ├── client/ # HTTP client for Tyk Dashboard API
│ ├── policy/ # Policy domain logic (duration, validation, selectors, conversion)
│ ├── oas/ # OAS file handling
│ └── filehandler/ # File utilities
├── pkg/types/ # Shared types (API, policy, config)
├── test/ # Integration tests
└── docs/ # Documentation (Jekyll site)
```

## 🗺️ Roadmap

### 🔧 Other lifecycle objects
- Tyk Security Policies
- Tyk API Tokens / Credentials

### 🔧 Enhanced Features
Expand Down
Loading