gherkin-ai 1.0.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/LICENSE +21 -0
- package/README.md +87 -0
- package/bin/gherkin-ai.js +21 -0
- package/dist/commands/export.d.ts +6 -0
- package/dist/commands/export.d.ts.map +1 -0
- package/dist/commands/export.js +42 -0
- package/dist/commands/export.js.map +1 -0
- package/dist/commands/generate.d.ts +5 -0
- package/dist/commands/generate.d.ts.map +1 -0
- package/dist/commands/generate.js +82 -0
- package/dist/commands/generate.js.map +1 -0
- package/dist/commands/init.d.ts +2 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +91 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/validate.d.ts +5 -0
- package/dist/commands/validate.d.ts.map +1 -0
- package/dist/commands/validate.js +48 -0
- package/dist/commands/validate.js.map +1 -0
- package/dist/core/arch-rules.d.ts +11 -0
- package/dist/core/arch-rules.d.ts.map +1 -0
- package/dist/core/arch-rules.js +91 -0
- package/dist/core/arch-rules.js.map +1 -0
- package/dist/core/config.d.ts +25 -0
- package/dist/core/config.d.ts.map +1 -0
- package/dist/core/config.js +53 -0
- package/dist/core/config.js.map +1 -0
- package/dist/core/gherkin-parser.d.ts +22 -0
- package/dist/core/gherkin-parser.d.ts.map +1 -0
- package/dist/core/gherkin-parser.js +81 -0
- package/dist/core/gherkin-parser.js.map +1 -0
- package/dist/core/stack-specs.d.ts +19 -0
- package/dist/core/stack-specs.d.ts.map +1 -0
- package/dist/core/stack-specs.js +26 -0
- package/dist/core/stack-specs.js.map +1 -0
- package/dist/generators/contracts.d.ts +7 -0
- package/dist/generators/contracts.d.ts.map +1 -0
- package/dist/generators/contracts.js +87 -0
- package/dist/generators/contracts.js.map +1 -0
- package/dist/generators/fixtures.d.ts +7 -0
- package/dist/generators/fixtures.d.ts.map +1 -0
- package/dist/generators/fixtures.js +61 -0
- package/dist/generators/fixtures.js.map +1 -0
- package/dist/generators/infra.d.ts +6 -0
- package/dist/generators/infra.d.ts.map +1 -0
- package/dist/generators/infra.js +64 -0
- package/dist/generators/infra.js.map +1 -0
- package/dist/generators/prompts.d.ts +4 -0
- package/dist/generators/prompts.d.ts.map +1 -0
- package/dist/generators/prompts.js +74 -0
- package/dist/generators/prompts.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +48 -0
- package/dist/index.js.map +1 -0
- package/dist/utils/file-system.d.ts +5 -0
- package/dist/utils/file-system.d.ts.map +1 -0
- package/dist/utils/file-system.js +31 -0
- package/dist/utils/file-system.js.map +1 -0
- package/dist/utils/logger.d.ts +8 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +28 -0
- package/dist/utils/logger.js.map +1 -0
- package/docs/ARCHITECTURE.md +63 -0
- package/docs/USAGE_GUIDE.md +125 -0
- package/package.json +62 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Fenner Eduardo
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# 🥒 `gherkin-ai` CLI
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/gherkin-ai)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
|
|
6
|
+
> **Bridge the gap between business specifications and AI Coding Agents.**
|
|
7
|
+
> Convert Gherkin `.feature` files into production-ready TypeScript contracts, Zod schemas, deterministic test seeds, and role-specialized executable prompt packages for AI Agents (**Claude Code, Cursor, Antigravity, Windsurf, GitHub Copilot Workspace**).
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## 🌟 Why `gherkin-ai`?
|
|
12
|
+
|
|
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
|
+
|
|
15
|
+
`gherkin-ai` CLI solves this by generating **deterministic technical rails**:
|
|
16
|
+
- **`contracts.ts`**: Strict domain interfaces, event schemas, Zod DTOs, and Architecture Decision Records (ADRs).
|
|
17
|
+
- **`fixtures.ts` & `seed.sql`**: Concrete database seeds (hashed passwords, bcrypt cost factor 12, pre-conditions) to make `Given` steps executable.
|
|
18
|
+
- **Strict Stack Versions**: Enforces explicit package versions (e.g., NestJS v10 + Prisma + Zod + Redis) so agents never diverge.
|
|
19
|
+
- **Runnable Infrastructure**: Includes pre-configured `docker-compose.yml` and `.env.example`.
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## 🚀 Quick Start
|
|
24
|
+
|
|
25
|
+
Run instantly with `npx`:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
# 1. Initialize project configuration interactively
|
|
29
|
+
npx gherkin-ai init
|
|
30
|
+
|
|
31
|
+
# 2. Generate contracts, fixtures, and AI agent prompts from your feature file
|
|
32
|
+
npx gherkin-ai generate --feature ./specs/auth.feature
|
|
33
|
+
|
|
34
|
+
# 3. Validate architecture rules and Gherkin compliance
|
|
35
|
+
npx gherkin-ai validate --feature ./specs/auth.feature
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Or install globally:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
npm install -g gherkin-ai
|
|
42
|
+
gherkin-ai --help
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## 🏗️ Supported Architecture Styles
|
|
48
|
+
|
|
49
|
+
- **Hexagonal Architecture (Ports & Adapters)**
|
|
50
|
+
- **Domain-Driven Design (DDD)**
|
|
51
|
+
- **Clean Architecture**
|
|
52
|
+
- **CQRS + Event Sourcing**
|
|
53
|
+
- **Microservices Architecture**
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## 📦 Generated Artifacts Structure
|
|
58
|
+
|
|
59
|
+
Running `gherkin-ai generate` produces the following folder structure:
|
|
60
|
+
|
|
61
|
+
```text
|
|
62
|
+
generated-specs/
|
|
63
|
+
├── contracts.ts # Interfaces, Zod schemas & repository ports
|
|
64
|
+
├── fixtures.ts # Test seed functions (bcrypt, Given setup)
|
|
65
|
+
├── seed.sql # Raw SQL initialization script
|
|
66
|
+
├── docker-compose.yml # Pre-configured PostgreSQL, Redis, RabbitMQ
|
|
67
|
+
├── .env.example # Environment variables template
|
|
68
|
+
├── ADR-001-architecture-decisions.md # Architecture Decision Record
|
|
69
|
+
└── prompts/
|
|
70
|
+
├── domain-agent.md # Instructions for Domain Architect Agent
|
|
71
|
+
├── backend-agent.md # Instructions for Backend Developer Agent
|
|
72
|
+
└── qa-agent.md # Instructions for QA Automation Agent
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## 📖 Complete Documentation
|
|
78
|
+
|
|
79
|
+
- [Comprehensive Usage Guide](docs/USAGE_GUIDE.md)
|
|
80
|
+
- [CLI Architecture & Agent Pipeline](docs/ARCHITECTURE.md)
|
|
81
|
+
- [Live Web SPA Playground](https://fennereduardo.com/pages/GherkinIATool/)
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## 📄 License
|
|
86
|
+
|
|
87
|
+
Distributed under the [MIT License](LICENSE). Created by [Fenner Eduardo](https://fennereduardo.com).
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const path = require('path');
|
|
4
|
+
const fs = require('fs');
|
|
5
|
+
|
|
6
|
+
// Check if compiled dist directory exists
|
|
7
|
+
const distIndex = path.join(__dirname, '../dist/index.js');
|
|
8
|
+
const srcIndex = path.join(__dirname, '../src/index.ts');
|
|
9
|
+
|
|
10
|
+
if (fs.existsSync(distIndex)) {
|
|
11
|
+
require(distIndex);
|
|
12
|
+
} else {
|
|
13
|
+
try {
|
|
14
|
+
require('ts-node/register');
|
|
15
|
+
require(srcIndex);
|
|
16
|
+
} catch (err) {
|
|
17
|
+
console.error('Error starting gherkin-ai CLI. Please build the project first using "npm run build".');
|
|
18
|
+
console.error(err);
|
|
19
|
+
process.exit(1);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"export.d.ts","sourceRoot":"","sources":["../../src/commands/export.ts"],"names":[],"mappings":"AAWA,wBAAsB,mBAAmB,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,CA+BxH"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* ==========================================================================
|
|
3
|
+
gherkin-ai-cli - 'export' Command Handler
|
|
4
|
+
========================================================================== */
|
|
5
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
6
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.handleExportCommand = handleExportCommand;
|
|
10
|
+
const path_1 = __importDefault(require("path"));
|
|
11
|
+
const config_1 = require("../core/config");
|
|
12
|
+
const gherkin_parser_1 = require("../core/gherkin-parser");
|
|
13
|
+
const arch_rules_1 = require("../core/arch-rules");
|
|
14
|
+
const file_system_1 = require("../utils/file-system");
|
|
15
|
+
const logger_1 = require("../utils/logger");
|
|
16
|
+
async function handleExportCommand(options) {
|
|
17
|
+
logger_1.logger.banner();
|
|
18
|
+
const config = (0, config_1.loadConfig)();
|
|
19
|
+
const arch = (0, arch_rules_1.getArchRule)(config.architecture);
|
|
20
|
+
let gherkinText = `Feature: Default Spec\n Scenario: Standard Scenario\n Given system is ready\n When request is received\n Then response is ok`;
|
|
21
|
+
if (options.feature) {
|
|
22
|
+
const fPath = path_1.default.resolve(process.cwd(), options.feature);
|
|
23
|
+
if ((0, file_system_1.fileExistsSync)(fPath)) {
|
|
24
|
+
gherkinText = (0, file_system_1.readFileSync)(fPath);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
const parsed = (0, gherkin_parser_1.parseGherkinText)(gherkinText);
|
|
28
|
+
const isJson = options.format === 'json';
|
|
29
|
+
const exportPayload = isJson
|
|
30
|
+
? JSON.stringify({
|
|
31
|
+
agentContext: 'gherkin-ai CLI Export',
|
|
32
|
+
timestamp: new Date().toISOString(),
|
|
33
|
+
config,
|
|
34
|
+
architecture: arch,
|
|
35
|
+
parsedFeature: parsed
|
|
36
|
+
}, null, 2)
|
|
37
|
+
: `# AGENT EXPORT BUNDLE - ${parsed.featureName}\n\nArchitecture: ${arch.name}\nLanguage: ${config.stack.language}\nFramework: ${config.stack.framework}\n\n## Requirements\n${parsed.scenarios.map(s => `- Scenario: ${s.name}`).join('\n')}`;
|
|
38
|
+
const destFile = options.output || path_1.default.join(process.cwd(), `agent-bundle.${isJson ? 'json' : 'md'}`);
|
|
39
|
+
(0, file_system_1.writeFileSync)(destFile, exportPayload);
|
|
40
|
+
logger_1.logger.success(`Exported AI Agent bundle to: ${destFile}`);
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=export.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"export.js","sourceRoot":"","sources":["../../src/commands/export.ts"],"names":[],"mappings":";AAAA;;gFAEgF;;;;;AAShF,kDA+BC;AAtCD,gDAAwB;AACxB,2CAA4C;AAC5C,2DAA0D;AAC1D,mDAAiD;AACjD,sDAAmF;AACnF,4CAAyC;AAElC,KAAK,UAAU,mBAAmB,CAAC,OAA+D;IACvG,eAAM,CAAC,MAAM,EAAE,CAAC;IAChB,MAAM,MAAM,GAAG,IAAA,mBAAU,GAAE,CAAC;IAC5B,MAAM,IAAI,GAAG,IAAA,wBAAW,EAAC,MAAM,CAAC,YAAY,CAAC,CAAC;IAE9C,IAAI,WAAW,GAAG,wIAAwI,CAAC;IAE3J,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;QACpB,MAAM,KAAK,GAAG,cAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;QAC3D,IAAI,IAAA,4BAAc,EAAC,KAAK,CAAC,EAAE,CAAC;YAC1B,WAAW,GAAG,IAAA,0BAAY,EAAC,KAAK,CAAC,CAAC;QACpC,CAAC;IACH,CAAC;IAED,MAAM,MAAM,GAAG,IAAA,iCAAgB,EAAC,WAAW,CAAC,CAAC;IAC7C,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,KAAK,MAAM,CAAC;IAEzC,MAAM,aAAa,GAAG,MAAM;QAC1B,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC;YACb,YAAY,EAAE,uBAAuB;YACrC,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACnC,MAAM;YACN,YAAY,EAAE,IAAI;YAClB,aAAa,EAAE,MAAM;SACtB,EAAE,IAAI,EAAE,CAAC,CAAC;QACb,CAAC,CAAC,2BAA2B,MAAM,CAAC,WAAW,qBAAqB,IAAI,CAAC,IAAI,eAAe,MAAM,CAAC,KAAK,CAAC,QAAQ,gBAAgB,MAAM,CAAC,KAAK,CAAC,SAAS,wBAAwB,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,eAAe,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;IAEjP,MAAM,QAAQ,GAAG,OAAO,CAAC,MAAM,IAAI,cAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,gBAAgB,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;IACtG,IAAA,2BAAa,EAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;IAEvC,eAAM,CAAC,OAAO,CAAC,gCAAgC,QAAQ,EAAE,CAAC,CAAC;AAC7D,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../src/commands/generate.ts"],"names":[],"mappings":"AAiCA,wBAAsB,qBAAqB,CAAC,OAAO,EAAE;IAAE,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAmDzG"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* ==========================================================================
|
|
3
|
+
gherkin-ai-cli - 'generate' Command Handler
|
|
4
|
+
========================================================================== */
|
|
5
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
6
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.handleGenerateCommand = handleGenerateCommand;
|
|
10
|
+
const path_1 = __importDefault(require("path"));
|
|
11
|
+
const config_1 = require("../core/config");
|
|
12
|
+
const gherkin_parser_1 = require("../core/gherkin-parser");
|
|
13
|
+
const contracts_1 = require("../generators/contracts");
|
|
14
|
+
const fixtures_1 = require("../generators/fixtures");
|
|
15
|
+
const prompts_1 = require("../generators/prompts");
|
|
16
|
+
const infra_1 = require("../generators/infra");
|
|
17
|
+
const file_system_1 = require("../utils/file-system");
|
|
18
|
+
const logger_1 = require("../utils/logger");
|
|
19
|
+
const DEFAULT_SAMPLE_GHERKIN = `Feature: User Authentication & Token Issuance
|
|
20
|
+
As a registered user
|
|
21
|
+
I want to authenticate using valid credentials
|
|
22
|
+
So that I obtain a JWT token to access protected APIs
|
|
23
|
+
|
|
24
|
+
Scenario: Successful login with valid credentials
|
|
25
|
+
Given a registered user exists with email "dev@example.com" and password "Pass123!"
|
|
26
|
+
When sending an authentication request with email "dev@example.com" and password "Pass123!"
|
|
27
|
+
Then the system responds with HTTP status 200 OK
|
|
28
|
+
And returns a short-lived access JWT token
|
|
29
|
+
And emits a "UserAuthenticated" domain event
|
|
30
|
+
|
|
31
|
+
Scenario: Rejected login with wrong password
|
|
32
|
+
Given a registered user exists with email "dev@example.com"
|
|
33
|
+
When sending an authentication request with wrong password "WrongPass"
|
|
34
|
+
Then the system responds with HTTP status 401 Unauthorized
|
|
35
|
+
And returns error message "Invalid credentials"
|
|
36
|
+
`;
|
|
37
|
+
async function handleGenerateCommand(options) {
|
|
38
|
+
logger_1.logger.banner();
|
|
39
|
+
const config = (0, config_1.loadConfig)(options.config);
|
|
40
|
+
let gherkinText = DEFAULT_SAMPLE_GHERKIN;
|
|
41
|
+
if (options.feature) {
|
|
42
|
+
const featurePath = path_1.default.resolve(process.cwd(), options.feature);
|
|
43
|
+
if ((0, file_system_1.fileExistsSync)(featurePath)) {
|
|
44
|
+
gherkinText = (0, file_system_1.readFileSync)(featurePath);
|
|
45
|
+
logger_1.logger.info(`Loaded feature specification from: ${featurePath}`);
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
logger_1.logger.warn(`Feature file not found at ${featurePath}. Using default sample feature.`);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
logger_1.logger.info('No feature file specified. Using built-in sample feature spec.');
|
|
53
|
+
}
|
|
54
|
+
logger_1.logger.info('Parsing Gherkin specification and extracting domain AST...');
|
|
55
|
+
const parsed = (0, gherkin_parser_1.parseGherkinText)(gherkinText);
|
|
56
|
+
logger_1.logger.info(`Target Output Directory: ${config.outputDir}`);
|
|
57
|
+
// 1. Generate Contracts & ADR
|
|
58
|
+
const { contractsTs, adrMd } = (0, contracts_1.generateContracts)(parsed, config);
|
|
59
|
+
(0, file_system_1.writeFileSync)(path_1.default.join(config.outputDir, 'contracts.ts'), contractsTs);
|
|
60
|
+
(0, file_system_1.writeFileSync)(path_1.default.join(config.outputDir, 'ADR-001-architecture-decisions.md'), adrMd);
|
|
61
|
+
logger_1.logger.success('Generated contracts.ts and ADR-001-architecture-decisions.md');
|
|
62
|
+
// 2. Generate Test Fixtures & Seeds
|
|
63
|
+
const { fixturesTs, seedSql } = (0, fixtures_1.generateFixtures)(parsed, config);
|
|
64
|
+
(0, file_system_1.writeFileSync)(path_1.default.join(config.outputDir, 'fixtures.ts'), fixturesTs);
|
|
65
|
+
(0, file_system_1.writeFileSync)(path_1.default.join(config.outputDir, 'seed.sql'), seedSql);
|
|
66
|
+
logger_1.logger.success('Generated fixtures.ts and seed.sql');
|
|
67
|
+
// 3. Generate Agent Prompts
|
|
68
|
+
const prompts = (0, prompts_1.generatePrompts)(parsed, config);
|
|
69
|
+
Object.keys(prompts).forEach(filename => {
|
|
70
|
+
(0, file_system_1.writeFileSync)(path_1.default.join(config.outputDir, 'prompts', filename), prompts[filename]);
|
|
71
|
+
});
|
|
72
|
+
logger_1.logger.success('Generated domain, backend, and QA prompt markdown files in prompts/');
|
|
73
|
+
// 4. Generate Infrastructure Config
|
|
74
|
+
const { dockerComposeYaml, envExample } = (0, infra_1.generateInfra)(config);
|
|
75
|
+
(0, file_system_1.writeFileSync)(path_1.default.join(config.outputDir, 'docker-compose.yml'), dockerComposeYaml);
|
|
76
|
+
(0, file_system_1.writeFileSync)(path_1.default.join(config.outputDir, '.env.example'), envExample);
|
|
77
|
+
logger_1.logger.success('Generated docker-compose.yml and .env.example');
|
|
78
|
+
logger_1.logger.banner();
|
|
79
|
+
logger_1.logger.success(`All artifacts successfully generated under ${config.outputDir}!`);
|
|
80
|
+
logger_1.logger.info('Ready for AI Agents (Claude Code, Cursor, Antigravity, Copilot).');
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=generate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate.js","sourceRoot":"","sources":["../../src/commands/generate.ts"],"names":[],"mappings":";AAAA;;gFAEgF;;;;;AA+BhF,sDAmDC;AAhFD,gDAAwB;AACxB,2CAA4C;AAC5C,2DAA0D;AAC1D,uDAA4D;AAC5D,qDAA0D;AAC1D,mDAAwD;AACxD,+CAAoD;AACpD,sDAAmF;AACnF,4CAAyC;AAEzC,MAAM,sBAAsB,GAAG;;;;;;;;;;;;;;;;;CAiB9B,CAAC;AAEK,KAAK,UAAU,qBAAqB,CAAC,OAA8C;IACxF,eAAM,CAAC,MAAM,EAAE,CAAC;IAEhB,MAAM,MAAM,GAAG,IAAA,mBAAU,EAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAC1C,IAAI,WAAW,GAAG,sBAAsB,CAAC;IAEzC,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;QACpB,MAAM,WAAW,GAAG,cAAI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,OAAO,CAAC,IAAI,CAAC,CAgFvD"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* ==========================================================================
|
|
3
|
+
gherkin-ai-cli - 'init' Command Handler (Interactive CLI Wizard)
|
|
4
|
+
========================================================================== */
|
|
5
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
6
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.handleInitCommand = handleInitCommand;
|
|
10
|
+
const inquirer_1 = __importDefault(require("inquirer"));
|
|
11
|
+
const config_1 = require("../core/config");
|
|
12
|
+
const logger_1 = require("../utils/logger");
|
|
13
|
+
async function handleInitCommand() {
|
|
14
|
+
logger_1.logger.banner();
|
|
15
|
+
logger_1.logger.info('Initializing new gherkin-ai project configuration...');
|
|
16
|
+
const answers = await inquirer_1.default.prompt([
|
|
17
|
+
{
|
|
18
|
+
type: 'input',
|
|
19
|
+
name: 'projectName',
|
|
20
|
+
message: 'What is your project name?',
|
|
21
|
+
default: config_1.defaultConfig.projectName
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
type: 'list',
|
|
25
|
+
name: 'architecture',
|
|
26
|
+
message: 'Select primary software architecture:',
|
|
27
|
+
choices: [
|
|
28
|
+
{ name: 'Hexagonal Architecture (Ports & Adapters)', value: 'hexagonal' },
|
|
29
|
+
{ name: 'Domain-Driven Design (DDD)', value: 'ddd' },
|
|
30
|
+
{ name: 'Clean Architecture', value: 'clean' },
|
|
31
|
+
{ name: 'CQRS + Event Sourcing', value: 'cqrs' },
|
|
32
|
+
{ name: 'Microservices Architecture', value: 'microservices' }
|
|
33
|
+
],
|
|
34
|
+
default: 'hexagonal'
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
type: 'list',
|
|
38
|
+
name: 'language',
|
|
39
|
+
message: 'Select programming language / runtime:',
|
|
40
|
+
choices: ['typescript', 'javascript', 'python', 'java', 'csharp', 'go'],
|
|
41
|
+
default: 'typescript'
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
type: 'list',
|
|
45
|
+
name: 'framework',
|
|
46
|
+
message: 'Select primary framework:',
|
|
47
|
+
choices: ['nestjs', 'express', 'fastify', 'spring-boot', 'fastapi', 'aspnet'],
|
|
48
|
+
default: 'nestjs'
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
type: 'list',
|
|
52
|
+
name: 'orm',
|
|
53
|
+
message: 'Select database ORM / persistence:',
|
|
54
|
+
choices: ['prisma', 'drizzle', 'typeorm', 'sqlalchemy'],
|
|
55
|
+
default: 'prisma'
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
type: 'list',
|
|
59
|
+
name: 'database',
|
|
60
|
+
message: 'Select primary database engine:',
|
|
61
|
+
choices: ['postgresql', 'mysql', 'mongodb', 'redis'],
|
|
62
|
+
default: 'postgresql'
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
type: 'input',
|
|
66
|
+
name: 'outputDir',
|
|
67
|
+
message: 'Specify directory for generated contracts and prompts:',
|
|
68
|
+
default: './generated-specs'
|
|
69
|
+
}
|
|
70
|
+
]);
|
|
71
|
+
const newConfig = {
|
|
72
|
+
projectName: answers.projectName,
|
|
73
|
+
architecture: answers.architecture,
|
|
74
|
+
stack: {
|
|
75
|
+
language: answers.language,
|
|
76
|
+
framework: answers.framework,
|
|
77
|
+
orm: answers.orm,
|
|
78
|
+
database: answers.database,
|
|
79
|
+
validation: 'zod',
|
|
80
|
+
auth: 'jwt-bcrypt',
|
|
81
|
+
messaging: 'rabbitmq',
|
|
82
|
+
testing: 'jest'
|
|
83
|
+
},
|
|
84
|
+
rules: config_1.defaultConfig.rules,
|
|
85
|
+
outputDir: answers.outputDir
|
|
86
|
+
};
|
|
87
|
+
(0, config_1.saveConfig)(newConfig);
|
|
88
|
+
logger_1.logger.success('Successfully created gherkin-ai.config.json');
|
|
89
|
+
logger_1.logger.info('Next step: Run "npx gherkin-ai generate --feature ./your-feature.feature"');
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=init.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":";AAAA;;gFAEgF;;;;;AAMhF,8CAgFC;AApFD,wDAAgC;AAChC,2CAA4E;AAC5E,4CAAyC;AAElC,KAAK,UAAU,iBAAiB;IACrC,eAAM,CAAC,MAAM,EAAE,CAAC;IAChB,eAAM,CAAC,IAAI,CAAC,sDAAsD,CAAC,CAAC;IAEpE,MAAM,OAAO,GAAG,MAAM,kBAAQ,CAAC,MAAM,CAAC;QACpC;YACE,IAAI,EAAE,OAAO;YACb,IAAI,EAAE,aAAa;YACnB,OAAO,EAAE,4BAA4B;YACrC,OAAO,EAAE,sBAAa,CAAC,WAAW;SACnC;QACD;YACE,IAAI,EAAE,MAAM;YACZ,IAAI,EAAE,cAAc;YACpB,OAAO,EAAE,uCAAuC;YAChD,OAAO,EAAE;gBACP,EAAE,IAAI,EAAE,2CAA2C,EAAE,KAAK,EAAE,WAAW,EAAE;gBACzE,EAAE,IAAI,EAAE,4BAA4B,EAAE,KAAK,EAAE,KAAK,EAAE;gBACpD,EAAE,IAAI,EAAE,oBAAoB,EAAE,KAAK,EAAE,OAAO,EAAE;gBAC9C,EAAE,IAAI,EAAE,uBAAuB,EAAE,KAAK,EAAE,MAAM,EAAE;gBAChD,EAAE,IAAI,EAAE,4BAA4B,EAAE,KAAK,EAAE,eAAe,EAAE;aAC/D;YACD,OAAO,EAAE,WAAW;SACrB;QACD;YACE,IAAI,EAAE,MAAM;YACZ,IAAI,EAAE,UAAU;YAChB,OAAO,EAAE,wCAAwC;YACjD,OAAO,EAAE,CAAC,YAAY,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,CAAC;YACvE,OAAO,EAAE,YAAY;SACtB;Q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AA6C,CAAC,CAAC;IAC9D,eAAM,CAAC,IAAI,CAAC,2EAA2E,CAAC,CAAC;AAC3F,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../src/commands/validate.ts"],"names":[],"mappings":"AAWA,wBAAsB,qBAAqB,CAAC,OAAO,EAAE;IAAE,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAiCzG"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* ==========================================================================
|
|
3
|
+
gherkin-ai-cli - 'validate' Command Handler
|
|
4
|
+
========================================================================== */
|
|
5
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
6
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.handleValidateCommand = handleValidateCommand;
|
|
10
|
+
const path_1 = __importDefault(require("path"));
|
|
11
|
+
const config_1 = require("../core/config");
|
|
12
|
+
const arch_rules_1 = require("../core/arch-rules");
|
|
13
|
+
const gherkin_parser_1 = require("../core/gherkin-parser");
|
|
14
|
+
const file_system_1 = require("../utils/file-system");
|
|
15
|
+
const logger_1 = require("../utils/logger");
|
|
16
|
+
async function handleValidateCommand(options) {
|
|
17
|
+
logger_1.logger.banner();
|
|
18
|
+
logger_1.logger.info('Validating project architecture and feature spec compliance...');
|
|
19
|
+
const config = (0, config_1.loadConfig)(options.config);
|
|
20
|
+
const arch = (0, arch_rules_1.getArchRule)(config.architecture);
|
|
21
|
+
logger_1.logger.info(`Loaded config: Architecture = ${arch.name}, Language = ${config.stack.language}`);
|
|
22
|
+
let errorsCount = 0;
|
|
23
|
+
if (options.feature) {
|
|
24
|
+
const featurePath = path_1.default.resolve(process.cwd(), options.feature);
|
|
25
|
+
if (!(0, file_system_1.fileExistsSync)(featurePath)) {
|
|
26
|
+
logger_1.logger.error(`Feature file not found at ${featurePath}`);
|
|
27
|
+
errorsCount++;
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
const gherkinText = (0, file_system_1.readFileSync)(featurePath);
|
|
31
|
+
const parsed = (0, gherkin_parser_1.parseGherkinText)(gherkinText);
|
|
32
|
+
if (parsed.scenarios.length === 0) {
|
|
33
|
+
logger_1.logger.warn('Feature file contains zero valid scenarios.');
|
|
34
|
+
errorsCount++;
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
logger_1.logger.success(`Gherkin Spec Validated: Found ${parsed.scenarios.length} scenario(s).`);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
if (errorsCount === 0) {
|
|
42
|
+
logger_1.logger.success('Architecture rules validation PASSED with 0 errors.');
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
logger_1.logger.error(`Validation completed with ${errorsCount} issue(s).`);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=validate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate.js","sourceRoot":"","sources":["../../src/commands/validate.ts"],"names":[],"mappings":";AAAA;;gFAEgF;;;;;AAShF,sDAiCC;AAxCD,gDAAwB;AACxB,2CAA4C;AAC5C,mDAAiD;AACjD,2DAA0D;AAC1D,sDAAoE;AACpE,4CAAyC;AAElC,KAAK,UAAU,qBAAqB,CAAC,OAA8C;IACxF,eAAM,CAAC,MAAM,EAAE,CAAC;IAChB,eAAM,CAAC,IAAI,CAAC,gEAAgE,CAAC,CAAC;IAE9E,MAAM,MAAM,GAAG,IAAA,mBAAU,EAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAC1C,MAAM,IAAI,GAAG,IAAA,wBAAW,EAAC,MAAM,CAAC,YAAY,CAAC,CAAC;IAE9C,eAAM,CAAC,IAAI,CAAC,iCA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Imports: string[];
|
|
8
|
+
}
|
|
9
|
+
export declare const ARCH_RULES: Record<string, ArchRuleSpec>;
|
|
10
|
+
export declare function getArchRule(archId: string): ArchRuleSpec;
|
|
11
|
+
//# sourceMappingURL=arch-rules.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"arch-rules.d.ts","sourceRoot":"","sources":["../../src/core/arch-rules.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;IACxB,iBAAiB,EAAE,MAAM,EAAE,CAAC;CAC7B;AAED,eAAO,MAAM,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CA+EnD,CAAC;AAEF,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,CAExD"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* ==========================================================================
|
|
3
|
+
gherkin-ai-cli - Architecture Rule Engine & Pattern Definitions
|
|
4
|
+
========================================================================== */
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ARCH_RULES = void 0;
|
|
7
|
+
exports.getArchRule = getArchRule;
|
|
8
|
+
exports.ARCH_RULES = {
|
|
9
|
+
ddd: {
|
|
10
|
+
id: 'ddd',
|
|
11
|
+
name: 'Domain-Driven Design (DDD)',
|
|
12
|
+
description: 'Business domain-driven design focused on Bounded Contexts, Aggregates, Entities, Value Objects, Domain Events, and Repositories.',
|
|
13
|
+
patterns: ['Bounded Context', 'Aggregate Root', 'Entity', 'Value Object', 'Domain Service', 'Repository Port', 'Domain Event', 'Application Use Case'],
|
|
14
|
+
folderStructure: `src/
|
|
15
|
+
├── domain/
|
|
16
|
+
│ ├── entities/
|
|
17
|
+
│ ├── value-objects/
|
|
18
|
+
│ ├── aggregates/
|
|
19
|
+
│ ├── events/
|
|
20
|
+
│ └── ports/
|
|
21
|
+
├── application/
|
|
22
|
+
│ ├── use-cases/
|
|
23
|
+
│ └── dtos/
|
|
24
|
+
└── infrastructure/
|
|
25
|
+
├── persistence/
|
|
26
|
+
└── http/`,
|
|
27
|
+
prohibitedImports: ['express', '@nestjs/common', 'prisma', 'typeorm', 'pg']
|
|
28
|
+
},
|
|
29
|
+
hexagonal: {
|
|
30
|
+
id: 'hexagonal',
|
|
31
|
+
name: 'Hexagonal Architecture (Ports & Adapters)',
|
|
32
|
+
description: 'Isolated domain core connected to external frameworks via inbound and outbound ports and adapters.',
|
|
33
|
+
patterns: ['Inbound Port', 'Outbound Port', 'Inbound Adapter (HTTP/CLI)', 'Outbound Adapter (DB/Queue)', 'Domain Core'],
|
|
34
|
+
folderStructure: `src/
|
|
35
|
+
├── core/
|
|
36
|
+
│ ├── domain/
|
|
37
|
+
│ └── ports/
|
|
38
|
+
│ ├── inbound/
|
|
39
|
+
│ └── outbound/
|
|
40
|
+
├── adapters/
|
|
41
|
+
│ ├── inbound/ (http controllers)
|
|
42
|
+
│ └── outbound/ (repositories)
|
|
43
|
+
└── config/`,
|
|
44
|
+
prohibitedImports: ['express', '@nestjs/common', 'prisma', 'typeorm', 'axios']
|
|
45
|
+
},
|
|
46
|
+
cqrs: {
|
|
47
|
+
id: 'cqrs',
|
|
48
|
+
name: 'CQRS + Event Sourcing',
|
|
49
|
+
description: 'Strict separation of command operations (writes) and query operations (reads) with read model projections.',
|
|
50
|
+
patterns: ['Command Handler', 'Query Handler', 'Event Store', 'Read Model Projection', 'Write Aggregate', 'Event Publisher'],
|
|
51
|
+
folderStructure: `src/
|
|
52
|
+
├── commands/
|
|
53
|
+
│ ├── handlers/
|
|
54
|
+
│ └── models/
|
|
55
|
+
├── queries/
|
|
56
|
+
│ ├── handlers/
|
|
57
|
+
│ └── projections/
|
|
58
|
+
└── events/
|
|
59
|
+
├── store/
|
|
60
|
+
└── schemas/`,
|
|
61
|
+
prohibitedImports: ['express', '@nestjs/common']
|
|
62
|
+
},
|
|
63
|
+
clean: {
|
|
64
|
+
id: 'clean',
|
|
65
|
+
name: 'Clean Architecture',
|
|
66
|
+
description: 'Dependency rule pointing strictly inward: Entities -> Use Cases -> Interface Adapters -> Frameworks & Drivers.',
|
|
67
|
+
patterns: ['Entity', 'Use Case', 'Presenter', 'Controller', 'Gateway', 'Framework Driver'],
|
|
68
|
+
folderStructure: `src/
|
|
69
|
+
├── entities/
|
|
70
|
+
├── use-cases/
|
|
71
|
+
├── interface-adapters/
|
|
72
|
+
└── frameworks-drivers/`,
|
|
73
|
+
prohibitedImports: ['express', '@nestjs/common', 'prisma']
|
|
74
|
+
},
|
|
75
|
+
microservices: {
|
|
76
|
+
id: 'microservices',
|
|
77
|
+
name: 'Microservices Architecture',
|
|
78
|
+
description: 'Decoupled services communicating via API Gateways and Message Buses with a database per service.',
|
|
79
|
+
patterns: ['API Gateway', 'Service Boundary', 'Saga Orchestrator', 'Event Bus', 'Database per Service', 'Circuit Breaker'],
|
|
80
|
+
folderStructure: `services/
|
|
81
|
+
├── service-core/
|
|
82
|
+
├── api-gateway/
|
|
83
|
+
└── shared/
|
|
84
|
+
└── events/`,
|
|
85
|
+
prohibitedImports: []
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
function getArchRule(archId) {
|
|
89
|
+
return exports.ARCH_RULES[archId] || exports.ARCH_RULES['hexagonal'];
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=arch-rules.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"arch-rules.js","sourceRoot":"","sources":["../../src/core/arch-rules.ts"],"names":[],"mappings":";AAAA;;gFAEgF;;;AA4FhF,kCAEC;AAnFY,QAAA,UAAU,GAAiC;IACtD,GAAG,EAAE;QACH,EAAE,EAAE,KAAK;QACT,IAAI,EAAE,4BAA4B;QAClC,WAAW,EAA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IAAI,EAAE,4BAA4B;QAClC,WAAW,EAAE,kGAAkG;QAC/G,QAAQ,EAAE,CAAC,aAAa,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,WAAW,EAAE,sBAAsB,EAAE,iBAAiB,CAAC;QAC1H,eAAe,EAAE;;;;kBAIH;QACd,iBAAiB,EAAE,EAAE;KACtB;CACF,CAAC;AAEF,SAAgB,WAAW,CAAC,MAAc;IACxC,OAAO,kBAAU,CAAC,MAAM,CAAC,IAAI,kBAAU,CAAC,WAAW,CAAC,CAAC;AACvD,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export interface GherkinAIConfig {
|
|
2
|
+
projectName: string;
|
|
3
|
+
architecture: 'ddd' | 'hexagonal' | 'clean' | 'cqrs' | 'microservices' | 'monolith' | 'modular' | 'api-rest' | 'serverless' | 'event-driven';
|
|
4
|
+
stack: {
|
|
5
|
+
language: string;
|
|
6
|
+
framework: string;
|
|
7
|
+
orm: string;
|
|
8
|
+
database: string;
|
|
9
|
+
validation: string;
|
|
10
|
+
auth: string;
|
|
11
|
+
messaging?: string;
|
|
12
|
+
testing: string;
|
|
13
|
+
};
|
|
14
|
+
rules: {
|
|
15
|
+
bcryptCostFactor?: number;
|
|
16
|
+
jwtTtlSeconds?: number;
|
|
17
|
+
strictLayerBoundaries?: boolean;
|
|
18
|
+
coverageTarget?: number;
|
|
19
|
+
};
|
|
20
|
+
outputDir: string;
|
|
21
|
+
}
|
|
22
|
+
export declare const defaultConfig: GherkinAIConfig;
|
|
23
|
+
export declare function loadConfig(configPath?: string): GherkinAIConfig;
|
|
24
|
+
export declare function saveConfig(config: GherkinAIConfig, configPath?: string): void;
|
|
25
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/core/config.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,eAAe;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,KAAK,GAAG,WAAW,GAAG,OAAO,GAAG,MAAM,GAAG,eAAe,GAAG,UAAU,GAAG,SAAS,GAAG,UAAU,GAAG,YAAY,GAAG,cAAc,CAAC;IAC7I,KAAK,EAAE;QACL,QAAQ,EAAE,MAAM,CAAC;QACjB,SAAS,EAAE,MAAM,CAAC;QAClB,GAAG,EAAE,MAAM,CAAC;QACZ,QAAQ,EAAE,MAAM,CAAC;QACjB,UAAU,EAAE,MAAM,CAAC;QACnB,IAAI,EAAE,MAAM,CAAC;QACb,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,KAAK,EAAE;QACL,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAC1B,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,qBAAqB,CAAC,EAAE,OAAO,CAAC;QAChC,cAAc,CAAC,EAAE,MAAM,CAAC;KACzB,CAAC;IACF,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,eAAO,MAAM,aAAa,EAAE,eAoB3B,CAAC;AAEF,wBAAgB,UAAU,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,eAAe,CAc/D;AAED,wBAAgB,UAAU,CAAC,MAAM,EAAE,eAAe,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAG7E"}
|