gherkin-ai 1.4.0 โ 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -19
- package/dist/commands/add.d.ts.map +1 -1
- package/dist/commands/add.js +7 -3
- package/dist/commands/add.js.map +1 -1
- package/dist/commands/mcp.d.ts +2 -0
- package/dist/commands/mcp.d.ts.map +1 -0
- package/dist/commands/mcp.js +12 -0
- package/dist/commands/mcp.js.map +1 -0
- package/dist/generators/contracts-csharp.d.ts +4 -0
- package/dist/generators/contracts-csharp.d.ts.map +1 -0
- package/dist/generators/contracts-csharp.js +69 -0
- package/dist/generators/contracts-csharp.js.map +1 -0
- package/dist/generators/contracts-go.d.ts +4 -0
- package/dist/generators/contracts-go.d.ts.map +1 -0
- package/dist/generators/contracts-go.js +69 -0
- package/dist/generators/contracts-go.js.map +1 -0
- package/dist/generators/contracts-php.d.ts +4 -0
- package/dist/generators/contracts-php.d.ts.map +1 -0
- package/dist/generators/contracts-php.js +78 -0
- package/dist/generators/contracts-php.js.map +1 -0
- package/dist/generators/contracts-python.d.ts +4 -0
- package/dist/generators/contracts-python.d.ts.map +1 -0
- package/dist/generators/contracts-python.js +61 -0
- package/dist/generators/contracts-python.js.map +1 -0
- package/dist/generators/contracts.d.ts +7 -2
- package/dist/generators/contracts.d.ts.map +1 -1
- package/dist/generators/contracts.js +33 -3
- package/dist/generators/contracts.js.map +1 -1
- package/dist/index.js +8 -1
- package/dist/index.js.map +1 -1
- package/dist/mcp/mcp-server.d.ts +2 -0
- package/dist/mcp/mcp-server.d.ts.map +1 -0
- package/dist/mcp/mcp-server.js +185 -0
- package/dist/mcp/mcp-server.js.map +1 -0
- package/docs/MCP_GUIDE.md +145 -0
- package/package.json +9 -2
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
[](https://opensource.org/licenses/MIT)
|
|
5
5
|
|
|
6
6
|
> **Bridge the gap between business specifications and AI Coding Agents.**
|
|
7
|
-
> Convert Gherkin `.feature` files into production-ready TypeScript contracts,
|
|
7
|
+
> Convert Gherkin `.feature` files into production-ready TypeScript contracts, Python Pydantic DTOs, PHP 8.2 Classes, Go Structs, C# Records, OpenAPI specs, deterministic test seeds, and role-specialized executable prompt packages for AI Agents (**Claude Code, Cursor, Antigravity, Windsurf, GitHub Copilot Workspace**).
|
|
8
8
|
|
|
9
9
|
---
|
|
10
10
|
|
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
While simple AI prompt generators produce generic text instructions, AI agents often invent conflicting package versions, violate domain boundaries, or fail to write working tests due to missing setup state.
|
|
14
14
|
|
|
15
15
|
`gherkin-ai` CLI solves this by generating **deterministic technical rails**:
|
|
16
|
-
-
|
|
16
|
+
- **Native Model Context Protocol (MCP) Server (`ghk mcp`)**: Exposes stdio MCP JSON-RPC 2.0 tools so Claude Desktop, Cursor, Antigravity, and Windsurf can invoke `gherkin-ai` tools directly.
|
|
17
|
+
- **Native Multi-Language Contracts (`contracts.py`, `contracts.php`, `contracts.go`, `contracts.cs`, `contracts.ts`)**: Strict domain interfaces and DTOs generated natively for your target language (Pydantic v2 in Python, Readonly Classes in PHP 8.2, Structs in Go, Records in C#).
|
|
17
18
|
- **`openapi.json`**: Auto-generated OpenAPI 3.0 specification derived directly from Gherkin AST schemas.
|
|
18
19
|
- **`fixtures.ts` & `seed.sql`**: Concrete database seeds (hashed passwords, bcrypt cost factor 12, pre-conditions) raising AI acceptance test success rates from ~30% to ~85%.
|
|
19
20
|
- **Interactive Spec Wizard (`ghk create`)**: Create Gherkin specifications step-by-step directly from your terminal.
|
|
@@ -24,41 +25,37 @@ While simple AI prompt generators produce generic text instructions, AI agents o
|
|
|
24
25
|
|
|
25
26
|
## ๐ Quick Start Commands
|
|
26
27
|
|
|
27
|
-
### 1.
|
|
28
|
+
### 1. Model Context Protocol (MCP) Server
|
|
28
29
|
|
|
29
|
-
|
|
30
|
+
Connect your AI Agent (Claude Desktop, Cursor, Antigravity) directly to `gherkin-ai`:
|
|
30
31
|
|
|
31
32
|
```bash
|
|
32
|
-
ghk
|
|
33
|
+
ghk mcp
|
|
33
34
|
```
|
|
34
35
|
|
|
35
|
-
|
|
36
|
+
*(See the complete [MCP Integration Guide](docs/MCP_GUIDE.md) for step-by-step setup).*
|
|
36
37
|
|
|
37
|
-
|
|
38
|
-
# 1. Auto-detect stack (Laravel, Rails, .NET, NestJS, Angular, Flutter, etc.)
|
|
39
|
-
ghk detect
|
|
38
|
+
### 2. Create a Gherkin Spec Interactively (`ghk create`)
|
|
40
39
|
|
|
41
|
-
|
|
42
|
-
ghk
|
|
40
|
+
```bash
|
|
41
|
+
ghk create # (or: ghk new)
|
|
43
42
|
```
|
|
44
43
|
|
|
45
|
-
### 3.
|
|
44
|
+
### 3. Existing Projects (Brownfield Mode)
|
|
46
45
|
|
|
47
46
|
```bash
|
|
48
|
-
# 1.
|
|
49
|
-
ghk
|
|
50
|
-
|
|
51
|
-
# 2. Generate contracts, OpenAPI, fixtures, and AI agent prompts
|
|
52
|
-
ghk generate --feature ./specs/auth.feature
|
|
47
|
+
# 1. Auto-detect stack (Laravel, Rails, .NET, NestJS, Angular, Flutter, etc.)
|
|
48
|
+
ghk detect
|
|
53
49
|
|
|
54
|
-
#
|
|
55
|
-
ghk
|
|
50
|
+
# 2. Inject native language contract directly into an existing module folder
|
|
51
|
+
ghk add --feature ./specs/payments.feature --target ./src/modules/payments
|
|
56
52
|
```
|
|
57
53
|
|
|
58
54
|
---
|
|
59
55
|
|
|
60
56
|
## ๐ Complete Documentation
|
|
61
57
|
|
|
58
|
+
- [Model Context Protocol (MCP) Integration Guide](docs/MCP_GUIDE.md)
|
|
62
59
|
- [Comprehensive Usage Guide](docs/USAGE_GUIDE.md)
|
|
63
60
|
- [CLI Architecture & Agent Pipeline](docs/ARCHITECTURE.md)
|
|
64
61
|
- [Live Web SPA Playground](https://fennereduardo.com/pages/GherkinIATool/)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add.d.ts","sourceRoot":"","sources":["../../src/commands/add.ts"],"names":[],"mappings":"AAeA,wBAAsB,gBAAgB,CAAC,OAAO,EAAE;IAAE,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"add.d.ts","sourceRoot":"","sources":["../../src/commands/add.ts"],"names":[],"mappings":"AAeA,wBAAsB,gBAAgB,CAAC,OAAO,EAAE;IAAE,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CA6ErH"}
|
package/dist/commands/add.js
CHANGED
|
@@ -58,13 +58,17 @@ async function handleAddCommand(options) {
|
|
|
58
58
|
: path_1.default.resolve(process.cwd(), 'src', 'modules', featurePascal.toLowerCase());
|
|
59
59
|
(0, file_system_1.ensureDirSync)(targetDir);
|
|
60
60
|
logger_1.logger.info(`Injecting contracts & AI prompts into: ${targetDir}`);
|
|
61
|
-
// 1. Generate Contracts &
|
|
62
|
-
const { contractsTs, adrMd, openApiJson } = (0, contracts_1.generateContracts)(parsed, config);
|
|
61
|
+
// 1. Generate Contracts, OpenAPI & Native Language Contract
|
|
62
|
+
const { contractsTs, adrMd, openApiJson, nativeContract } = (0, contracts_1.generateContracts)(parsed, config);
|
|
63
63
|
const contractFileName = `${featurePascal.toLowerCase()}.contract.ts`;
|
|
64
64
|
(0, file_system_1.writeFileSync)(path_1.default.join(targetDir, contractFileName), contractsTs);
|
|
65
65
|
(0, file_system_1.writeFileSync)(path_1.default.join(targetDir, `${featurePascal.toLowerCase()}.openapi.json`), openApiJson);
|
|
66
66
|
(0, file_system_1.writeFileSync)(path_1.default.join(targetDir, `ADR-${featurePascal}.md`), adrMd);
|
|
67
67
|
logger_1.logger.success(`Created contract file: ${path_1.default.join(targetDir, contractFileName)}`);
|
|
68
|
+
if (nativeContract) {
|
|
69
|
+
(0, file_system_1.writeFileSync)(path_1.default.join(targetDir, nativeContract.filename), nativeContract.content);
|
|
70
|
+
logger_1.logger.success(`Created language-native contract file: ${path_1.default.join(targetDir, nativeContract.filename)}`);
|
|
71
|
+
}
|
|
68
72
|
// 2. Generate Agent Prompts inside target module
|
|
69
73
|
const promptsDir = path_1.default.join(targetDir, 'prompts');
|
|
70
74
|
(0, file_system_1.ensureDirSync)(promptsDir);
|
|
@@ -75,6 +79,6 @@ async function handleAddCommand(options) {
|
|
|
75
79
|
logger_1.logger.success(`Created specialized AI prompts inside: ${promptsDir}`);
|
|
76
80
|
logger_1.logger.banner();
|
|
77
81
|
logger_1.logger.success(`Contracts & AI prompts injected into existing project at ${targetDir}!`);
|
|
78
|
-
logger_1.logger.info(`Now your AI Coding Agent can consume ${contractFileName} directly inside your module.`);
|
|
82
|
+
logger_1.logger.info(`Now your AI Coding Agent can consume ${nativeContract ? nativeContract.filename : contractFileName} directly inside your module.`);
|
|
79
83
|
}
|
|
80
84
|
//# sourceMappingURL=add.js.map
|
package/dist/commands/add.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add.js","sourceRoot":"","sources":["../../src/commands/add.ts"],"names":[],"mappings":";AAAA;;gFAEgF;;;;;AAahF,
|
|
1
|
+
{"version":3,"file":"add.js","sourceRoot":"","sources":["../../src/commands/add.ts"],"names":[],"mappings":";AAAA;;gFAEgF;;;;;AAahF,4CA6EC;AAxFD,gDAAwB;AACxB,wDAAgC;AAChC,2CAA4C;AAC5C,2DAA6D;AAC7D,2DAA0D;AAC1D,uDAA4D;AAC5D,mDAAwD;AACxD,qCAA+C;AAC/C,sDAAkG;AAClG,4CAAyC;AAElC,KAAK,UAAU,gBAAgB,CAAC,OAA+D;IACpG,eAAM,CAAC,MAAM,EAAE,CAAC;IAEhB,IAAI,CAAC,OAAO,C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":[],"mappings":"AAMA,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC,CAGtD"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* ==========================================================================
|
|
3
|
+
gherkin-ai-cli - 'mcp' Command Handler (Model Context Protocol Server)
|
|
4
|
+
========================================================================== */
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.handleMcpCommand = handleMcpCommand;
|
|
7
|
+
const mcp_server_1 = require("../mcp/mcp-server");
|
|
8
|
+
async function handleMcpCommand() {
|
|
9
|
+
// Silent start for stdio MCP JSON-RPC 2.0 protocol
|
|
10
|
+
(0, mcp_server_1.startMcpServer)();
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=mcp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp.js","sourceRoot":"","sources":["../../src/commands/mcp.ts"],"names":[],"mappings":";AAAA;;gFAEgF;;AAIhF,4CAGC;AALD,kDAAmD;AAE5C,KAAK,UAAU,gBAAgB;IACpC,mDAAmD;IACnD,IAAA,2BAAc,GAAE,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contracts-csharp.d.ts","sourceRoot":"","sources":["../../src/generators/contracts-csharp.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEjD,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,eAAe,GAAG,MAAM,CA8D9F"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* ==========================================================================
|
|
3
|
+
gherkin-ai-cli - C# 11 Records & Interfaces Generator
|
|
4
|
+
========================================================================== */
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.generateCsharpContracts = generateCsharpContracts;
|
|
7
|
+
function generateCsharpContracts(parsed, config) {
|
|
8
|
+
const featurePascal = parsed.featureName.replace(/[^a-zA-Z0-9]/g, '');
|
|
9
|
+
return `/* ==========================================================================
|
|
10
|
+
Generated Domain Contracts & C# 11 Records
|
|
11
|
+
Feature: ${parsed.featureName}
|
|
12
|
+
Stack: C# + ${config.stack.framework} + ${config.stack.orm}
|
|
13
|
+
Generated by gherkin-ai CLI v1.5.0
|
|
14
|
+
========================================================================== */
|
|
15
|
+
|
|
16
|
+
namespace Domain.Contracts.${featurePascal};
|
|
17
|
+
|
|
18
|
+
using System;
|
|
19
|
+
using System.Collections.Generic;
|
|
20
|
+
using System.Threading.Tasks;
|
|
21
|
+
|
|
22
|
+
// --------------------------------------------------------------------------
|
|
23
|
+
// 1. Domain Event Interface & Record Implementations
|
|
24
|
+
// --------------------------------------------------------------------------
|
|
25
|
+
public interface IDomainEvent
|
|
26
|
+
{
|
|
27
|
+
Guid EventId { get; }
|
|
28
|
+
DateTime OccurredOn { get; }
|
|
29
|
+
string EventType { get; }
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
${parsed.domainAnalysis.events.map((ev, i) => `public record Event${i + 1}(
|
|
33
|
+
Guid EventId,
|
|
34
|
+
DateTime OccurredOn,
|
|
35
|
+
Dictionary<string, object> Payload
|
|
36
|
+
) : IDomainEvent
|
|
37
|
+
{
|
|
38
|
+
public string EventType => "${ev.replace(/[^a-zA-Z0-9]/g, '')}";
|
|
39
|
+
}`).join('\n\n')}
|
|
40
|
+
|
|
41
|
+
// --------------------------------------------------------------------------
|
|
42
|
+
// 2. Command DTO Record
|
|
43
|
+
// --------------------------------------------------------------------------
|
|
44
|
+
public record ${featurePascal}Command(
|
|
45
|
+
Guid RequestId,
|
|
46
|
+
DateTime Timestamp,
|
|
47
|
+
Dictionary<string, object> Payload
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
// --------------------------------------------------------------------------
|
|
51
|
+
// 3. Domain Repository Port
|
|
52
|
+
// --------------------------------------------------------------------------
|
|
53
|
+
public interface I${featurePascal}Repository
|
|
54
|
+
{
|
|
55
|
+
Task<object?> FindByIdAsync(string id);
|
|
56
|
+
Task SaveAsync(object entity);
|
|
57
|
+
Task DeleteAsync(string id);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// --------------------------------------------------------------------------
|
|
61
|
+
// 4. Application Event Publisher Port
|
|
62
|
+
// --------------------------------------------------------------------------
|
|
63
|
+
public interface IEventPublisher
|
|
64
|
+
{
|
|
65
|
+
Task PublishAsync(IDomainEvent domainEvent);
|
|
66
|
+
}
|
|
67
|
+
`;
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=contracts-csharp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contracts-csharp.js","sourceRoot":"","sources":["../../src/generators/contracts-csharp.ts"],"names":[],"mappings":";AAAA;;gFAEgF;;AAKhF,0DA8DC;AA9DD,SAAgB,uBAAuB,CAAC,MAAqB,EAAE,MAAuB;IACpF,MAAM,aAAa,GAAG,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,eAAe,EAAE,EAAE,CAAC,CAAC;IAEtE,OAAO;;cAEK,MAAM,CAAC,WAAW;iBACf,MAAM,CAAC,KAAK,CAAC,SAAS,MAAM,MAAM,CAAC,KAAK,CAAC,GAAG;;;;6BAIhC,aAAa;;;;;;;;;;;;;;;;EAgBxC,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,sBAAsB,CAAC,GAAG,CAAC;;;;;;kCAMvC,EAAE,CAAC,OAAO,CAAC,eAAe,EAAE,EAAE,CAAC;EAC/D,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC;;;;;gBAKA,aAAa;;;;;;;;;oBAST,aAAa;;;;;;;;;;;;;;CAchC,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contracts-go.d.ts","sourceRoot":"","sources":["../../src/generators/contracts-go.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEjD,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,eAAe,GAAG,MAAM,CA8D1F"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* ==========================================================================
|
|
3
|
+
gherkin-ai-cli - Go Structs & Domain Interfaces Generator
|
|
4
|
+
========================================================================== */
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.generateGoContracts = generateGoContracts;
|
|
7
|
+
function generateGoContracts(parsed, config) {
|
|
8
|
+
const featurePascal = parsed.featureName.replace(/[^a-zA-Z0-9]/g, '');
|
|
9
|
+
return `/* ==========================================================================
|
|
10
|
+
Generated Domain Contracts & Go Structs
|
|
11
|
+
Feature: ${parsed.featureName}
|
|
12
|
+
Stack: Go + ${config.stack.framework} + ${config.stack.orm}
|
|
13
|
+
Generated by gherkin-ai CLI v1.5.0
|
|
14
|
+
========================================================================== */
|
|
15
|
+
|
|
16
|
+
package contracts
|
|
17
|
+
|
|
18
|
+
import (
|
|
19
|
+
"context"
|
|
20
|
+
"time"
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
// --------------------------------------------------------------------------
|
|
24
|
+
// 1. Domain Event Interface
|
|
25
|
+
// --------------------------------------------------------------------------
|
|
26
|
+
type IDomainEvent interface {
|
|
27
|
+
GetEventID() string
|
|
28
|
+
GetOccurredOn() time.Time
|
|
29
|
+
GetEventType() string
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
${parsed.domainAnalysis.events.map((ev, i) => `type Event${i + 1} struct {
|
|
33
|
+
EventID string \`json:"event_id"\`
|
|
34
|
+
OccurredOn time.Time \`json:"occurred_on"\`
|
|
35
|
+
EventType string \`json:"event_type"\`
|
|
36
|
+
Payload map[string]interface{} \`json:"payload"\`
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
func (e Event${i + 1}) GetEventID() string { return e.EventID }
|
|
40
|
+
func (e Event${i + 1}) GetOccurredOn() time.Time { return e.OccurredOn }
|
|
41
|
+
func (e Event${i + 1}) GetEventType() string { return "${ev.replace(/[^a-zA-Z0-9]/g, '')}" }`).join('\n\n')}
|
|
42
|
+
|
|
43
|
+
// --------------------------------------------------------------------------
|
|
44
|
+
// 2. Command DTO Struct
|
|
45
|
+
// --------------------------------------------------------------------------
|
|
46
|
+
type ${featurePascal}Command struct {
|
|
47
|
+
RequestID string \`json:"request_id" validate:"required,uuid"\`
|
|
48
|
+
Timestamp time.Time \`json:"timestamp" validate:"required"\`
|
|
49
|
+
Payload map[string]interface{} \`json:"payload" validate:"required"\`
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// --------------------------------------------------------------------------
|
|
53
|
+
// 3. Domain Repository Port
|
|
54
|
+
// --------------------------------------------------------------------------
|
|
55
|
+
type I${featurePascal}Repository interface {
|
|
56
|
+
FindByID(ctx context.Context, id string) (interface{}, error)
|
|
57
|
+
Save(ctx context.Context, entity interface{}) error
|
|
58
|
+
Delete(ctx context.Context, id string) error
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// --------------------------------------------------------------------------
|
|
62
|
+
// 4. Application Event Publisher Port
|
|
63
|
+
// --------------------------------------------------------------------------
|
|
64
|
+
type IEventPublisher interface {
|
|
65
|
+
Publish(ctx context.Context, event IDomainEvent) error
|
|
66
|
+
}
|
|
67
|
+
`;
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=contracts-go.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contracts-go.js","sourceRoot":"","sources":["../../src/generators/contracts-go.ts"],"names":[],"mappings":";AAAA;;gFAEgF;;AAKhF,kDA8DC;AA9DD,SAAgB,mBAAmB,CAAC,MAAqB,EAAE,MAAuB;IAChF,MAAM,aAAa,GAAG,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,eAAe,EAAE,EAAE,CAAC,CAAC;IAEtE,OAAO;;cAEK,MAAM,CAAC,WAAW;iBACf,MAAM,CAAC,KAAK,CAAC,SAAS,MAAM,MAAM,CAAC,KAAK,CAAC,GAAG;;;;;;;;;;;;;;;;;;;;EAoB3D,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,aAAa,CAAC,GAAG,CAAC;;;;;;;eAOjD,CAAC,GAAG,CAAC;eACL,CAAC,GAAG,CAAC;eACL,CAAC,GAAG,CAAC,wCAAwC,EAAE,CAAC,OAAO,CAAC,eAAe,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC;;;;;OAKvG,aAAa;;;;;;;;;QASZ,aAAa;;;;;;;;;;;;CAYpB,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contracts-php.d.ts","sourceRoot":"","sources":["../../src/generators/contracts-php.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEjD,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,eAAe,GAAG,MAAM,CAuE3F"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* ==========================================================================
|
|
3
|
+
gherkin-ai-cli - PHP 8.2 Domain Contracts & DTOs Generator
|
|
4
|
+
========================================================================== */
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.generatePhpContracts = generatePhpContracts;
|
|
7
|
+
function generatePhpContracts(parsed, config) {
|
|
8
|
+
const featurePascal = parsed.featureName.replace(/[^a-zA-Z0-9]/g, '');
|
|
9
|
+
return `<?php
|
|
10
|
+
|
|
11
|
+
declare(strict_types=1);
|
|
12
|
+
|
|
13
|
+
/* ==========================================================================
|
|
14
|
+
Generated Domain Contracts & PHP DTOs
|
|
15
|
+
Feature: ${parsed.featureName}
|
|
16
|
+
Stack: PHP 8.2 + ${config.stack.framework} + ${config.stack.orm}
|
|
17
|
+
Generated by gherkin-ai CLI v1.5.0
|
|
18
|
+
========================================================================== */
|
|
19
|
+
|
|
20
|
+
namespace App\\Domain\\Contracts\\${featurePascal};
|
|
21
|
+
|
|
22
|
+
use DateTimeImmutable;
|
|
23
|
+
|
|
24
|
+
// --------------------------------------------------------------------------
|
|
25
|
+
// 1. Base Domain Event Interface
|
|
26
|
+
// --------------------------------------------------------------------------
|
|
27
|
+
interface IDomainEvent
|
|
28
|
+
{
|
|
29
|
+
public function getEventId(): string;
|
|
30
|
+
public function getOccurredOn(): DateTimeImmutable;
|
|
31
|
+
public function getEventType(): string;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
${parsed.domainAnalysis.events.map((ev, i) => `readonly class Event${i + 1} implements IDomainEvent
|
|
35
|
+
{
|
|
36
|
+
public function __construct(
|
|
37
|
+
public string $eventId,
|
|
38
|
+
public DateTimeImmutable $occurredOn,
|
|
39
|
+
public array $payload = []
|
|
40
|
+
) {}
|
|
41
|
+
|
|
42
|
+
public function getEventId(): string { return $this->eventId; }
|
|
43
|
+
public function getOccurredOn(): DateTimeImmutable { return $this->occurredOn; }
|
|
44
|
+
public function getEventType(): string { return '${ev.replace(/[^a-zA-Z0-9]/g, '')}'; }
|
|
45
|
+
}`).join('\n\n')}
|
|
46
|
+
|
|
47
|
+
// --------------------------------------------------------------------------
|
|
48
|
+
// 2. Command DTO Class (Readonly PHP 8.2)
|
|
49
|
+
// --------------------------------------------------------------------------
|
|
50
|
+
readonly class ${featurePascal}Command
|
|
51
|
+
{
|
|
52
|
+
public function __construct(
|
|
53
|
+
public string $requestId,
|
|
54
|
+
public DateTimeImmutable $timestamp,
|
|
55
|
+
public array $payload
|
|
56
|
+
) {}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// --------------------------------------------------------------------------
|
|
60
|
+
// 3. Domain Repository Port (Outbound Interface)
|
|
61
|
+
// --------------------------------------------------------------------------
|
|
62
|
+
interface I${featurePascal}Repository
|
|
63
|
+
{
|
|
64
|
+
public function findById(string $id): mixed;
|
|
65
|
+
public function save(mixed $entity): void;
|
|
66
|
+
public function delete(string $id): void;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// --------------------------------------------------------------------------
|
|
70
|
+
// 4. Application Event Publisher Port
|
|
71
|
+
// --------------------------------------------------------------------------
|
|
72
|
+
interface IEventPublisher
|
|
73
|
+
{
|
|
74
|
+
public function publish(IDomainEvent $event): void;
|
|
75
|
+
}
|
|
76
|
+
`;
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=contracts-php.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contracts-php.js","sourceRoot":"","sources":["../../src/generators/contracts-php.ts"],"names":[],"mappings":";AAAA;;gFAEgF;;AAKhF,oDAuEC;AAvED,SAAgB,oBAAoB,CAAC,MAAqB,EAAE,MAAuB;IACjF,MAAM,aAAa,GAAG,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,eAAe,EAAE,EAAE,CAAC,CAAC;IAEtE,OAAO;;;;;;cAMK,MAAM,CAAC,WAAW;sBACV,MAAM,CAAC,KAAK,CAAC,SAAS,MAAM,MAAM,CAAC,KAAK,CAAC,GAAG;;;;oCAI9B,aAAa;;;;;;;;;;;;;;EAc/C,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,uBAAuB,CAAC,GAAG,CAAC;;;;;;;;;;uDAUnB,EAAE,CAAC,OAAO,CAAC,eAAe,EAAE,EAAE,CAAC;EACpF,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC;;;;;iBAKC,aAAa;;;;;;;;;;;;aAYjB,aAAa;;;;;;;;;;;;;;CAczB,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contracts-python.d.ts","sourceRoot":"","sources":["../../src/generators/contracts-python.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEjD,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,eAAe,GAAG,MAAM,CAsD9F"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* ==========================================================================
|
|
3
|
+
gherkin-ai-cli - Python Pydantic v2 & Domain Contracts Generator
|
|
4
|
+
========================================================================== */
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.generatePythonContracts = generatePythonContracts;
|
|
7
|
+
function generatePythonContracts(parsed, config) {
|
|
8
|
+
const featurePascal = parsed.featureName.replace(/[^a-zA-Z0-9]/g, '');
|
|
9
|
+
return `# ==========================================================================
|
|
10
|
+
# Generated Domain Contracts & Pydantic DTO Schemas
|
|
11
|
+
# Feature: ${parsed.featureName}
|
|
12
|
+
# Stack: Python + ${config.stack.framework} + ${config.stack.orm}
|
|
13
|
+
# Generated by gherkin-ai CLI v1.5.0
|
|
14
|
+
# ==========================================================================
|
|
15
|
+
|
|
16
|
+
from datetime import datetime
|
|
17
|
+
from typing import Protocol, Any, Dict, Optional
|
|
18
|
+
from pydantic import BaseModel, Field, UUID4
|
|
19
|
+
|
|
20
|
+
# --------------------------------------------------------------------------
|
|
21
|
+
# 1. Base Domain Event & Event Schemas
|
|
22
|
+
# --------------------------------------------------------------------------
|
|
23
|
+
class IDomainEvent(BaseModel):
|
|
24
|
+
event_id: UUID4
|
|
25
|
+
occurred_on: datetime = Field(default_factory=datetime.utcnow)
|
|
26
|
+
event_type: str
|
|
27
|
+
|
|
28
|
+
${parsed.domainAnalysis.events.map((ev, i) => `class Event${i + 1}(IDomainEvent):
|
|
29
|
+
event_type: str = "${ev.replace(/[^a-zA-Z0-9]/g, '')}"
|
|
30
|
+
payload: Dict[str, Any]`).join('\n\n')}
|
|
31
|
+
|
|
32
|
+
# --------------------------------------------------------------------------
|
|
33
|
+
# 2. Command DTO Schema (Pydantic v2 Validation)
|
|
34
|
+
# --------------------------------------------------------------------------
|
|
35
|
+
class ${featurePascal}Command(BaseModel):
|
|
36
|
+
request_id: UUID4
|
|
37
|
+
timestamp: datetime = Field(default_factory=datetime.utcnow)
|
|
38
|
+
payload: Dict[str, Any]
|
|
39
|
+
|
|
40
|
+
# --------------------------------------------------------------------------
|
|
41
|
+
# 3. Domain Repository Port (Outbound Protocol)
|
|
42
|
+
# --------------------------------------------------------------------------
|
|
43
|
+
class I${featurePascal}Repository(Protocol):
|
|
44
|
+
async def find_by_id(self, entity_id: str) -> Optional[Any]:
|
|
45
|
+
...
|
|
46
|
+
|
|
47
|
+
async def save(self, entity: Any) -> None:
|
|
48
|
+
...
|
|
49
|
+
|
|
50
|
+
async def delete(self, entity_id: str) -> None:
|
|
51
|
+
...
|
|
52
|
+
|
|
53
|
+
# --------------------------------------------------------------------------
|
|
54
|
+
# 4. Application Event Publisher Port
|
|
55
|
+
# --------------------------------------------------------------------------
|
|
56
|
+
class IEventPublisher(Protocol):
|
|
57
|
+
async def publish(self, event: IDomainEvent) -> None:
|
|
58
|
+
...
|
|
59
|
+
`;
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=contracts-python.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contracts-python.js","sourceRoot":"","sources":["../../src/generators/contracts-python.ts"],"names":[],"mappings":";AAAA;;gFAEgF;;AAKhF,0DAsDC;AAtDD,SAAgB,uBAAuB,CAAC,MAAqB,EAAE,MAAuB;IACpF,MAAM,aAAa,GAAG,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,eAAe,EAAE,EAAE,CAAC,CAAC;IAEtE,OAAO;;aAEI,MAAM,CAAC,WAAW;oBACX,MAAM,CAAC,KAAK,CAAC,SAAS,MAAM,MAAM,CAAC,KAAK,CAAC,GAAG;;;;;;;;;;;;;;;;EAgB9D,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,cAAc,CAAC,GAAG,CAAC;yBACxC,EAAE,CAAC,OAAO,CAAC,eAAe,EAAE,EAAE,CAAC;4BAC5B,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC;;;;;QAKlC,aAAa;;;;;;;;SAQZ,aAAa;;;;;;;;;;;;;;;;CAgBrB,CAAC;AACF,CAAC"}
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import { ParsedFeature } from '../core/gherkin-parser';
|
|
2
2
|
import { GherkinAIConfig } from '../core/config';
|
|
3
|
-
export
|
|
3
|
+
export interface GeneratedContractsOutput {
|
|
4
4
|
contractsTs: string;
|
|
5
5
|
adrMd: string;
|
|
6
6
|
openApiJson: string;
|
|
7
|
-
|
|
7
|
+
nativeContract?: {
|
|
8
|
+
filename: string;
|
|
9
|
+
content: string;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
export declare function generateContracts(parsed: ParsedFeature, config: GherkinAIConfig): GeneratedContractsOutput;
|
|
8
13
|
//# sourceMappingURL=contracts.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../../src/generators/contracts.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../../src/generators/contracts.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAQjD,MAAM,WAAW,wBAAwB;IACvC,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE;QACf,QAAQ,EAAE,MAAM,CAAC;QACjB,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;CACH;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,eAAe,GAAG,wBAAwB,CAwK1G"}
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/* ==========================================================================
|
|
3
|
-
gherkin-ai-cli -
|
|
3
|
+
gherkin-ai-cli - Multi-Language Domain Contracts & OpenAPI Generator
|
|
4
4
|
========================================================================== */
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.generateContracts = generateContracts;
|
|
7
7
|
const arch_rules_1 = require("../core/arch-rules");
|
|
8
8
|
const stack_specs_1 = require("../core/stack-specs");
|
|
9
|
+
const contracts_python_1 = require("./contracts-python");
|
|
10
|
+
const contracts_php_1 = require("./contracts-php");
|
|
11
|
+
const contracts_go_1 = require("./contracts-go");
|
|
12
|
+
const contracts_csharp_1 = require("./contracts-csharp");
|
|
9
13
|
function generateContracts(parsed, config) {
|
|
10
14
|
const arch = (0, arch_rules_1.getArchRule)(config.architecture);
|
|
11
15
|
const spec = (0, stack_specs_1.getStackSpec)(config.stack);
|
|
@@ -38,7 +42,7 @@ export interface ISnapshotStore<T> {
|
|
|
38
42
|
Feature: ${parsed.featureName}
|
|
39
43
|
Architecture: ${arch.name}
|
|
40
44
|
Stack: ${config.stack.language} + ${config.stack.framework} + ${config.stack.orm}
|
|
41
|
-
Generated by gherkin-ai CLI v1.
|
|
45
|
+
Generated by gherkin-ai CLI v1.5.0
|
|
42
46
|
========================================================================== */
|
|
43
47
|
|
|
44
48
|
import { z } from '${spec.validationPackage.split('@')[0]}';
|
|
@@ -142,6 +146,32 @@ ${arch.prohibitedImports.map(p => `- \`${p}\``).join('\n')}
|
|
|
142
146
|
}
|
|
143
147
|
}
|
|
144
148
|
}, null, 2);
|
|
145
|
-
|
|
149
|
+
// Generate Native Contract file based on target stack language
|
|
150
|
+
let nativeContract;
|
|
151
|
+
if (config.stack.language === 'python') {
|
|
152
|
+
nativeContract = {
|
|
153
|
+
filename: `${featurePascal.toLowerCase()}.contract.py`,
|
|
154
|
+
content: (0, contracts_python_1.generatePythonContracts)(parsed, config)
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
else if (config.stack.language === 'php') {
|
|
158
|
+
nativeContract = {
|
|
159
|
+
filename: `${featurePascal.toLowerCase()}.contract.php`,
|
|
160
|
+
content: (0, contracts_php_1.generatePhpContracts)(parsed, config)
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
else if (config.stack.language === 'go') {
|
|
164
|
+
nativeContract = {
|
|
165
|
+
filename: `${featurePascal.toLowerCase()}.contract.go`,
|
|
166
|
+
content: (0, contracts_go_1.generateGoContracts)(parsed, config)
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
else if (config.stack.language === 'csharp') {
|
|
170
|
+
nativeContract = {
|
|
171
|
+
filename: `${featurePascal.toLowerCase()}.contract.cs`,
|
|
172
|
+
content: (0, contracts_csharp_1.generateCsharpContracts)(parsed, config)
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
return { contractsTs, adrMd, openApiJson, nativeContract };
|
|
146
176
|
}
|
|
147
177
|
//# sourceMappingURL=contracts.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contracts.js","sourceRoot":"","sources":["../../src/generators/contracts.ts"],"names":[],"mappings":";AAAA;;gFAEgF;;
|
|
1
|
+
{"version":3,"file":"contracts.js","sourceRoot":"","sources":["../../src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AM,IAAI,MAAM,CAAC,KAAK,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;QAC9C,cAAc,GAAG;YACf,QAAQ,EAAE,GAAG,aAAa,CAAC,WAAW,EAAE,cAAc;YACtD,OAAO,EAAE,IAAA,0CAAuB,EAAC,MAAM,EAAE,MAAM,CAAC;SACjD,CAAC;IACJ,CAAC;IAED,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,CAAC;AAC7D,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -12,13 +12,14 @@ const detect_1 = require("./commands/detect");
|
|
|
12
12
|
const add_1 = require("./commands/add");
|
|
13
13
|
const create_1 = require("./commands/create");
|
|
14
14
|
const lang_1 = require("./commands/lang");
|
|
15
|
+
const mcp_1 = require("./commands/mcp");
|
|
15
16
|
// Dynamic version from package.json
|
|
16
17
|
const pkg = require('../package.json');
|
|
17
18
|
const program = new commander_1.Command();
|
|
18
19
|
program
|
|
19
20
|
.name('gherkin-ai')
|
|
20
21
|
.description('CLI tool & contract engine translating Gherkin specs into executable prompts, TypeScript contracts, and seed fixtures for AI Agents.')
|
|
21
|
-
.version(pkg.version || '1.
|
|
22
|
+
.version(pkg.version || '1.5.0')
|
|
22
23
|
.option('--init', 'Alias for init command')
|
|
23
24
|
.option('--create', 'Alias for create command')
|
|
24
25
|
.option('--generate', 'Alias for generate command')
|
|
@@ -31,6 +32,12 @@ program
|
|
|
31
32
|
.action(async () => {
|
|
32
33
|
await (0, init_1.handleInitCommand)();
|
|
33
34
|
});
|
|
35
|
+
program
|
|
36
|
+
.command('mcp')
|
|
37
|
+
.description('Start native Model Context Protocol (MCP) JSON-RPC 2.0 stdio server for AI Agents')
|
|
38
|
+
.action(async () => {
|
|
39
|
+
await (0, mcp_1.handleMcpCommand)();
|
|
40
|
+
});
|
|
34
41
|
program
|
|
35
42
|
.command('lang')
|
|
36
43
|
.alias('l')
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;gFAEgF;;AAEhF,yCAAoC;AACpC,0CAAoD;AACpD,kDAA4D;AAC5D,kDAA4D;AAC5D,8CAAwD;AACxD,8CAAwD;AACxD,wCAAkD;AAClD,8CAAwD;AACxD,0CAAoD;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;gFAEgF;;AAEhF,yCAAoC;AACpC,0CAAoD;AACpD,kDAA4D;AAC5D,kDAA4D;AAC5D,8CAAwD;AACxD,8CAAwD;AACxD,wCAAkD;AAClD,8CAAwD;AACxD,0CAAoD;AACpD,wCAAkD;AAElD,oCAAoC;AACpC,MAAM,GAAG,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;AAEvC,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,IAAI,CAAC,YAAY,CAAC;KAClB,WAAW,CAAC,sIAAsI,CAAC;KACnJ,OAAO,CAAC,GAAG,CAAC,OAAO,IAAI,OAAO,CAAC;KAC/B,MAAM,CAAC,QAAQ,EAAE,wBAAwB,CAAC;KAC1C,MAAM,CAAC,UAAU,EAAE,0BAA0B,CAAC;KAC9C,MAAM,CAAC,YAAY,EAAE,4BAA4B,CAAC;KAClD,MAAM,CAAC,YAAY,EAAE,4BAA4B,CAAC;KAClD,MAAM,CAAC,UAAU,EAAE,0BAA0B,CAAC,CAAC;AAElD,OAAO;KACJ,OAAO,CAAC,MAAM,CAAC;KACf,KAAK,CAAC,GAAG,CAAC;KACV,WAAW,CAAC,kFAAkF,CAAC;KAC/F,MAAM,CAAC,KAAK,IAAI,EAAE;IACjB,MAAM,IAAA,wBAAiB,GAAE,CAAC;AAC5B,CAAC,CAAC,CAAC;AAEL,OAAO;KACJ,OAAO,CAAC,KAAK,CAAC;KACd,WAAW,CAAC,mFAAmF,CAAC;KAChG,MAAM,CAAC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;IAC/B,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;QACjB,MAAM,IAAA,wBAAiB,GAAE,CAAC;IAC5B,CAAC;SAAM,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;QAC1B,MAAM,IAAA,4BAAmB,EAAC,EAAE,CAAC,CAAC;IAChC,CAAC;SAAM,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;QAC1B,MAAM,IAAA,4BAAmB,GAAE,CAAC;IAC9B,CAAC;SAAM,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;QAC5B,MAAM,IAAA,gCAAqB,EAAC,EAAE,CAAC,CAAC;IAClC,CAAC;SAAM,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;QAC5B,MAAM,IAAA,gCAAqB,EAAC,EAAE,CAAC,CAAC;IAClC,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,IAAI,EAAE,CAAC;IACjB,CAAC;AACH,CAAC,CAAC,CAAC;AAEH,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-server.d.ts","sourceRoot":"","sources":["../../src/mcp/mcp-server.ts"],"names":[],"mappings":"AAUA,wBAAgB,cAAc,IAAI,IAAI,CAwBrC"}
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* ==========================================================================
|
|
3
|
+
gherkin-ai-cli - Model Context Protocol (MCP) Stdio JSON-RPC 2.0 Server
|
|
4
|
+
========================================================================== */
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.startMcpServer = startMcpServer;
|
|
7
|
+
const gherkin_parser_1 = require("../core/gherkin-parser");
|
|
8
|
+
const contracts_1 = require("../generators/contracts");
|
|
9
|
+
const stack_detector_1 = require("../core/stack-detector");
|
|
10
|
+
const arch_rules_1 = require("../core/arch-rules");
|
|
11
|
+
const config_1 = require("../core/config");
|
|
12
|
+
function startMcpServer() {
|
|
13
|
+
process.stdin.setEncoding('utf8');
|
|
14
|
+
let buffer = '';
|
|
15
|
+
process.stdin.on('data', (chunk) => {
|
|
16
|
+
buffer += chunk;
|
|
17
|
+
const lines = buffer.split('\n');
|
|
18
|
+
buffer = lines.pop() || '';
|
|
19
|
+
for (const line of lines) {
|
|
20
|
+
if (!line.trim())
|
|
21
|
+
continue;
|
|
22
|
+
try {
|
|
23
|
+
const message = JSON.parse(line.trim());
|
|
24
|
+
handleJsonRpcMessage(message);
|
|
25
|
+
}
|
|
26
|
+
catch (err) {
|
|
27
|
+
// Send JSON-RPC Parse Error
|
|
28
|
+
sendJsonRpcResponse(null, null, {
|
|
29
|
+
code: -32700,
|
|
30
|
+
message: `Parse error: ${err.message}`
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
function sendJsonRpcResponse(id, result, error = null) {
|
|
37
|
+
const response = { jsonrpc: '2.0', id };
|
|
38
|
+
if (error) {
|
|
39
|
+
response.error = error;
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
response.result = result;
|
|
43
|
+
}
|
|
44
|
+
process.stdout.write(JSON.stringify(response) + '\n');
|
|
45
|
+
}
|
|
46
|
+
function handleJsonRpcMessage(message) {
|
|
47
|
+
const { id, method, params } = message;
|
|
48
|
+
switch (method) {
|
|
49
|
+
case 'initialize':
|
|
50
|
+
sendJsonRpcResponse(id, {
|
|
51
|
+
protocolVersion: '2024-11-05',
|
|
52
|
+
capabilities: {
|
|
53
|
+
tools: {}
|
|
54
|
+
},
|
|
55
|
+
serverInfo: {
|
|
56
|
+
name: 'gherkin-ai-mcp',
|
|
57
|
+
version: '1.5.0'
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
break;
|
|
61
|
+
case 'notifications/initialized':
|
|
62
|
+
// Notification, no response needed
|
|
63
|
+
break;
|
|
64
|
+
case 'tools/list':
|
|
65
|
+
sendJsonRpcResponse(id, {
|
|
66
|
+
tools: [
|
|
67
|
+
{
|
|
68
|
+
name: 'parse_gherkin',
|
|
69
|
+
description: 'Parse Gherkin .feature specification text into domain AST (commands, queries, events, actors).',
|
|
70
|
+
inputSchema: {
|
|
71
|
+
type: 'object',
|
|
72
|
+
properties: {
|
|
73
|
+
gherkinText: { type: 'string', description: 'Gherkin feature file content.' }
|
|
74
|
+
},
|
|
75
|
+
required: ['gherkinText']
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
name: 'generate_contracts',
|
|
80
|
+
description: 'Generate TypeScript, OpenAPI 3.0, and native language contracts (Python, PHP, Go, C#) from Gherkin text.',
|
|
81
|
+
inputSchema: {
|
|
82
|
+
type: 'object',
|
|
83
|
+
properties: {
|
|
84
|
+
gherkinText: { type: 'string', description: 'Gherkin feature file content.' },
|
|
85
|
+
language: { type: 'string', description: 'Target language (typescript, python, php, go, csharp).' },
|
|
86
|
+
architecture: { type: 'string', description: 'Architecture style (hexagonal, ddd, clean, cqrs, serverless, microservices).' }
|
|
87
|
+
},
|
|
88
|
+
required: ['gherkinText']
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
name: 'detect_stack',
|
|
93
|
+
description: 'Auto-detect project tech stack and architecture from workspace root directory.',
|
|
94
|
+
inputSchema: {
|
|
95
|
+
type: 'object',
|
|
96
|
+
properties: {
|
|
97
|
+
projectDir: { type: 'string', description: 'Absolute path to project directory.' }
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
name: 'validate_architecture',
|
|
103
|
+
description: 'Validate Gherkin AST step coverage and layer import boundary isolation rules.',
|
|
104
|
+
inputSchema: {
|
|
105
|
+
type: 'object',
|
|
106
|
+
properties: {
|
|
107
|
+
gherkinText: { type: 'string', description: 'Gherkin feature text.' },
|
|
108
|
+
architecture: { type: 'string', description: 'Architecture style to validate against.' }
|
|
109
|
+
},
|
|
110
|
+
required: ['gherkinText']
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
]
|
|
114
|
+
});
|
|
115
|
+
break;
|
|
116
|
+
case 'tools/call':
|
|
117
|
+
handleToolCall(id, params?.name, params?.arguments || {});
|
|
118
|
+
break;
|
|
119
|
+
default:
|
|
120
|
+
if (id !== undefined) {
|
|
121
|
+
sendJsonRpcResponse(id, null, {
|
|
122
|
+
code: -32601,
|
|
123
|
+
message: `Method not found: ${method}`
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
break;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
function handleToolCall(id, name, args) {
|
|
130
|
+
try {
|
|
131
|
+
if (name === 'parse_gherkin') {
|
|
132
|
+
const parsed = (0, gherkin_parser_1.parseGherkinText)(args.gherkinText || '');
|
|
133
|
+
sendJsonRpcResponse(id, {
|
|
134
|
+
content: [{ type: 'text', text: JSON.stringify(parsed, null, 2) }]
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
else if (name === 'generate_contracts') {
|
|
138
|
+
const config = (0, config_1.loadConfig)();
|
|
139
|
+
if (args.language)
|
|
140
|
+
config.stack.language = args.language;
|
|
141
|
+
if (args.architecture)
|
|
142
|
+
config.architecture = args.architecture;
|
|
143
|
+
const parsed = (0, gherkin_parser_1.parseGherkinText)(args.gherkinText || '');
|
|
144
|
+
const output = (0, contracts_1.generateContracts)(parsed, config);
|
|
145
|
+
sendJsonRpcResponse(id, {
|
|
146
|
+
content: [{ type: 'text', text: JSON.stringify(output, null, 2) }]
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
else if (name === 'detect_stack') {
|
|
150
|
+
const targetDir = args.projectDir || process.cwd();
|
|
151
|
+
const detected = (0, stack_detector_1.detectExistingStack)(targetDir);
|
|
152
|
+
sendJsonRpcResponse(id, {
|
|
153
|
+
content: [{ type: 'text', text: JSON.stringify(detected, null, 2) }]
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
else if (name === 'validate_architecture') {
|
|
157
|
+
const parsed = (0, gherkin_parser_1.parseGherkinText)(args.gherkinText || '');
|
|
158
|
+
const arch = (0, arch_rules_1.getArchRule)(args.architecture || 'hexagonal');
|
|
159
|
+
const scorecard = {
|
|
160
|
+
featureName: parsed.featureName,
|
|
161
|
+
scenariosCount: parsed.scenarios.length,
|
|
162
|
+
commandsCount: parsed.domainAnalysis.commands.length,
|
|
163
|
+
eventsCount: parsed.domainAnalysis.events.length,
|
|
164
|
+
prohibitedImportsGuard: arch.prohibitedImports,
|
|
165
|
+
passed: parsed.scenarios.length > 0
|
|
166
|
+
};
|
|
167
|
+
sendJsonRpcResponse(id, {
|
|
168
|
+
content: [{ type: 'text', text: JSON.stringify(scorecard, null, 2) }]
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
else {
|
|
172
|
+
sendJsonRpcResponse(id, null, {
|
|
173
|
+
code: -32601,
|
|
174
|
+
message: `Unknown tool: ${name}`
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
catch (err) {
|
|
179
|
+
sendJsonRpcResponse(id, null, {
|
|
180
|
+
code: -32000,
|
|
181
|
+
message: `Tool execution failed: ${err.message}`
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
//# sourceMappingURL=mcp-server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-server.js","sourceRoot":"","sources":["../../src/mcp/mcp-server.ts"],"names":[],"mappings":";AAAA;;gFAEgF;;AAQhF,wCAwBC;AA9BD,2DAA0D;AAC1D,uDAA4D;AAC5D,2DAA6D;AAC7D,mDAAiD;AACjD,2CAA4C;AAE5C,SAAgB,cAAc;IAC5B,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;IAElC,IAAI,MAAM,GAAG,EAAE,CAAC;IAEhB,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,KAAa,EA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MAAM;gBACvC,aAAa,EAAE,MAAM,CAAC,cAAc,CAAC,QAAQ,CAAC,MAAM;gBACpD,WAAW,EAAE,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,MAAM;gBAChD,sBAAsB,EAAE,IAAI,CAAC,iBAAiB;gBAC9C,MAAM,EAAE,MAAM,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC;aACpC,CAAC;YAEF,mBAAmB,CAAC,EAAE,EAAE;gBACtB,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC;aACtE,CAAC,CAAC;QACL,CAAC;aACI,CAAC;YACJ,mBAAmB,CAAC,EAAE,EAAE,IAAI,EAAE;gBAC5B,IAAI,EAAE,CAAC,KAAK;gBACZ,OAAO,EAAE,iBAAiB,IAAI,EAAE;aACjC,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,mBAAmB,CAAC,EAAE,EAAE,IAAI,EAAE;YAC5B,IAAI,EAAE,CAAC,KAAK;YACZ,OAAO,EAAE,0BAA2B,GAAa,CAAC,OAAO,EAAE;SAC5D,CAAC,CAAC;IACL,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
# ๐ Model Context Protocol (MCP) Integration Guide for `gherkin-ai`
|
|
2
|
+
|
|
3
|
+
`gherkin-ai` CLI includes a native **Model Context Protocol (MCP)** JSON-RPC 2.0 stdio server (`ghk mcp`). This allows AI Agents (**Claude Desktop, Cursor, Antigravity, Windsurf, Roo Code, VS Code MCP Extensions**) to invoke `gherkin-ai` tools directly when editing `.feature` files or building architecture.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## ๐ Exposed MCP Tools
|
|
8
|
+
|
|
9
|
+
When connected to `ghk mcp`, AI Agents gain direct access to the following 4 tools:
|
|
10
|
+
|
|
11
|
+
1. **`parse_gherkin`**: Parses `.feature` specification text into a domain AST (commands, queries, events, actors).
|
|
12
|
+
2. **`generate_contracts`**: Generates TypeScript, OpenAPI 3.0, and native language contracts (Python, PHP, Go, C#) from Gherkin text.
|
|
13
|
+
3. **`detect_stack`**: Auto-detects project tech stack & architecture from the workspace root directory.
|
|
14
|
+
4. **`validate_architecture`**: Validates Gherkin AST step coverage and layer import boundary isolation rules.
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## ๐ ๏ธ Step-by-Step Configuration per AI Agent / IDE
|
|
19
|
+
|
|
20
|
+
### 1. Claude Desktop App
|
|
21
|
+
|
|
22
|
+
Edit your `claude_desktop_config.json`:
|
|
23
|
+
- **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
24
|
+
- **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
|
|
25
|
+
|
|
26
|
+
Add `gherkin-ai` to the `mcpServers` section:
|
|
27
|
+
|
|
28
|
+
```json
|
|
29
|
+
{
|
|
30
|
+
"mcpServers": {
|
|
31
|
+
"gherkin-ai": {
|
|
32
|
+
"command": "npx",
|
|
33
|
+
"args": ["-y", "gherkin-ai@latest", "mcp"]
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Restart Claude Desktop. You will see a hammer icon ๐จ indicating that `gherkin-ai` tools are active.
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
### 2. Cursor IDE
|
|
44
|
+
|
|
45
|
+
In Cursor, configure MCP tools via **Settings** or project configuration:
|
|
46
|
+
|
|
47
|
+
1. Open **Cursor Settings** (`Ctrl + ,` / `Cmd + ,`) โ **Features** โ **MCP Servers**.
|
|
48
|
+
2. Click **+ Add New MCP Server**.
|
|
49
|
+
3. Fill in:
|
|
50
|
+
- **Name**: `gherkin-ai`
|
|
51
|
+
- **Type**: `command` (stdio)
|
|
52
|
+
- **Command**: `npx -y gherkin-ai@latest mcp`
|
|
53
|
+
|
|
54
|
+
Or add a `.cursor/mcp.json` file in your repository:
|
|
55
|
+
|
|
56
|
+
```json
|
|
57
|
+
{
|
|
58
|
+
"mcpServers": {
|
|
59
|
+
"gherkin-ai": {
|
|
60
|
+
"command": "npx",
|
|
61
|
+
"args": ["-y", "gherkin-ai@latest", "mcp"]
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
### 3. Antigravity / VS Code MCP Extensions
|
|
70
|
+
|
|
71
|
+
In VS Code or Antigravity with MCP extension installed:
|
|
72
|
+
|
|
73
|
+
Open `settings.json` and add:
|
|
74
|
+
|
|
75
|
+
```json
|
|
76
|
+
{
|
|
77
|
+
"mcp.servers": {
|
|
78
|
+
"gherkin-ai": {
|
|
79
|
+
"command": "npx",
|
|
80
|
+
"args": ["-y", "gherkin-ai@latest", "mcp"]
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
### 4. Windsurf IDE
|
|
89
|
+
|
|
90
|
+
Add `.windsurf/mcp.json` to your user home directory or project root:
|
|
91
|
+
|
|
92
|
+
```json
|
|
93
|
+
{
|
|
94
|
+
"mcpServers": {
|
|
95
|
+
"gherkin-ai": {
|
|
96
|
+
"command": "npx",
|
|
97
|
+
"args": ["-y", "gherkin-ai@latest", "mcp"]
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
### 5. Roo Code / Continue.dev
|
|
106
|
+
|
|
107
|
+
In `~/.continue/config.json` or Roo Code settings:
|
|
108
|
+
|
|
109
|
+
```json
|
|
110
|
+
{
|
|
111
|
+
"experimental": {
|
|
112
|
+
"modelContextProtocolServers": [
|
|
113
|
+
{
|
|
114
|
+
"transport": {
|
|
115
|
+
"type": "stdio",
|
|
116
|
+
"command": "npx",
|
|
117
|
+
"args": ["-y", "gherkin-ai@latest", "mcp"]
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
]
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
## ๐งช Testing the MCP Server Connection
|
|
128
|
+
|
|
129
|
+
You can manually verify that the stdio MCP server is working by running:
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
ghk mcp
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
Send the JSON-RPC `initialize` request via stdin:
|
|
136
|
+
|
|
137
|
+
```json
|
|
138
|
+
{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"test","version":"1.0"}}}
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
The server will respond with:
|
|
142
|
+
|
|
143
|
+
```json
|
|
144
|
+
{"jsonrpc":"2.0","id":1,"result":{"protocolVersion":"2024-11-05","capabilities":{"tools":{}},"serverInfo":{"name":"gherkin-ai-mcp","version":"1.5.0"}}}
|
|
145
|
+
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gherkin-ai",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"description": "CLI tool & contract engine translating Gherkin specs into production-grade executable prompts, TypeScript contracts, and seed fixtures for AI Coding Agents.",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -35,7 +35,14 @@
|
|
|
35
35
|
"brownfield",
|
|
36
36
|
"detect",
|
|
37
37
|
"create",
|
|
38
|
-
"wizard"
|
|
38
|
+
"wizard",
|
|
39
|
+
"pydantic",
|
|
40
|
+
"python",
|
|
41
|
+
"php",
|
|
42
|
+
"laravel",
|
|
43
|
+
"go",
|
|
44
|
+
"csharp",
|
|
45
|
+
"dotnet"
|
|
39
46
|
],
|
|
40
47
|
"author": "Fenner Eduardo <contact@fennereduardo.com> (https://fennereduardo.com)",
|
|
41
48
|
"license": "MIT",
|