specshield 3.1.1 → 3.1.2
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 +183 -49
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -268,7 +268,16 @@ Done. Your token is stored in `~/.specshield/config.json` — no need to pass it
|
|
|
268
268
|
export SPECSHIELD_API_KEY=ss_your_token_here
|
|
269
269
|
```
|
|
270
270
|
|
|
271
|
-
|
|
271
|
+
This single env var works for every command — `compare`, `login`, and every
|
|
272
|
+
`bdct` subcommand all read it.
|
|
273
|
+
|
|
274
|
+
Token resolution order:
|
|
275
|
+
- `compare` / `login`: `--api-key` flag → `SPECSHIELD_API_KEY` env var → stored config → `.specshield.yml`
|
|
276
|
+
- `bdct ...` subcommands: `--api-token` flag → `SPECSHIELD_API_KEY` env var → stored config
|
|
277
|
+
|
|
278
|
+
> **Why two flag names?** `compare` and `login` were built first and used
|
|
279
|
+
> `--api-key`. The newer `bdct` commands use `--api-token` to keep the word
|
|
280
|
+
> "key" reserved for the stored config concept. The env var unifies both.
|
|
272
281
|
|
|
273
282
|
---
|
|
274
283
|
|
|
@@ -421,6 +430,7 @@ from any subdirectory of your project.
|
|
|
421
430
|
### Non-interactive (scriptable) mode
|
|
422
431
|
|
|
423
432
|
```bash
|
|
433
|
+
# Provider-only project
|
|
424
434
|
specshield init --no-interactive \
|
|
425
435
|
--kind provider \
|
|
426
436
|
--org acme-pay \
|
|
@@ -428,16 +438,36 @@ specshield init --no-interactive \
|
|
|
428
438
|
--spec api/openapi.yaml \
|
|
429
439
|
--env staging \
|
|
430
440
|
--write-workflow
|
|
441
|
+
|
|
442
|
+
# Consumer-only project
|
|
443
|
+
specshield init --no-interactive \
|
|
444
|
+
--kind consumer \
|
|
445
|
+
--org acme-pay \
|
|
446
|
+
--consumer checkout-ui \
|
|
447
|
+
--consumer-provider payment-service \
|
|
448
|
+
--contract contracts/payment-service.yaml \
|
|
449
|
+
--format OPENAPI \
|
|
450
|
+
--env staging
|
|
431
451
|
```
|
|
432
452
|
|
|
433
|
-
###
|
|
453
|
+
### All `init` flags
|
|
434
454
|
|
|
435
455
|
| Flag | Purpose |
|
|
436
456
|
| --- | --- |
|
|
437
|
-
| `--
|
|
457
|
+
| `--no-interactive` | Run without prompts; all required fields must come from flags or `package.json`/git autodetection. |
|
|
458
|
+
| `--print` | Detect everything, print the proposed YAML to stdout, write nothing. Good for `--dry-run` review in CI. |
|
|
438
459
|
| `--force` | Skip the overwrite-confirmation if `.specshield.yml` already exists. |
|
|
439
|
-
| `--server <url>` | Use a non-default SpecShield endpoint (self-hosted / staging). |
|
|
440
|
-
| `--
|
|
460
|
+
| `--server <url>` | Use a non-default SpecShield endpoint (self-hosted / staging). Default: `https://specshield.io`. |
|
|
461
|
+
| `--kind <kind>` | `provider`, `consumer`, `both`, or `skip`. Required in `--no-interactive`. |
|
|
462
|
+
| `--org <key>` | Organization key. |
|
|
463
|
+
| `--provider <name>` | Provider service name (used when `--kind=provider|both`). |
|
|
464
|
+
| `--spec <path>` | Path to the provider OpenAPI spec. |
|
|
465
|
+
| `--consumer <name>` | Consumer service name (used when `--kind=consumer|both`). |
|
|
466
|
+
| `--consumer-provider <name>` | The provider this consumer talks to (used when `--kind=consumer|both`). |
|
|
467
|
+
| `--contract <path>` | Path to the consumer contract (OpenAPI or Pact JSON). |
|
|
468
|
+
| `--format <fmt>` | Consumer contract format: `OPENAPI` (default) or `PACT`. |
|
|
469
|
+
| `--env <environment>` | Default environment for BDCT operations. |
|
|
470
|
+
| `--write-workflow` | Also write a starter GitHub Actions workflow under `.github/workflows/specshield-bdct.yml`. |
|
|
441
471
|
|
|
442
472
|
> **What is _not_ written into `.specshield.yml`:** your API key. It is
|
|
443
473
|
> stored in `~/.specshield/config.json` (set by `specshield login`) or
|
|
@@ -471,17 +501,25 @@ specshield bdct publish-provider \
|
|
|
471
501
|
--provider payment-service \
|
|
472
502
|
--version v2.1.0 \
|
|
473
503
|
--spec ./api/openapi.yaml \
|
|
474
|
-
--env production
|
|
504
|
+
--env production \
|
|
505
|
+
--branch main
|
|
475
506
|
```
|
|
476
507
|
|
|
477
508
|
```
|
|
478
|
-
✔ Provider
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
509
|
+
✔ Provider Spec Published
|
|
510
|
+
─────────────────────────────────────────────────────
|
|
511
|
+
ID : 1842
|
|
512
|
+
Provider : payment-service
|
|
513
|
+
Version : v2.1.0
|
|
514
|
+
Environment : production
|
|
515
|
+
Published At: 2026-05-13 14:30:12
|
|
516
|
+
Verifications triggered: 3
|
|
483
517
|
```
|
|
484
518
|
|
|
519
|
+
`--branch` is optional — when present it's stamped on the published spec so you
|
|
520
|
+
can correlate a spec version with the git branch it came from in
|
|
521
|
+
`bdct list-providers`.
|
|
522
|
+
|
|
485
523
|
### Publish a Consumer Contract
|
|
486
524
|
|
|
487
525
|
The consumer contract is an OpenAPI spec that describes only the endpoints the consumer uses:
|
|
@@ -522,19 +560,30 @@ specshield bdct publish-consumer \
|
|
|
522
560
|
--consumer checkout-ui \
|
|
523
561
|
--provider payment-service \
|
|
524
562
|
--version 2.0.0 \
|
|
525
|
-
--contract ./contracts/checkout-ui-payment.yaml
|
|
563
|
+
--contract ./contracts/checkout-ui-payment.yaml \
|
|
564
|
+
--format OPENAPI
|
|
526
565
|
```
|
|
527
566
|
|
|
528
567
|
```
|
|
529
|
-
✔ Consumer
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
568
|
+
✔ Consumer Contract Published
|
|
569
|
+
─────────────────────────────────────────────────────
|
|
570
|
+
ID : 942
|
|
571
|
+
Consumer : checkout-ui
|
|
572
|
+
Provider : payment-service
|
|
573
|
+
Version : 2.0.0
|
|
574
|
+
Format : OPENAPI
|
|
575
|
+
Published At: 2026-05-13 14:31:05
|
|
576
|
+
Verifications triggered: 1
|
|
577
|
+
|
|
578
|
+
➜ Run: specshield bdct verify --consumer checkout-ui --provider payment-service
|
|
533
579
|
```
|
|
534
580
|
|
|
535
|
-
If the provider spec is already published, compatibility is
|
|
581
|
+
If the provider spec is already published, compatibility is verified
|
|
582
|
+
automatically — the "Verifications triggered" count reflects that.
|
|
536
583
|
|
|
537
|
-
**Pact JSON contracts are also
|
|
584
|
+
**Pact JSON contracts are also supported** — pass `--format PACT` and point
|
|
585
|
+
`--contract` at a Pact file. The backend stores the format and runs the same
|
|
586
|
+
compatibility engine against your provider's OpenAPI spec:
|
|
538
587
|
|
|
539
588
|
```bash
|
|
540
589
|
specshield bdct publish-consumer \
|
|
@@ -542,9 +591,12 @@ specshield bdct publish-consumer \
|
|
|
542
591
|
--consumer checkout-ui \
|
|
543
592
|
--provider payment-service \
|
|
544
593
|
--version 2.0.0 \
|
|
545
|
-
--contract ./pacts/checkout-ui-payment-service.json
|
|
594
|
+
--contract ./pacts/checkout-ui-payment-service.json \
|
|
595
|
+
--format PACT
|
|
546
596
|
```
|
|
547
597
|
|
|
598
|
+
`--format` defaults to `OPENAPI` if omitted.
|
|
599
|
+
|
|
548
600
|
### Verify Compatibility
|
|
549
601
|
|
|
550
602
|
Manually trigger a verification between a specific consumer/provider pair:
|
|
@@ -596,18 +648,36 @@ specshield bdct can-i-deploy \
|
|
|
596
648
|
--env production
|
|
597
649
|
```
|
|
598
650
|
|
|
651
|
+
Deployable output:
|
|
652
|
+
|
|
599
653
|
```
|
|
600
|
-
✔
|
|
654
|
+
✔ PASS: payment-service v2.1.0 is deployable in production
|
|
655
|
+
─────────────────────────────────────────────────────
|
|
601
656
|
|
|
602
|
-
|
|
657
|
+
Consumer Verifications
|
|
658
|
+
|
|
659
|
+
Consumer Version Status Verified At
|
|
660
|
+
─────────── ─────── ────────── ───────────────
|
|
661
|
+
checkout-ui 2.0.0 COMPATIBLE 2026-05-13 14:32
|
|
662
|
+
mobile-app 1.5.0 COMPATIBLE 2026-05-13 14:32
|
|
663
|
+
partner-sdk 3.2.1 COMPATIBLE 2026-05-13 14:32
|
|
603
664
|
```
|
|
604
665
|
|
|
666
|
+
Blocked output:
|
|
667
|
+
|
|
605
668
|
```
|
|
606
|
-
✖ NOT
|
|
669
|
+
✖ FAIL: payment-service v2.1.0 is NOT deployable in production
|
|
670
|
+
─────────────────────────────────────────────────────
|
|
607
671
|
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
672
|
+
Consumer Verifications
|
|
673
|
+
|
|
674
|
+
Consumer Version Status Verified At
|
|
675
|
+
─────────── ─────── ──────────── ───────────────
|
|
676
|
+
checkout-ui 2.0.0 INCOMPATIBLE 2026-05-13 14:32
|
|
677
|
+
mobile-app 1.5.0 INCOMPATIBLE 2026-05-13 14:32
|
|
678
|
+
|
|
679
|
+
➜ Run: specshield bdct verify --consumer <NAME> --provider payment-service
|
|
680
|
+
➜ to identify and resolve incompatibilities
|
|
611
681
|
```
|
|
612
682
|
|
|
613
683
|
Exit codes: `0` = deployable · `1` = blocked · `2` = error
|
|
@@ -621,12 +691,17 @@ specshield bdct matrix --org acme-store --env production
|
|
|
621
691
|
```
|
|
622
692
|
|
|
623
693
|
```
|
|
624
|
-
Compatibility Matrix
|
|
694
|
+
BDCT Compatibility Matrix
|
|
695
|
+
Environment: production
|
|
696
|
+
─────────────────────────────────────────────────────
|
|
697
|
+
|
|
698
|
+
Consumer \ Provider payment-service order-service
|
|
699
|
+
─────────────────── ─────────────── ─────────────
|
|
700
|
+
checkout-ui COMPATIBLE COMPATIBLE
|
|
701
|
+
mobile-app INCOMPATIBLE COMPATIBLE
|
|
702
|
+
partner-sdk COMPATIBLE UNKNOWN
|
|
625
703
|
|
|
626
|
-
|
|
627
|
-
checkout-ui COMPATIBLE COMPATIBLE
|
|
628
|
-
mobile-app INCOMPATIBLE COMPATIBLE
|
|
629
|
-
partner-sdk COMPATIBLE UNKNOWN
|
|
704
|
+
■ COMPATIBLE ■ INCOMPATIBLE ■ UNKNOWN
|
|
630
705
|
```
|
|
631
706
|
|
|
632
707
|
### List Provider Specs
|
|
@@ -640,11 +715,15 @@ specshield bdct list-providers --org acme-store --provider payment-service
|
|
|
640
715
|
```
|
|
641
716
|
|
|
642
717
|
```
|
|
643
|
-
Provider Specs
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
718
|
+
Published Provider Specs
|
|
719
|
+
─────────────────────────────────────────────────────
|
|
720
|
+
Showing 3 of 3 specs
|
|
721
|
+
|
|
722
|
+
ID Provider Version Environment Branch Published At
|
|
723
|
+
──── ─────────────── ─────── ─────────── ────── ───────────────
|
|
724
|
+
1842 payment-service v2.1.0 production main 2026-05-13 14:30
|
|
725
|
+
1799 payment-service v2.0.0 staging main 2026-04-20 09:11
|
|
726
|
+
1772 order-service v1.3.0 production main 2026-04-28 11:02
|
|
648
727
|
```
|
|
649
728
|
|
|
650
729
|
### List Consumer Contracts
|
|
@@ -670,11 +749,14 @@ specshield bdct list \
|
|
|
670
749
|
```
|
|
671
750
|
|
|
672
751
|
```
|
|
673
|
-
BDCT
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
752
|
+
BDCT Verification History
|
|
753
|
+
─────────────────────────────────────────────────────
|
|
754
|
+
Showing 2 of 2 verifications
|
|
755
|
+
|
|
756
|
+
ID Consumer Provider Cons Ver Prov Ver Status Environment Verified At
|
|
757
|
+
──── ─────────── ─────────────── ──────── ──────── ──────────── ─────────── ───────────────
|
|
758
|
+
3081 checkout-ui payment-service 2.0.0 v2.1.0 COMPATIBLE production 2026-05-13 14:32
|
|
759
|
+
3082 mobile-app payment-service 1.5.0 v2.1.0 INCOMPATIBLE production 2026-05-13 14:32
|
|
678
760
|
```
|
|
679
761
|
|
|
680
762
|
### BDCT JSON Output
|
|
@@ -831,28 +913,60 @@ jobs:
|
|
|
831
913
|
|
|
832
914
|
## Config File
|
|
833
915
|
|
|
834
|
-
|
|
916
|
+
Run [`specshield init`](#specshield-init--first-run-setup-wizard) to generate
|
|
917
|
+
`.specshield.yml` automatically, or hand-write it. Either way, every
|
|
918
|
+
`specshield ...` invocation reads the file from the project root (or any
|
|
919
|
+
parent directory) and uses its values as defaults — CLI flags always win.
|
|
920
|
+
|
|
921
|
+
The full schema supports both local-compare defaults and BDCT defaults:
|
|
835
922
|
|
|
836
923
|
```yaml
|
|
837
|
-
|
|
838
|
-
severity: error
|
|
924
|
+
schemaVersion: 1
|
|
839
925
|
|
|
926
|
+
# Local-compare defaults (used by `specshield compare`).
|
|
927
|
+
failOnBreaking: true
|
|
928
|
+
severity: error # info | warning | error
|
|
840
929
|
ignore:
|
|
841
|
-
- "DELETE /admin removed"
|
|
930
|
+
- "DELETE /admin removed" # match by substring; repeatable
|
|
842
931
|
|
|
932
|
+
# Hosted compare (set --remote on the CLI to override).
|
|
843
933
|
remote:
|
|
844
934
|
enabled: false
|
|
845
|
-
url:
|
|
935
|
+
url: https://specshield.io/compare
|
|
846
936
|
timeout: 10000
|
|
847
|
-
# apiKey
|
|
937
|
+
# apiKey is intentionally NOT set here. Use SPECSHIELD_API_KEY in CI
|
|
938
|
+
# or `specshield login` locally. Never commit a key to a file.
|
|
939
|
+
|
|
940
|
+
# BDCT defaults (used by every `specshield bdct ...` subcommand).
|
|
941
|
+
bdct:
|
|
942
|
+
org: acme-pay
|
|
943
|
+
environment: staging
|
|
944
|
+
# server: https://specshield.io # only set for self-hosted / staging
|
|
945
|
+
|
|
946
|
+
provider:
|
|
947
|
+
name: payment-service
|
|
948
|
+
spec: api/openapi.yaml # paths are relative to this file
|
|
949
|
+
# branch: main # informational tag on each publish
|
|
950
|
+
|
|
951
|
+
# consumer:
|
|
952
|
+
# name: checkout-ui
|
|
953
|
+
# provider: payment-service
|
|
954
|
+
# contract: contracts/payment-service.yaml
|
|
955
|
+
# format: OPENAPI # OPENAPI | PACT
|
|
848
956
|
|
|
957
|
+
# GitHub App + bdct-action defaults.
|
|
849
958
|
github:
|
|
850
959
|
specPath: api/openapi.yaml
|
|
851
960
|
failOnBreaking: true
|
|
852
961
|
commentOnPr: true
|
|
853
962
|
```
|
|
854
963
|
|
|
855
|
-
|
|
964
|
+
When this file is present, BDCT commands collapse to just `--version`:
|
|
965
|
+
|
|
966
|
+
```bash
|
|
967
|
+
specshield bdct publish-provider --version $GITHUB_SHA
|
|
968
|
+
specshield bdct can-i-deploy --version $GITHUB_SHA
|
|
969
|
+
```
|
|
856
970
|
|
|
857
971
|
---
|
|
858
972
|
|
|
@@ -885,12 +999,32 @@ specshield bdct <subcommand> [options]
|
|
|
885
999
|
| `publish-consumer` | Publish a consumer contract (OpenAPI subset or Pact JSON) |
|
|
886
1000
|
| `verify` | Manually trigger verification for a consumer/provider pair |
|
|
887
1001
|
| `can-i-deploy` | Check if a service version is safe to deploy |
|
|
888
|
-
| `matrix` |
|
|
1002
|
+
| `matrix` | Compatibility matrix across all consumer/provider pairs |
|
|
889
1003
|
| `list-providers` | List published provider specs |
|
|
890
1004
|
| `list-consumers` | List published consumer contracts |
|
|
891
1005
|
| `list` | List verification history |
|
|
892
1006
|
|
|
893
|
-
|
|
1007
|
+
Every `bdct` subcommand accepts these flags in common:
|
|
1008
|
+
|
|
1009
|
+
| Flag | Purpose |
|
|
1010
|
+
|---|---|
|
|
1011
|
+
| `--org <key>` | Organization key (or read from `.specshield.yml`'s `bdct.org`) |
|
|
1012
|
+
| `--json` | Machine-readable JSON output |
|
|
1013
|
+
| `--server <url>` | Override SpecShield server URL (self-hosted / staging) |
|
|
1014
|
+
| `--api-token <token>` | API token (overrides env / stored config) |
|
|
1015
|
+
|
|
1016
|
+
Per-subcommand flags:
|
|
1017
|
+
|
|
1018
|
+
| Subcommand | Flags |
|
|
1019
|
+
|---|---|
|
|
1020
|
+
| `publish-provider` | `--spec <path>`, `--provider <name>`, `--version <ver>`, `--env <env>`, `--branch <branch>` |
|
|
1021
|
+
| `publish-consumer` | `--contract <path>`, `--consumer <name>`, `--provider <name>`, `--version <ver>`, `--format OPENAPI\|PACT` |
|
|
1022
|
+
| `verify` | `--consumer <name>`, `--provider <name>`, `--consumer-version <ver>`, `--provider-version <ver>`, `--env <env>` |
|
|
1023
|
+
| `can-i-deploy` | `--service <name>`, `--version <ver>`, `--env <env>` |
|
|
1024
|
+
| `matrix` | `--env <env>` |
|
|
1025
|
+
| `list-providers` | `--provider <name>` (filter) |
|
|
1026
|
+
| `list-consumers` | `--consumer <name>` (filter), `--provider <name>` (filter) |
|
|
1027
|
+
| `list` | `--consumer <name>`, `--provider <name>`, `--env <env>`, `--page <n>`, `--size <n>` |
|
|
894
1028
|
|
|
895
1029
|
---
|
|
896
1030
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "specshield",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.2",
|
|
4
4
|
"description": "CLI for OpenAPI breaking change detection and bi-directional contract verification — with can-i-deploy gating, GitHub PR checks, and a first-run setup wizard.",
|
|
5
5
|
"main": "src/cli.js",
|
|
6
6
|
"bin": {
|