@arpixel/api-contract 0.1.0 → 0.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 +97 -55
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -89,13 +89,14 @@ Actual frontend impact
|
|
|
89
89
|
Generate frontend-ready TypeScript from an OpenAPI specification:
|
|
90
90
|
|
|
91
91
|
```bash
|
|
92
|
-
npx api-contract generate openapi.yaml
|
|
92
|
+
npx @arpixel/api-contract generate openapi.yaml
|
|
93
93
|
```
|
|
94
94
|
|
|
95
95
|
The default output is:
|
|
96
96
|
|
|
97
97
|
```text
|
|
98
98
|
api-contract/generated/
|
|
99
|
+
|
|
99
100
|
├── types.ts
|
|
100
101
|
└── api.ts
|
|
101
102
|
```
|
|
@@ -105,13 +106,14 @@ The output directory is resolved relative to the current working directory.
|
|
|
105
106
|
### Custom output
|
|
106
107
|
|
|
107
108
|
```bash
|
|
108
|
-
npx api-contract generate openapi.yaml --output src/api/generated
|
|
109
|
+
npx @arpixel/api-contract generate openapi.yaml --output src/api/generated
|
|
109
110
|
```
|
|
110
111
|
|
|
111
112
|
Produces:
|
|
112
113
|
|
|
113
114
|
```text
|
|
114
115
|
src/api/generated/
|
|
116
|
+
|
|
115
117
|
├── types.ts
|
|
116
118
|
└── api.ts
|
|
117
119
|
```
|
|
@@ -145,7 +147,7 @@ export interface ApiMethods {
|
|
|
145
147
|
Compare two OpenAPI specifications:
|
|
146
148
|
|
|
147
149
|
```bash
|
|
148
|
-
npx api-contract diff old.yaml new.yaml
|
|
150
|
+
npx @arpixel/api-contract diff old.yaml new.yaml
|
|
149
151
|
```
|
|
150
152
|
|
|
151
153
|
The comparison identifies structural contract changes including:
|
|
@@ -169,7 +171,7 @@ Changes are classified as **breaking** or **non-breaking** according to the supp
|
|
|
169
171
|
### Human-readable output
|
|
170
172
|
|
|
171
173
|
```bash
|
|
172
|
-
npx api-contract diff examples/old.yaml examples/new.yaml
|
|
174
|
+
npx @arpixel/api-contract diff examples/old.yaml examples/new.yaml
|
|
173
175
|
```
|
|
174
176
|
|
|
175
177
|
Example:
|
|
@@ -183,19 +185,24 @@ Modified: 1
|
|
|
183
185
|
Breaking: 2
|
|
184
186
|
|
|
185
187
|
BREAKING
|
|
188
|
+
|
|
186
189
|
DELETE /devices/{id} was removed.
|
|
190
|
+
|
|
187
191
|
Device.status changed from optional to required.
|
|
188
192
|
|
|
189
193
|
NON-BREAKING
|
|
194
|
+
|
|
190
195
|
POST /devices was added.
|
|
196
|
+
|
|
191
197
|
Device.serialNumber was added.
|
|
198
|
+
|
|
192
199
|
DeviceStatus enum value "suspended" was added.
|
|
193
200
|
```
|
|
194
201
|
|
|
195
202
|
### Machine-readable output
|
|
196
203
|
|
|
197
204
|
```bash
|
|
198
|
-
npx api-contract diff examples/old.yaml examples/new.yaml --format json
|
|
205
|
+
npx @arpixel/api-contract diff examples/old.yaml examples/new.yaml --format json
|
|
199
206
|
```
|
|
200
207
|
|
|
201
208
|
The JSON output provides a stable V1 structure:
|
|
@@ -233,17 +240,17 @@ The AI-assisted impact workflow takes the deterministic diff and analyzes the fr
|
|
|
233
240
|
|
|
234
241
|
```text
|
|
235
242
|
api-contract diff
|
|
236
|
-
|
|
243
|
+
↓
|
|
237
244
|
Contract changes
|
|
238
|
-
|
|
245
|
+
↓
|
|
239
246
|
AI coding agent
|
|
240
|
-
|
|
247
|
+
↓
|
|
241
248
|
Frontend repository
|
|
242
|
-
|
|
249
|
+
↓
|
|
243
250
|
Search + dependency tracing
|
|
244
|
-
|
|
251
|
+
↓
|
|
245
252
|
Actual consumers
|
|
246
|
-
|
|
253
|
+
↓
|
|
247
254
|
Impact report
|
|
248
255
|
```
|
|
249
256
|
|
|
@@ -308,27 +315,29 @@ The three capabilities can be used independently or together.
|
|
|
308
315
|
|
|
309
316
|
```text
|
|
310
317
|
OpenAPI
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
318
|
+
|
|
319
|
+
│
|
|
320
|
+
|
|
321
|
+
┌────────────────┼────────────────┐
|
|
322
|
+
│ │ │
|
|
323
|
+
▼ ▼ ▼
|
|
324
|
+
GENERATE COMPARE ANALYZE
|
|
325
|
+
│ │ │
|
|
326
|
+
▼ ▼ │
|
|
327
|
+
TypeScript client What changed? │
|
|
328
|
+
types.ts + api.ts Breaking? │
|
|
329
|
+
│ │
|
|
330
|
+
▼ │
|
|
331
|
+
Structured diff ──────┘
|
|
323
332
|
│
|
|
324
333
|
▼
|
|
325
|
-
|
|
334
|
+
AI agent
|
|
326
335
|
│
|
|
327
336
|
▼
|
|
328
|
-
|
|
337
|
+
Frontend repository
|
|
329
338
|
│
|
|
330
339
|
▼
|
|
331
|
-
|
|
340
|
+
Impact report
|
|
332
341
|
```
|
|
333
342
|
|
|
334
343
|
A typical API evolution workflow becomes:
|
|
@@ -357,17 +366,17 @@ The architecture is:
|
|
|
357
366
|
|
|
358
367
|
```text
|
|
359
368
|
api-contract
|
|
360
|
-
|
|
369
|
+
|
|
361
370
|
├── generate
|
|
362
371
|
├── diff
|
|
363
372
|
│
|
|
364
373
|
└── deterministic contract data
|
|
365
374
|
│
|
|
366
375
|
▼
|
|
367
|
-
|
|
376
|
+
AI agent
|
|
368
377
|
│
|
|
369
378
|
▼
|
|
370
|
-
|
|
379
|
+
repository-aware analysis
|
|
371
380
|
```
|
|
372
381
|
|
|
373
382
|
This means:
|
|
@@ -387,6 +396,7 @@ The repository includes integration artifacts:
|
|
|
387
396
|
|
|
388
397
|
```text
|
|
389
398
|
integrations/vscode/
|
|
399
|
+
|
|
390
400
|
├── api-contract-generate.prompt.md
|
|
391
401
|
├── api-contract-generate.agent.md
|
|
392
402
|
├── api-contract-impact.prompt.md
|
|
@@ -396,20 +406,34 @@ integrations/vscode/
|
|
|
396
406
|
Install these integrations for your user account with:
|
|
397
407
|
|
|
398
408
|
```bash
|
|
399
|
-
npx api-contract init --host vscode
|
|
409
|
+
npx @arpixel/api-contract init --host vscode
|
|
400
410
|
```
|
|
401
411
|
|
|
402
|
-
|
|
403
|
-
|
|
412
|
+
The `init` command copies the bundled integration files into your user account:
|
|
413
|
+
|
|
414
|
+
```text
|
|
415
|
+
~/.api-contract/prompts/
|
|
416
|
+
|
|
417
|
+
├── api-contract-generate.prompt.md
|
|
418
|
+
└── api-contract-impact.prompt.md
|
|
419
|
+
|
|
420
|
+
~/.copilot/agents/
|
|
421
|
+
|
|
422
|
+
├── api-contract-generate.agent.md
|
|
423
|
+
└── api-contract-impact.agent.md
|
|
424
|
+
```
|
|
425
|
+
|
|
426
|
+
The prompts are installed under `~/.api-contract/prompts/` and the agents under `~/.copilot/agents/`.
|
|
427
|
+
|
|
428
|
+
The command creates the required directories and updates the managed files when run again. It **does not modify VS Code settings automatically**.
|
|
404
429
|
|
|
405
430
|
### Prompt usage
|
|
406
431
|
|
|
407
432
|
Choose one of these options for the prompts:
|
|
408
433
|
|
|
409
|
-
1. **Repository-local** — Copy `~/.api-contract/prompts/` into
|
|
410
|
-
|
|
411
|
-
2. **Global** — Add `~/.api-contract/prompts` as a directory in VS Code's
|
|
412
|
-
`chat.promptFilesLocations` setting. Add the directory, not individual file paths.
|
|
434
|
+
1. **Repository-local** — Copy `~/.api-contract/prompts/` into `<repository>/.github/prompts/` to make the prompts available to that repository.
|
|
435
|
+
|
|
436
|
+
2. **Global** — Add `~/.api-contract/prompts` as a directory in VS Code's `chat.promptFilesLocations` setting. Add the directory, not individual file paths.
|
|
413
437
|
|
|
414
438
|
The agents installed under `~/.copilot/agents/` can be selected from the VS Code Chat agent experience.
|
|
415
439
|
|
|
@@ -468,7 +492,7 @@ The analysis is read-only by default and does not modify source code unless expl
|
|
|
468
492
|
```text
|
|
469
493
|
OpenAPI
|
|
470
494
|
│
|
|
471
|
-
|
|
495
|
+
OpenAPI parser
|
|
472
496
|
│
|
|
473
497
|
┌─────────────────┼─────────────────┐
|
|
474
498
|
│ │ │
|
|
@@ -476,20 +500,20 @@ The analysis is read-only by default and does not modify source code unless expl
|
|
|
476
500
|
GENERATE COMPARE ANALYZE*
|
|
477
501
|
│ │ │
|
|
478
502
|
▼ ▼ │
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
│
|
|
482
|
-
│
|
|
483
|
-
│
|
|
484
|
-
│
|
|
485
|
-
│
|
|
486
|
-
│
|
|
487
|
-
│
|
|
488
|
-
│
|
|
489
|
-
│
|
|
503
|
+
TypeScript Structured diff │
|
|
504
|
+
client │ │
|
|
505
|
+
│ │ │
|
|
506
|
+
│ ▼ │
|
|
507
|
+
│ AI coding agent ◄────┘
|
|
508
|
+
│ │
|
|
509
|
+
│ ▼
|
|
510
|
+
│ Frontend repository
|
|
511
|
+
│ │
|
|
512
|
+
│ ▼
|
|
513
|
+
│ Impact analysis
|
|
490
514
|
│
|
|
491
515
|
▼
|
|
492
|
-
|
|
516
|
+
types.ts + api.ts
|
|
493
517
|
|
|
494
518
|
* Analyze is an AI-assisted workflow built on top of
|
|
495
519
|
the deterministic CLI output.
|
|
@@ -528,25 +552,43 @@ Impact analysis should prefer concrete repository evidence over assumptions base
|
|
|
528
552
|
No global installation is required:
|
|
529
553
|
|
|
530
554
|
```bash
|
|
531
|
-
npx api-contract --help
|
|
555
|
+
npx @arpixel/api-contract --help
|
|
532
556
|
```
|
|
533
557
|
|
|
534
558
|
Generate:
|
|
535
559
|
|
|
536
560
|
```bash
|
|
537
|
-
npx api-contract generate openapi.yaml
|
|
561
|
+
npx @arpixel/api-contract generate openapi.yaml
|
|
538
562
|
```
|
|
539
563
|
|
|
540
564
|
Compare:
|
|
541
565
|
|
|
542
566
|
```bash
|
|
543
|
-
npx api-contract diff old.yaml new.yaml
|
|
567
|
+
npx @arpixel/api-contract diff old.yaml new.yaml
|
|
544
568
|
```
|
|
545
569
|
|
|
546
570
|
Install the optional VS Code/Copilot integration:
|
|
547
571
|
|
|
548
572
|
```bash
|
|
549
|
-
npx api-contract init --host vscode
|
|
573
|
+
npx @arpixel/api-contract init --host vscode
|
|
574
|
+
```
|
|
575
|
+
|
|
576
|
+
## Install as a project dependency
|
|
577
|
+
|
|
578
|
+
Install the CLI in your project:
|
|
579
|
+
|
|
580
|
+
```bash
|
|
581
|
+
npm install -D @arpixel/api-contract
|
|
582
|
+
```
|
|
583
|
+
|
|
584
|
+
Then use the `api-contract` binary:
|
|
585
|
+
|
|
586
|
+
```bash
|
|
587
|
+
npx api-contract generate openapi.yaml
|
|
588
|
+
```
|
|
589
|
+
|
|
590
|
+
```bash
|
|
591
|
+
npx api-contract diff old.yaml new.yaml
|
|
550
592
|
```
|
|
551
593
|
|
|
552
594
|
## Requirements
|
|
@@ -594,6 +636,7 @@ npm run dev -- diff examples/old.yaml examples/new.yaml
|
|
|
594
636
|
|
|
595
637
|
```text
|
|
596
638
|
api-contract/
|
|
639
|
+
|
|
597
640
|
├── src/
|
|
598
641
|
│ ├── cli.ts
|
|
599
642
|
│ ├── commands/
|
|
@@ -663,7 +706,7 @@ api-contract/
|
|
|
663
706
|
* mock generation
|
|
664
707
|
* LLM/API-key management inside the CLI
|
|
665
708
|
* direct repository modification by the CLI
|
|
666
|
-
* host-specific agent installation
|
|
709
|
+
* host-specific agent installation beyond the currently supported VS Code/Copilot integration
|
|
667
710
|
|
|
668
711
|
The goal of V1 is to provide a small, deterministic, composable foundation for working with evolving API contracts and connecting contract changes to frontend code.
|
|
669
712
|
|
|
@@ -687,7 +730,6 @@ Potential future capabilities include:
|
|
|
687
730
|
* additional breaking-change rules
|
|
688
731
|
* improved API client generation
|
|
689
732
|
* additional AI-agent host integrations
|
|
690
|
-
* repository initialization/install commands
|
|
691
733
|
* broader frontend framework support
|
|
692
734
|
|
|
693
735
|
The roadmap is intentionally exploratory. The current focus is keeping the three core workflows — **Generate, Compare, Analyze** — deterministic, composable, and useful.
|