@typeship-ax/mcp 0.6.0 → 0.8.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 (79) hide show
  1. package/README.md +1 -1
  2. package/api.json +5597 -3010
  3. package/api.md +433 -54
  4. package/dist/core/http.d.ts +6 -92
  5. package/dist/core/http.d.ts.map +1 -1
  6. package/dist/core/http.js +70 -209
  7. package/dist/core/pagination.d.ts.map +1 -1
  8. package/dist/core/pagination.js +6 -34
  9. package/dist/dates.d.ts +0 -2
  10. package/dist/dates.d.ts.map +1 -1
  11. package/dist/dates.js +0 -1
  12. package/dist/docs.d.ts +11 -0
  13. package/dist/docs.d.ts.map +1 -0
  14. package/dist/docs.js +114 -0
  15. package/dist/errors.d.ts +27 -27
  16. package/dist/errors.d.ts.map +1 -1
  17. package/dist/errors.js +7 -7
  18. package/dist/index.d.ts +19 -11
  19. package/dist/index.d.ts.map +1 -1
  20. package/dist/index.js +23 -13
  21. package/dist/mcp-protocol.d.ts +19 -24
  22. package/dist/mcp-protocol.d.ts.map +1 -1
  23. package/dist/mcp-protocol.js +160 -124
  24. package/dist/mcp.js +16 -19
  25. package/dist/ops.d.ts +5 -0
  26. package/dist/ops.d.ts.map +1 -1
  27. package/dist/ops.js +31 -17
  28. package/dist/resources/account.d.ts +2 -2
  29. package/dist/resources/account.d.ts.map +1 -1
  30. package/dist/resources/api-keys.d.ts +10 -5
  31. package/dist/resources/api-keys.d.ts.map +1 -1
  32. package/dist/resources/api-keys.js +3 -1
  33. package/dist/resources/definition-revisions.d.ts +58 -0
  34. package/dist/resources/definition-revisions.d.ts.map +1 -0
  35. package/dist/resources/definition-revisions.js +110 -0
  36. package/dist/resources/definitions.d.ts +24 -0
  37. package/dist/resources/definitions.d.ts.map +1 -0
  38. package/dist/resources/definitions.js +51 -0
  39. package/dist/resources/generate.d.ts +5 -5
  40. package/dist/resources/generate.d.ts.map +1 -1
  41. package/dist/resources/generate.js +3 -3
  42. package/dist/resources/generations.d.ts +3 -3
  43. package/dist/resources/generations.d.ts.map +1 -1
  44. package/dist/resources/generations.js +1 -1
  45. package/dist/resources/projects.d.ts +66 -26
  46. package/dist/resources/projects.d.ts.map +1 -1
  47. package/dist/resources/projects.js +87 -13
  48. package/dist/resources/targets.d.ts +86 -0
  49. package/dist/resources/targets.d.ts.map +1 -0
  50. package/dist/resources/targets.js +184 -0
  51. package/dist/schemas.d.ts.map +1 -1
  52. package/dist/schemas.js +119 -62
  53. package/dist/types.d.ts +1761 -222
  54. package/dist/types.d.ts.map +1 -1
  55. package/dist/types.js +9 -3
  56. package/package.json +1 -1
  57. package/src/core/http.ts +75 -293
  58. package/src/core/pagination.ts +6 -30
  59. package/src/dates.ts +0 -1
  60. package/src/docs.ts +101 -0
  61. package/src/errors.ts +30 -30
  62. package/src/index.ts +23 -13
  63. package/src/mcp-protocol.ts +170 -120
  64. package/src/mcp.ts +22 -22
  65. package/src/ops.ts +43 -17
  66. package/src/resources/account.ts +3 -3
  67. package/src/resources/api-keys.ts +22 -7
  68. package/src/resources/definition-revisions.ts +198 -0
  69. package/src/resources/definitions.ts +97 -0
  70. package/src/resources/generate.ts +6 -6
  71. package/src/resources/generations.ts +4 -4
  72. package/src/resources/projects.ts +182 -37
  73. package/src/resources/targets.ts +346 -0
  74. package/src/schemas.ts +119 -62
  75. package/src/types.ts +1947 -281
  76. package/dist/resources/spec-revisions.d.ts +0 -47
  77. package/dist/resources/spec-revisions.d.ts.map +0 -1
  78. package/dist/resources/spec-revisions.js +0 -90
  79. package/src/resources/spec-revisions.ts +0 -150
