gherkin-ai v3.2.2

gherkin-ai

npm version CI License: MIT

Spec-driven verification and governance for AI-assisted software delivery.

gherkin-ai turns requirements into executable Gherkin specifications and generates verified contracts and code for 20+ stacks. It gates changes on specification quality, drift and delivery risk, and controls what AI coding agents may change.

Adding it to an existing code base? Start with docs/ADOPTION.md; for the organization-wide rollout, docs/ENTERPRISE.md. Upgrading a generated project? See docs/MIGRATION-3.2.md, which covers every path from 2.x.

Installation

Requires Node.js 22.19 or later.

npm install -g gherkin-ai     # installs the `gherkin-ai` and `ghk` commands
npx -y gherkin-ai@3 --help    # or run without installing

Quick start

ghk init --yes -l typescript -f nestjs          # project configuration (gherkin-ai.config.json)
ghk create                                      # write a feature interactively, or:
ghk speckit import                              # convert Spec Kit specs/NNN-*/spec.md into features
ghk lint --threshold 80                         # specification quality gate (exit 4 below threshold)
ghk generate -f features/orders.feature         # contracts, domain kernel, tests, runtime
ghk implement -f features/orders.feature        # implementation prompt and context for your agent
ghk converge --threshold 80                     # spec-to-code convergence (exit 7 below threshold)
ghk risk --base origin/main --fail-on HIGH      # delivery risk of the change (exit 4 at HIGH or above)
ghk graph --trace OrderPlaced                   # requirement -> code -> tests

On an existing repository, without ghk init

The governance commands work on any repository with .feature files in features/ or specs/. They use the stack ghk detect finds, leave out what they cannot measure without gherkin-ai's own contracts (reported as n/a), and write nothing to the repository:

npx -y gherkin-ai@3 lint --threshold 80                      # exit 4 below the threshold, exit 2 if there is no feature
npx -y gherkin-ai@3 converge --openapi docs/openapi.json     # coverage against your own contract (exit 7 below 80)
npx -y gherkin-ai@3 risk --base origin/main --fail-on HIGH   # risk of the change
npx -y gherkin-ai@3 graph                                    # which commands the code and the tests name
npx -y gherkin-ai@3 firewall check "cat .env"                # DENY: exit 5

tests/golden/brownfield.test.ts runs exactly these on an Express and a Spring service. docs/ADOPTION.md has the CI job.

Connect your coding agent:

ghk mcp install                                 # least-privilege MCP server for Cursor, Claude Desktop and others
ghk firewall check --exec "npm test && git push"  # what an agent may write, run, reach and read

Capabilities

Capability Commands Status
Specification lint, semantic model, validation lint, validate, create, export Stable
Industry profiles: reference standards as lint rules, constraints and agent guidance industry, init --industry Stable
Code generation for the supported stacks init, generate, add, upgrade Stable
Runtime kernel: PostgreSQL, outbox/inbox over RabbitMQ, Pub/Sub, Service Bus or Kafka, sagas, OpenTelemetry generated with each backend Stable
Production image and deployment: Dockerfile, Terraform (AWS, GCP, Azure), Helm generated with each backend; deploy in the configuration Stable
Spec-to-code convergence and drift converge, diff, impact Stable
Agent prompts and context packages implement, context, skill Stable
MCP server (read-only by default) mcp Stable
Agent firewall (MCP, CLI agent loops, Claude Code hook) firewall Stable
Configuration layers, organization locks, provider policy config, login, auth Stable
Audit trail and SIEM export audit, audit export Stable
Delivery risk scoring risk, quality Stable
Traceability graph graph Stable
GitHub Spec Kit import / export speckit Stable
A/B benchmark of an agent with and without gherkin-ai bench Stable
Web Studio (local UI) web Stable
LLM repair loops verify --auto-fix, autopilot Experimental

The LLM repair loops write .patch proposals by default. --apply is refused in CI and on protected branches unless explicitly allowed, and every file goes through the agent firewall.

Supported stacks

