opsx-gherkin 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.
Files changed (32) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/CONTRIBUTING.md +53 -0
  3. package/LICENSE +21 -0
  4. package/README.md +99 -0
  5. package/SECURITY.md +14 -0
  6. package/dist/cli.mjs +50 -0
  7. package/dist/cli.mjs.map +1 -0
  8. package/dist/converter-CFtzcfoM.mjs +977 -0
  9. package/dist/converter-CFtzcfoM.mjs.map +1 -0
  10. package/dist/mdg-to-opsx.mjs +8 -0
  11. package/dist/mdg-to-opsx.mjs.map +1 -0
  12. package/dist/official-99qBUZpr.mjs +91 -0
  13. package/dist/official-99qBUZpr.mjs.map +1 -0
  14. package/dist/opsx-to-feature.mjs +8 -0
  15. package/dist/opsx-to-feature.mjs.map +1 -0
  16. package/dist/opsx-to-mdg.mjs +8 -0
  17. package/dist/opsx-to-mdg.mjs.map +1 -0
  18. package/dist/validate-spec.mjs +56 -0
  19. package/dist/validate-spec.mjs.map +1 -0
  20. package/package.json +87 -0
  21. package/skills/opsx-gherkin/SKILL.md +144 -0
  22. package/skills/opsx-gherkin/references/OPENSPEC_MDG_PROFILE.feature.md +372 -0
  23. package/skills/opsx-gherkin/references/examples/account.feature +85 -0
  24. package/skills/opsx-gherkin/references/examples/account.feature.md +96 -0
  25. package/skills/opsx-gherkin/references/examples/account.openspec.md +109 -0
  26. package/skills/opsx-gherkin/references/examples/authentication-delta.feature +41 -0
  27. package/skills/opsx-gherkin/references/examples/authentication-delta.feature.md +45 -0
  28. package/skills/opsx-gherkin/references/examples/authentication-delta.openspec.md +52 -0
  29. package/skills/opsx-gherkin/references/examples/minimal.feature +17 -0
  30. package/skills/opsx-gherkin/references/examples/minimal.feature.md +19 -0
  31. package/skills/opsx-gherkin/references/examples/minimal.openspec.md +24 -0
  32. package/skills/opsx-gherkin/references/profile-access.feature.md +34 -0