@@ -20,14 +20,28 @@ import {
20
20
  import type {
21
21
  CreateProjectRequest,
22
22
  DeletedProject,
23
+ DeletedProjectRead,
24
+ DiagnosticRemediation,
25
+ DiagnosticRemediationRead,
26
+ DiagnosticRemediationRequest,
27
+ DiagnosticReport,
28
+ DiagnosticReportRead,
23
29
  Generation,
24
30
  GenerationBatch,
31
+ GenerationBatchRead,
25
32
  GenerationList,
26
- GithubIntegrationHealth,
27
- OutputId,
33
+ GenerationListRead,
34
+ GenerationRead,
28
35
  Project,
29
36
  ProjectId,
30
37
  ProjectList,
38
+ ProjectListRead,
39
+ ProjectRead,
40
+ ProjectSummary,
41
+ ProjectSummaryRead,
42
+ RepositoryIntegrationHealth,
43
+ RepositoryIntegrationHealthRead,
44
+ TargetId,
31
45
  UpdateProjectRequest,
32
46
  } from "../types.js";
33
47
 
@@ -39,8 +53,11 @@ export class ProjectsResource {
39
53
  * Auto-paginates: `for await (const item of …)` walks every page.
40
54
  * `GET /projects`
41
55
  */
42
- list(params?: ProjectsListParams, options?: RequestOptions): PagePromise<Project, ProjectsListError> {
43
- return paginate<Project, ProjectsListError>(this._core, {
56
+ list(
57
+ params?: ProjectsListParams,
58
+ options?: RequestOptions,
59
+ ): PagePromise<ProjectSummaryRead, ProjectsListError> {
60
+ return paginate<ProjectSummaryRead, ProjectsListError>(this._core, {
44
61
  method: "GET",
45
62
  path: "/projects",
46
63
  query: {
@@ -70,9 +87,9 @@ export class ProjectsResource {
70
87
  * Create a project
71
88
  *
72
89
  * Stores a URL- or GitHub-sourced project. Free includes one stored project, every selected
73
- * output, and the first 25 operations, while keeping manual and automatic regeneration, history,
90
+ * target, and the first 25 operations, while keeping manual and automatic regeneration, history,
74
91
  * destination pull requests, and preview checks. Stateless POST /generate does not consume this
75
- * slot. Pro adds projects and the whole spec.
92
+ * slot. Pro adds projects and generates every operation in the Definition.
76
93
  *
77
94
  * A `Idempotency-Key` UUID is generated per call (stable across retries) unless you pass one.
78
95
  * `POST /projects`
@@ -81,8 +98,8 @@ export class ProjectsResource {
81
98
  body: CreateProjectRequest,
82
99
  params?: ProjectsCreateParams,
83
100
  options?: RequestOptions,
84
- ): Promise<ApiResult<Project, ProjectsCreateError>> {
85
- return this._core.request<Project, ProjectsCreateError>({
101
+ ): Promise<ApiResult<ProjectRead, ProjectsCreateError>> {
102
+ return this._core.request<ProjectRead, ProjectsCreateError>({
86
103
  method: "POST",
87
104
  path: "/projects",
88
105
  headers: {
@@ -95,6 +112,7 @@ export class ProjectsResource {
95
112
  "402": PaymentRequiredError,
96
113
  "403": ForbiddenError,
97
114
  "409": ConflictError,
115
+ "422": UnprocessableEntityError,
98
116
  "429": RateLimitedError,
99
117
  "500": InternalServerError,
100
118
  },
@@ -111,8 +129,8 @@ export class ProjectsResource {
111
129
  async retrieve(
112
130
  projectId: ProjectId,
113
131
  options?: RequestOptions,
114
- ): Promise<ApiResult<Project, ProjectsRetrieveError>> {
115
- return this._core.request<Project, ProjectsRetrieveError>({
132
+ ): Promise<ApiResult<ProjectRead, ProjectsRetrieveError>> {
133
+ return this._core.request<ProjectRead, ProjectsRetrieveError>({
116
134
  method: "GET",
117
135
  path: `/projects/${encodeURIComponent(String(projectId))}`,
118
136
  errors: {
@@ -134,8 +152,8 @@ export class ProjectsResource {
134
152
  async delete(
135
153
  projectId: ProjectId,
136
154
  options?: RequestOptions,
137
- ): Promise<ApiResult<DeletedProject, ProjectsDeleteError>> {
138
- return this._core.request<DeletedProject, ProjectsDeleteError>({
155
+ ): Promise<ApiResult<DeletedProjectRead, ProjectsDeleteError>> {
156
+ return this._core.request<DeletedProjectRead, ProjectsDeleteError>({
139
157
  method: "DELETE",
140
158
  path: `/projects/${encodeURIComponent(String(projectId))}`,
141
159
  errors: {
@@ -158,8 +176,8 @@ export class ProjectsResource {
158
176
  projectId: ProjectId,
159
177
  body: UpdateProjectRequest,
160
178
  options?: RequestOptions,
161
- ): Promise<ApiResult<Project, ProjectsUpdateError>> {
162
- return this._core.request<Project, ProjectsUpdateError>({
179
+ ): Promise<ApiResult<ProjectRead, ProjectsUpdateError>> {
180
+ return this._core.request<ProjectRead, ProjectsUpdateError>({
163
181
  method: "PATCH",
164
182
  path: `/projects/${encodeURIComponent(String(projectId))}`,
165
183
  body,
@@ -169,6 +187,7 @@ export class ProjectsResource {
169
187
  "402": PaymentRequiredError,
170
188
  "403": ForbiddenError,
171
189
  "404": NotFoundError,
190
+ "422": UnprocessableEntityError,
172
191
  "429": RateLimitedError,
173
192
  },
174
193
  schemaKey: "projects.update",
@@ -177,20 +196,21 @@ export class ProjectsResource {
177
196
  }
178
197
 
179
198
  /**
180
- * Diagnose a project's GitHub integration
199
+ * Analyze a project's latest Definition Revision
181
200
  *
182
- * Returns machine-actionable source and destination access, spec readability, optional label
183
- * setup, required status names, and the latest durable webhook delivery. The console renders this
184
- * same result.
185
- * `GET /projects/{project_id}/github`
201
+ * Runs deterministic OpenAPI or GraphQL authorship checks against the latest observed immutable
202
+ * Definition Revision after applying the Definition's existing patches. Diagnostics group every
203
+ * affected location under a stable rule. Exact patches are included only when Typeship can derive
204
+ * the change without inventing API behavior.
205
+ * `GET /projects/{project_id}/diagnostics`
186
206
  */
187
- async retrieveGithubHealth(
207
+ async retrieveDiagnostics(
188
208
  projectId: ProjectId,
189
209
  options?: RequestOptions,
190
- ): Promise<ApiResult<GithubIntegrationHealth, ProjectsRetrieveGithubHealthError>> {
191
- return this._core.request<GithubIntegrationHealth, ProjectsRetrieveGithubHealthError>({
210
+ ): Promise<ApiResult<DiagnosticReportRead, ProjectsRetrieveDiagnosticsError>> {
211
+ return this._core.request<DiagnosticReportRead, ProjectsRetrieveDiagnosticsError>({
192
212
  method: "GET",
193
- path: `/projects/${encodeURIComponent(String(projectId))}/github`,
213
+ path: `/projects/${encodeURIComponent(String(projectId))}/diagnostics`,
194
214
  errors: {
195
215
  "401": UnauthorizedError,
196
216
  "403": ForbiddenError,
@@ -198,7 +218,91 @@ export class ProjectsResource {
198
218
  "429": RateLimitedError,
199
219
  },
200
220
  idempotent: true,
201
- schemaKey: "projects.retrieveGithubHealth",
221
+ schemaKey: "projects.retrieveDiagnostics",
222
+ options,
223
+ });
224
+ }
225
+
226
+ /**
227
+ * Refresh a project's Diagnostics from its configured source
228
+ *
229
+ * Fetches the complete configured source, records a new immutable revision only when content
230
+ * changed, and returns its Diagnostics. This does not generate targets or consume a metered
231
+ * generation.
232
+ * `POST /projects/{project_id}/diagnostics`
233
+ */
234
+ async refreshDiagnostics(
235
+ projectId: ProjectId,
236
+ options?: RequestOptions,
237
+ ): Promise<ApiResult<DiagnosticReportRead, ProjectsRefreshDiagnosticsError>> {
238
+ return this._core.request<DiagnosticReportRead, ProjectsRefreshDiagnosticsError>({
239
+ method: "POST",
240
+ path: `/projects/${encodeURIComponent(String(projectId))}/diagnostics`,
241
+ errors: {
242
+ "401": UnauthorizedError,
243
+ "403": ForbiddenError,
244
+ "404": NotFoundError,
245
+ "422": UnprocessableEntityError,
246
+ "429": RateLimitedError,
247
+ },
248
+ schemaKey: "projects.refreshDiagnostics",
249
+ options,
250
+ });
251
+ }
252
+
253
+ /**
254
+ * Apply exact, reviewed diagnostic remediations
255
+ *
256
+ * Applies only deterministic patches. Repository sources receive an updateable source pull
257
+ * request; URL sources receive project overlays. Diagnostics that require API-owner intent return
258
+ * 422 and include an authoring_brief in the Diagnostic instead.
259
+ * `POST /projects/{project_id}/diagnostics/remediations`
260
+ */
261
+ async remediateDiagnostics(
262
+ projectId: ProjectId,
263
+ body: DiagnosticRemediationRequest,
264
+ options?: RequestOptions,
265
+ ): Promise<ApiResult<DiagnosticRemediationRead, ProjectsRemediateDiagnosticsError>> {
266
+ return this._core.request<DiagnosticRemediationRead, ProjectsRemediateDiagnosticsError>({
267
+ method: "POST",
268
+ path: `/projects/${encodeURIComponent(String(projectId))}/diagnostics/remediations`,
269
+ body,
270
+ errors: {
271
+ "400": BadRequestError,
272
+ "401": UnauthorizedError,
273
+ "403": ForbiddenError,
274
+ "404": NotFoundError,
275
+ "422": UnprocessableEntityError,
276
+ "429": RateLimitedError,
277
+ },
278
+ schemaKey: "projects.remediateDiagnostics",
279
+ options,
280
+ });
281
+ }
282
+
283
+ /**
284
+ * Diagnose a project's repository integrations
285
+ *
286
+ * Returns provider-neutral, machine-actionable source and destination access, Definition
287
+ * readability, source-approval label setup, required status names, and the latest durable webhook
288
+ * delivery. The Console renders this same result.
289
+ * `GET /projects/{project_id}/integration-health`
290
+ */
291
+ async retrieveIntegrationHealth(
292
+ projectId: ProjectId,
293
+ options?: RequestOptions,
294
+ ): Promise<ApiResult<RepositoryIntegrationHealthRead, ProjectsRetrieveIntegrationHealthError>> {
295
+ return this._core.request<RepositoryIntegrationHealthRead, ProjectsRetrieveIntegrationHealthError>({
296
+ method: "GET",
297
+ path: `/projects/${encodeURIComponent(String(projectId))}/integration-health`,
298
+ errors: {
299
+ "401": UnauthorizedError,
300
+ "403": ForbiddenError,
301
+ "404": NotFoundError,
302
+ "429": RateLimitedError,
303
+ },
304
+ idempotent: true,
305
+ schemaKey: "projects.retrieveIntegrationHealth",
202
306
  options,
203
307
  });
204
308
  }
@@ -213,14 +317,14 @@ export class ProjectsResource {
213
317
  projectId: ProjectId,
214
318
  params?: ProjectsListGenerationsParams,
215
319
  options?: RequestOptions,
216
- ): PagePromise<Generation, ProjectsListGenerationsError> {
217
- return paginate<Generation, ProjectsListGenerationsError>(this._core, {
320
+ ): PagePromise<GenerationRead, ProjectsListGenerationsError> {
321
+ return paginate<GenerationRead, ProjectsListGenerationsError>(this._core, {
218
322
  method: "GET",
219
323
  path: `/projects/${encodeURIComponent(String(projectId))}/generations`,
220
324
  query: {
221
325
  limit: params?.limit,
222
326
  cursor: params?.cursor,
223
- output: params?.output,
327
+ target_id: params?.targetId,
224
328
  },
225
329
  errors: {
226
330
  "400": BadRequestError,
@@ -243,9 +347,9 @@ export class ProjectsResource {
243
347
  }
244
348
 
245
349
  /**
246
- * Generate outputs and open pull requests
350
+ * Generate targets and open pull requests
247
351
  *
248
- * Resolves the project's URL or repository source, generates every
352
+ * Resolves the project's URL or GitHub source, generates every
249
353
  * configured delivery package, stores each result in the project's history,
250
354
  * and attempts to open a pull request in every configured destination.
251
355
  * When the complete generated tree already matches a destination, no
@@ -257,8 +361,8 @@ export class ProjectsResource {
257
361
  async generate(
258
362
  projectId: ProjectId,
259
363
  options?: RequestOptions,
260
- ): Promise<ApiResult<GenerationBatch, ProjectsGenerateError>> {
261
- return this._core.request<GenerationBatch, ProjectsGenerateError>({
364
+ ): Promise<ApiResult<GenerationBatchRead, ProjectsGenerateError>> {
365
+ return this._core.request<GenerationBatchRead, ProjectsGenerateError>({
262
366
  method: "POST",
263
367
  path: `/projects/${encodeURIComponent(String(projectId))}/generations`,
264
368
  errors: {
@@ -279,7 +383,10 @@ export class ProjectsResource {
279
383
  export interface ProjectsListParams {
280
384
  /** Maximum number of resources to return. */
281
385
  limit?: number;
282
- /** Opaque cursor from the preceding page's next_cursor. */
386
+ /**
387
+ * Opaque cursor from the preceding page's next_cursor. Valid only for the same account,
388
+ * operation, filters, and ordering that issued it.
389
+ */
283
390
  cursor?: string;
284
391
  }
285
392
 
@@ -309,6 +416,7 @@ export type ProjectsCreateError =
309
416
  | PaymentRequiredError
310
417
  | ForbiddenError
311
418
  | ConflictError
419
+ | UnprocessableEntityError
312
420
  | RateLimitedError
313
421
  | InternalServerError
314
422
  | UnexpectedApiError
@@ -342,13 +450,47 @@ export type ProjectsUpdateError =
342
450
  | PaymentRequiredError
343
451
  | ForbiddenError
344
452
  | NotFoundError
453
+ | UnprocessableEntityError
454
+ | RateLimitedError
455
+ | UnexpectedApiError
456
+ | TransportError
457
+ | ValidationError;
458
+
459
+ /** Every error `retrieveDiagnostics` can produce, as a discriminated union. */
460
+ export type ProjectsRetrieveDiagnosticsError =
461
+ | UnauthorizedError
462
+ | ForbiddenError
463
+ | NotFoundError
464
+ | RateLimitedError
465
+ | UnexpectedApiError
466
+ | TransportError
467
+ | ValidationError;
468
+
469
+ /** Every error `refreshDiagnostics` can produce, as a discriminated union. */
470
+ export type ProjectsRefreshDiagnosticsError =
471
+ | UnauthorizedError
472
+ | ForbiddenError
473
+ | NotFoundError
474
+ | UnprocessableEntityError
475
+ | RateLimitedError
476
+ | UnexpectedApiError
477
+ | TransportError
478
+ | ValidationError;
479
+
480
+ /** Every error `remediateDiagnostics` can produce, as a discriminated union. */
481
+ export type ProjectsRemediateDiagnosticsError =
482
+ | BadRequestError
483
+ | UnauthorizedError
484
+ | ForbiddenError
485
+ | NotFoundError
486
+ | UnprocessableEntityError
345
487
  | RateLimitedError
346
488
  | UnexpectedApiError
347
489
  | TransportError
348
490
  | ValidationError;
349
491
 
350
- /** Every error `retrieveGithubHealth` can produce, as a discriminated union. */
351
- export type ProjectsRetrieveGithubHealthError =
492
+ /** Every error `retrieveIntegrationHealth` can produce, as a discriminated union. */
493
+ export type ProjectsRetrieveIntegrationHealthError =
352
494
  | UnauthorizedError
353
495
  | ForbiddenError
354
496
  | NotFoundError
@@ -360,10 +502,13 @@ export type ProjectsRetrieveGithubHealthError =
360
502
  export interface ProjectsListGenerationsParams {
361
503
  /** Maximum number of resources to return. */
362
504
  limit?: number;
363
- /** Opaque cursor from the preceding page's next_cursor. */
505
+ /**
506
+ * Opaque cursor from the preceding page's next_cursor. Valid only for the same account,
507
+ * operation, filters, and ordering that issued it.
508
+ */
364
509
  cursor?: string;
365
- /** Only generations for this output. */
366
- output?: OutputId;
510
+ /** Only generations for this persisted Target. */
511
+ targetId?: TargetId;
367
512
  }
368
513
 
369
514
  /** Every error `listGenerations` can produce, as a discriminated union. */