Every stack below is built and tested in CI. A sample project is generated, built in the stack's official Docker image, and its generated test suite is run. For backends, the runtime integration suite also runs against real PostgreSQL and the stack's broker: RabbitMQ, the Pub/Sub and Service Bus emulators, or Kafka. Then the production image is started, its health probes must answer, and its traces must reach an OpenTelemetry collector.

Kind Stacks
Backends TypeScript (NestJS 11 or 12, Express 5; Prisma 6 or 7), C# (ASP.NET Core 8), Java and Kotlin (Spring Boot 4, Quarkus 3.40 LTS), Python (FastAPI, Django), Go (chi), PHP (Laravel 13), Ruby (Rails 8), Elixir (Phoenix), Rust (Axum)
Backends-for-frontend (stack.role: "bff") Express, NestJS 11 or 12, Spring Boot 4: a stateless gateway to the domain services, without database or events
Frontends and apps React 19, Vue 3, Angular 22, Next.js 16, React Native (Expo 57), Flutter, Phoenix LiveView
Brokers (runtime kernel) RabbitMQ (every backend; Amazon MQ, CloudAMQP), Google Cloud Pub/Sub (every backend), Azure Service Bus and Apache Kafka (JVM, TypeScript, .NET, Python, Go)
Contracts and infrastructure gRPC (Protobuf, buf-linted), GraphQL SDL, Terraform (AWS, GCP, Azure) and Helm (validated and linted), CI/CD for GitHub Actions, GitLab CI and Azure Pipelines, AWS CDK (opt-in, synthesized in CI)

Other combinations generate contracts and prompts only and are reported as experimental. ghk stacks lists the current matrix.

Maintenance tiers. Every stack above passes the same golden builds on every change. Core stacks (NestJS, Express, Spring Boot and Quarkus in Java and Kotlin, FastAPI, ASP.NET Core, Go; React, Vue, Angular) are kept current by the maintainers and get new runtime features first. Community stacks (Django, Laravel, Rails, Phoenix, Rust, Flutter, React Native, Next.js, Phoenix LiveView) are kept current through contributions. No new stacks are added in 3.x; the effort goes into governance and verification. The evidence behind these claims, and how to reproduce it, is in docs/EVALUATION_REPORT.md.

Industry standards

A project can opt in to the reference standards of its industry with industry.id (ghk init --industry banking, or ghk industry apply banking in an existing project). The standards become lint rules on every specification, constraints in the semantic model and the contracts (x-industry), rules in every agent prompt, and human-approval paths in the agent firewall.

Industry Reference standards
Banking & Financial Services BIAN Service Landscape 12.0, ISO 20022
Telecommunications TM Forum Open Digital Architecture, TM Forum Open APIs, SID
Manufacturing & Energy RAMI 4.0, IDTA Asset Administration Shell, ISA-95, Eclipse Sparkplug B
Healthcare HL7 FHIR R4 / R5, openEHR
Supply Chain & Logistics ASCM SCOR Digital Standard, GS1
Insurance ACORD Reference Architecture, ACORD data standards
Aviation & Travel IATA NDC, IATA ONE Order
Automotive & Software-Defined Vehicles AUTOSAR Adaptive, ISO 26262, ISO/SAE 21434

Each profile lists its rules, vocabulary, recommended architecture, compliance reminders and a sample feature in docs/INDUSTRIES.md. The compliance items are engineering guidance, not certification.

Automation contract

Exit code Meaning
0 success
2 usage error
3 invalid configuration
4 quality gate failed (lint, validate, risk --fail-on, …)
5 denied by policy (firewall, organization allow-lists, protected branch)
6 LLM provider or network failure
7 specification drift

With --json, stdout carries exactly one JSON document and diagnostics go to stderr. Details: docs/ENTERPRISE.md#5-automation-contract-exit-codes-and---json.

Known limitations

Documentation

Support and security

See SUPPORT.md for the support and versioning policy and for how to get help. Report vulnerabilities privately as described in SECURITY.md.

License

MIT. Published on npm by the fenner organization. Documentation: https://fennereduardo.github.io/gherkin-ai-cli/.