@@ -0,0 +1,96 @@
1
+ `@code` `@authentication` `@security`
2
+ # Feature: User sign-in
3
+
4
+ Allow registered users to access their accounts securely while rejecting invalid credentials and limiting repeated attempts.
5
+
6
+ ## Background:
7
+
8
+ * Given the authentication service is available
9
+
10
+ `@credentials`
11
+ ## Rule: Credentials are verified securely
12
+
13
+ The system SHALL grant access only when an active registered user provides the correct email address and password.
14
+
15
+ `@smoke` `@positive`
16
+ ### Scenario Outline: Sign-in succeeds with correct credentials
17
+
18
+ * Given an active registered account with these credentials:
19
+ | email | password |
20
+ | <storedEmail> | <storedPassword> |
21
+ * And the account has <priorFailureCount> consecutive failed sign-in attempts
22
+ * When the user signs in with email "<submittedEmail>" and password "<submittedPassword>"
23
+ * Then the system grants access to the account with email "<expectedAccountEmail>"
24
+ * And the system starts an authenticated session
25
+
26
+ #### Examples: Matching credentials
27
+
28
+ | storedEmail | storedPassword | priorFailureCount | submittedEmail | submittedPassword | expectedAccountEmail |
29
+ | user@example.com | correct-password | 0 | user@example.com | correct-password | user@example.com |
30
+
31
+ `@negative` `@api`
32
+ ### Scenario Outline: Sign-in rejects invalid credentials
33
+
34
+ * Given only the following active account is registered:
35
+ | email | password |
36
+ | <storedEmail> | <storedPassword> |
37
+ * And the account has <priorFailureCount> consecutive failed sign-in attempts
38
+ * When a user signs in with email "<submittedEmail>" and password "<submittedPassword>"
39
+ * Then the system rejects access with HTTP status <httpStatus>
40
+ * And the response body is:
41
+
42
+ ```json
43
+ {
44
+ "error": "<errorCode>"
45
+ }
46
+ ```
47
+
48
+ `@unknown-account`
49
+ #### Examples: Unknown account
50
+
51
+ | storedEmail | storedPassword | priorFailureCount | submittedEmail | submittedPassword | httpStatus | errorCode |
52
+ | user@example.com | correct-password | 0 | missing@example.com | any-password | 401 | invalid_credentials |
53
+
54
+ `@incorrect-password`
55
+ #### Examples: Incorrect password
56
+
57
+ | storedEmail | storedPassword | priorFailureCount | submittedEmail | submittedPassword | httpStatus | errorCode |
58
+ | user@example.com | correct-password | 0 | user@example.com | wrong-password | 401 | invalid_credentials |
59
+
60
+ `@account-protection`
61
+ ## Rule: Repeated failures lock the account
62
+
63
+ The system SHALL lock an account after five consecutive failed sign-in attempts. The system SHALL reject sign-in while the account is locked, even when the submitted credentials are correct.
64
+
65
+ `@negative` `@lockout`
66
+ ### Scenario Outline: Sign-in locks the account at the failure limit
67
+
68
+ * Given an active registered account with these credentials:
69
+ | email | password |
70
+ | <storedEmail> | <storedPassword> |
71
+ * And the account has <priorFailureCount> consecutive failed sign-in attempts
72
+ * When a user signs in with email "<submittedEmail>" and password "<submittedPassword>"
73
+ * Then the system rejects access
74
+ * And the account has <expectedFailureCount> consecutive failed sign-in attempts
75
+ * And the system locks the account
76
+
77
+ #### Examples: Failure limit reached
78
+
79
+ | storedEmail | storedPassword | priorFailureCount | submittedEmail | submittedPassword | expectedFailureCount |
80
+ | user@example.com | correct-password | 4 | user@example.com | wrong-password | 5 |
81
+
82
+ `@negative` `@lockout`
83
+ ### Scenario Outline: A locked account rejects correct credentials
84
+
85
+ * Given a registered account with these credentials:
86
+ | email | password |
87
+ | <storedEmail> | <storedPassword> |
88
+ * And the account has <priorFailureCount> consecutive failed sign-in attempts
89
+ * But the account is locked
90
+ * When a user signs in with email "<submittedEmail>" and password "<submittedPassword>"
91
+ * Then the system rejects access
92
+
93
+ #### Examples: Correct credentials while locked
94
+
95
+ | storedEmail | storedPassword | priorFailureCount | submittedEmail | submittedPassword |
96
+ | user@example.com | correct-password | 5 | user@example.com | correct-password |
@@ -0,0 +1,109 @@
1
+ `@code` `@authentication` `@security`
2
+ # User sign-in
3
+
4
+ ## Purpose
5
+
6
+ Allow registered users to access their accounts securely while rejecting invalid credentials and limiting repeated attempts.
7
+
8
+ ## Requirements
9
+
10
+ **Background:**
11
+
12
+ - **GIVEN** the authentication service is available
13
+
14
+ `@credentials`
15
+ ### Requirement: Credentials are verified securely
16
+
17
+ The system SHALL grant access only when an active registered user provides the correct email address and password.
18
+
19
+ `@smoke` `@positive`
20
+ #### Scenario Outline: Sign-in succeeds with correct credentials
21
+
22
+ - **GIVEN** an active registered account with these credentials:
23
+ | email | password |
24
+ | --- | --- |
25
+ | <storedEmail> | <storedPassword> |
26
+ - **AND** the account has <priorFailureCount> consecutive failed sign-in attempts
27
+ - **WHEN** the user signs in with email "<submittedEmail>" and password "<submittedPassword>"
28
+ - **THEN** the system grants access to the account with email "<expectedAccountEmail>"
29
+ - **AND** the system starts an authenticated session
30
+
31
+ ##### Examples: Matching credentials
32
+
33
+ | storedEmail | storedPassword | priorFailureCount | submittedEmail | submittedPassword | expectedAccountEmail |
34
+ | --- | --- | --- | --- | --- | --- |
35
+ | user@example.com | correct-password | 0 | user@example.com | correct-password | user@example.com |
36
+
37
+ `@negative` `@api`
38
+ #### Scenario Outline: Sign-in rejects invalid credentials
39
+
40
+ - **GIVEN** only the following active account is registered:
41
+ | email | password |
42
+ | --- | --- |
43
+ | <storedEmail> | <storedPassword> |
44
+ - **AND** the account has <priorFailureCount> consecutive failed sign-in attempts
45
+ - **WHEN** a user signs in with email "<submittedEmail>" and password "<submittedPassword>"
46
+ - **THEN** the system rejects access with HTTP status <httpStatus>
47
+ - **AND** the response body is:
48
+
49
+ ```json
50
+ {
51
+ "error": "<errorCode>"
52
+ }
53
+ ```
54
+
55
+ `@unknown-account`
56
+ ##### Examples: Unknown account
57
+
58
+ | storedEmail | storedPassword | priorFailureCount | submittedEmail | submittedPassword | httpStatus | errorCode |
59
+ | --- | --- | --- | --- | --- | --- | --- |
60
+ | user@example.com | correct-password | 0 | missing@example.com | any-password | 401 | invalid_credentials |
61
+
62
+ `@incorrect-password`
63
+ ##### Examples: Incorrect password
64
+
65
+ | storedEmail | storedPassword | priorFailureCount | submittedEmail | submittedPassword | httpStatus | errorCode |
66
+ | --- | --- | --- | --- | --- | --- | --- |
67
+ | user@example.com | correct-password | 0 | user@example.com | wrong-password | 401 | invalid_credentials |
68
+
69
+ `@account-protection`
70
+ ### Requirement: Repeated failures lock the account
71
+
72
+ The system SHALL lock an account after five consecutive failed sign-in attempts. The system SHALL reject sign-in while the account is locked, even when the submitted credentials are correct.
73
+
74
+ `@negative` `@lockout`
75
+ #### Scenario Outline: Sign-in locks the account at the failure limit
76
+
77
+ - **GIVEN** an active registered account with these credentials:
78
+ | email | password |
79
+ | --- | --- |
80
+ | <storedEmail> | <storedPassword> |
81
+ - **AND** the account has <priorFailureCount> consecutive failed sign-in attempts
82
+ - **WHEN** a user signs in with email "<submittedEmail>" and password "<submittedPassword>"
83
+ - **THEN** the system rejects access
84
+ - **AND** the account has <expectedFailureCount> consecutive failed sign-in attempts
85
+ - **AND** the system locks the account
86
+
87
+ ##### Examples: Failure limit reached
88
+
89
+ | storedEmail | storedPassword | priorFailureCount | submittedEmail | submittedPassword | expectedFailureCount |
90
+ | --- | --- | --- | --- | --- | --- |
91
+ | user@example.com | correct-password | 4 | user@example.com | wrong-password | 5 |
92
+
93
+ `@negative` `@lockout`
94
+ #### Scenario Outline: A locked account rejects correct credentials
95
+
96
+ - **GIVEN** a registered account with these credentials:
97
+ | email | password |
98
+ | --- | --- |
99
+ | <storedEmail> | <storedPassword> |
100
+ - **AND** the account has <priorFailureCount> consecutive failed sign-in attempts
101
+ - **BUT** the account is locked
102
+ - **WHEN** a user signs in with email "<submittedEmail>" and password "<submittedPassword>"
103
+ - **THEN** the system rejects access
104
+
105
+ ##### Examples: Correct credentials while locked
106
+
107
+ | storedEmail | storedPassword | priorFailureCount | submittedEmail | submittedPassword |
108
+ | --- | --- | --- | --- | --- |
109
+ | user@example.com | correct-password | 5 | user@example.com | correct-password |
@@ -0,0 +1,41 @@
1
+ @code @openspec-delta
2
+ Feature: Authentication delta
3
+
4
+ STRUCTURAL CHANGE DOCUMENT: This Feature packages OpenSpec delta operations for authentication software. It demonstrates a change document, not one completed application use case. The added and modified requirements contain complete behavioral examples; removal and rename contain only the names allowed by the conversion contract.
5
+
6
+ @openspec-added
7
+ Rule: Recovery codes
8
+
9
+ The system SHALL accept one unused recovery code.
10
+
11
+ Scenario Outline: An unused recovery code grants account access
12
+ Given the account with email "<accountEmail>" has the unused recovery code "<storedRecoveryCode>"
13
+ When a user requests account access for "<submittedEmail>" with recovery code "<submittedRecoveryCode>"
14
+ Then access is granted to the account with email "<expectedAccountEmail>"
15
+
16
+ Examples: Matching unused recovery code
17
+ | accountEmail | storedRecoveryCode | submittedEmail | submittedRecoveryCode | expectedAccountEmail |
18
+ | user@example.com | recovery-7 | user@example.com | recovery-7 | user@example.com |
19
+
20
+ @openspec-modified
21
+ Rule: Password sign-in
22
+
23
+ The system SHALL reject an incorrect password.
24
+
25
+ Scenario Outline: An incorrect password rejects account access
26
+ Given the account with email "<accountEmail>" has the password "<storedPassword>"
27
+ When a user signs in with email "<submittedEmail>" and password "<submittedPassword>"
28
+ Then access is rejected
29
+
30
+ Examples: Password mismatch
31
+ | accountEmail | storedPassword | submittedEmail | submittedPassword |
32
+ | user@example.com | correct-password | user@example.com | wrong-password |
33
+
34
+ @openspec-removed
35
+ Rule: Security questions
36
+
37
+ @openspec-renamed
38
+ Rule: Rename requirement
39
+
40
+ FROM: ### Requirement: Login audit
41
+ TO: ### Requirement: Authentication audit
@@ -0,0 +1,45 @@
1
+ `@code` `@openspec-delta`
2
+ # Feature: Authentication delta
3
+
4
+ STRUCTURAL CHANGE DOCUMENT: This Feature packages OpenSpec delta operations for authentication software. It demonstrates a change document, not one completed application use case. The added and modified requirements contain complete behavioral examples; removal and rename contain only the names allowed by the conversion contract.
5
+
6
+ `@openspec-added`
7
+ ## Rule: Recovery codes
8
+
9
+ The system SHALL accept one unused recovery code.
10
+
11
+ ### Scenario Outline: An unused recovery code grants account access
12
+
13
+ * Given the account with email "<accountEmail>" has the unused recovery code "<storedRecoveryCode>"
14
+ * When a user requests account access for "<submittedEmail>" with recovery code "<submittedRecoveryCode>"
15
+ * Then access is granted to the account with email "<expectedAccountEmail>"
16
+
17
+ #### Examples: Matching unused recovery code
18
+
19
+ | accountEmail | storedRecoveryCode | submittedEmail | submittedRecoveryCode | expectedAccountEmail |
20
+ | user@example.com | recovery-7 | user@example.com | recovery-7 | user@example.com |
21
+
22
+ `@openspec-modified`
23
+ ## Rule: Password sign-in
24
+
25
+ The system SHALL reject an incorrect password.
26
+
27
+ ### Scenario Outline: An incorrect password rejects account access
28
+
29
+ * Given the account with email "<accountEmail>" has the password "<storedPassword>"
30
+ * When a user signs in with email "<submittedEmail>" and password "<submittedPassword>"
31
+ * Then access is rejected
32
+
33
+ #### Examples: Password mismatch
34
+
35
+ | accountEmail | storedPassword | submittedEmail | submittedPassword |
36
+ | user@example.com | correct-password | user@example.com | wrong-password |
37
+
38
+ `@openspec-removed`
39
+ ## Rule: Security questions
40
+
41
+ `@openspec-renamed`
42
+ ## Rule: Rename requirement
43
+
44
+ FROM: `### Requirement: Login audit`
45
+ TO: `### Requirement: Authentication audit`
@@ -0,0 +1,52 @@
1
+ `@code`
2
+ `@openspec-delta`
3
+ # Authentication delta
4
+
5
+ ## Purpose
6
+
7
+ STRUCTURAL CHANGE DOCUMENT: This Feature packages OpenSpec delta operations for authentication software. It demonstrates a change document, not one completed application use case. The added and modified requirements contain complete behavioral examples; removal and rename contain only the names allowed by the conversion contract.
8
+
9
+ ## ADDED Requirements
10
+
11
+ ### Requirement: Recovery codes
12
+
13
+ The system SHALL accept one unused recovery code.
14
+
15
+ #### Scenario Outline: An unused recovery code grants account access
16
+
17
+ - **GIVEN** the account with email "<accountEmail>" has the unused recovery code "<storedRecoveryCode>"
18
+ - **WHEN** a user requests account access for "<submittedEmail>" with recovery code "<submittedRecoveryCode>"
19
+ - **THEN** access is granted to the account with email "<expectedAccountEmail>"
20
+
21
+ ##### Examples: Matching unused recovery code
22
+
23
+ | accountEmail | storedRecoveryCode | submittedEmail | submittedRecoveryCode | expectedAccountEmail |
24
+ | --- | --- | --- | --- | --- |
25
+ | user@example.com | recovery-7 | user@example.com | recovery-7 | user@example.com |
26
+
27
+ ## MODIFIED Requirements
28
+
29
+ ### Requirement: Password sign-in
30
+
31
+ The system SHALL reject an incorrect password.
32
+
33
+ #### Scenario Outline: An incorrect password rejects account access
34
+
35
+ - **GIVEN** the account with email "<accountEmail>" has the password "<storedPassword>"
36
+ - **WHEN** a user signs in with email "<submittedEmail>" and password "<submittedPassword>"
37
+ - **THEN** access is rejected
38
+
39
+ ##### Examples: Password mismatch
40
+
41
+ | accountEmail | storedPassword | submittedEmail | submittedPassword |
42
+ | --- | --- | --- | --- |
43
+ | user@example.com | correct-password | user@example.com | wrong-password |
44
+
45
+ ## REMOVED Requirements
46
+
47
+ ### Requirement: Security questions
48
+
49
+ ## RENAMED Requirements
50
+
51
+ - FROM: `### Requirement: Login audit`
52
+ - TO: `### Requirement: Authentication audit`
@@ -0,0 +1,17 @@
1
+ @code
2
+ Feature: Add a product to an empty shopping cart
3
+
4
+ Keep the quantity a customer selects when adding a product to an empty shopping cart.
5
+
6
+ Rule: Adding a product retains its quantity
7
+
8
+ The cart SHALL contain the selected quantity of a product after the customer adds it.
9
+
10
+ Scenario Outline: Retain the requested product quantity
11
+ Given an empty shopping cart
12
+ When the customer adds <requestedQuantity> units of product "<productId>"
13
+ Then the cart contains <expectedQuantity> units of product "<productId>"
14
+
15
+ Examples: Selected quantity
16
+ | productId | requestedQuantity | expectedQuantity |
17
+ | P-7 | 2 | 2 |
@@ -0,0 +1,19 @@
1
+ `@code`
2
+ # Feature: Add a product to an empty shopping cart
3
+
4
+ Keep the quantity a customer selects when adding a product to an empty shopping cart.
5
+
6
+ ## Rule: Adding a product retains its quantity
7
+
8
+ The cart SHALL contain the selected quantity of a product after the customer adds it.
9
+
10
+ ### Scenario Outline: Retain the requested product quantity
11
+
12
+ * Given an empty shopping cart
13
+ * When the customer adds <requestedQuantity> units of product "<productId>"
14
+ * Then the cart contains <expectedQuantity> units of product "<productId>"
15
+
16
+ #### Examples: Selected quantity
17
+
18
+ | productId | requestedQuantity | expectedQuantity |
19
+ | P-7 | 2 | 2 |
@@ -0,0 +1,24 @@
1
+ `@code`
2
+ # Add a product to an empty shopping cart
3
+
4
+ ## Purpose
5
+
6
+ Keep the quantity a customer selects when adding a product to an empty shopping cart.
7
+
8
+ ## Requirements
9
+
10
+ ### Requirement: Adding a product retains its quantity
11
+
12
+ The cart SHALL contain the selected quantity of a product after the customer adds it.
13
+
14
+ #### Scenario Outline: Retain the requested product quantity
15
+
16
+ - **GIVEN** an empty shopping cart
17
+ - **WHEN** the customer adds <requestedQuantity> units of product "<productId>"
18
+ - **THEN** the cart contains <expectedQuantity> units of product "<productId>"
19
+
20
+ ##### Examples: Selected quantity
21
+
22
+ | productId | requestedQuantity | expectedQuantity |
23
+ | --- | --- | --- |
24
+ | P-7 | 2 | 2 |
@@ -0,0 +1,34 @@
1
+ `@code`
2
+ # Feature: Access specification conversion guidance
3
+
4
+ Find the supported output formats and retrieve the canonical conversion profile before authoring a compatible specification. The [canonical mapping contract](OPENSPEC_MDG_PROFILE.feature.md) defines the mappings; this Feature specifies access to that resource.
5
+
6
+ ## Background:
7
+
8
+ * Given the opsx-gherkin package is installed with its canonical profile resource
9
+
10
+ ## Rule: Help identifies the profile and supported output formats
11
+
12
+ The CLI SHALL direct readers to the profile before authoring and SHALL distinguish Markdown with Gherkin output from plain Gherkin output.
13
+
14
+ ### Scenario: Find the profile command in help
15
+
16
+ * When the user requests `opsx-gherkin --help`
17
+ * Then the help directs the user to `opsx-gherkin profile` before authoring
18
+ * And the help distinguishes `.feature.md` from `.feature` output
19
+
20
+ ## Rule: Profile commands return the complete canonical resource
21
+
22
+ The profile and instructions commands SHALL return the canonical mapping contract verbatim on stdout and SHALL exit with status 0.
23
+
24
+ ### Scenario Outline: Retrieve the canonical contract through `<command>`
25
+
26
+ * When the user runs `opsx-gherkin <command>`
27
+ * Then stdout equals the complete installed canonical resource byte for byte
28
+ * And the command exits with status `<exit_status>`
29
+
30
+ #### Examples: Resource commands
31
+
32
+ | command | exit_status |
33
+ | profile | 0 |
34
+ | instructions | 0 |