@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
@@ -10,7 +10,7 @@ import {
10
10
  RateLimitedError,
11
11
  UnauthorizedError,
12
12
  } from "../errors.js";
13
- import type { Account } from "../types.js";
13
+ import type { Account, AccountRead } from "../types.js";
14
14
 
15
15
  export class AccountResource {
16
16
  constructor(private readonly _core: HttpCore) {}
@@ -21,8 +21,8 @@ export class AccountResource {
21
21
  * identity endpoint the generated typeship CLI's `whoami` calls.
22
22
  * `GET /me`
23
23
  */
24
- async retrieve(options?: RequestOptions): Promise<ApiResult<Account, AccountRetrieveError>> {
25
- return this._core.request<Account, AccountRetrieveError>({
24
+ async retrieve(options?: RequestOptions): Promise<ApiResult<AccountRead, AccountRetrieveError>> {
25
+ return this._core.request<AccountRead, AccountRetrieveError>({
26
26
  method: "GET",
27
27
  path: "/me",
28
28
  errors: { "401": UnauthorizedError, "403": ForbiddenError, "429": RateLimitedError },
@@ -13,7 +13,14 @@ import {
13
13
  RateLimitedError,
14
14
  UnauthorizedError,
15
15
  } from "../errors.js";
16
- import type { ApiKey, ApiKeyList } from "../types.js";
16
+ import type {
17
+ ApiKey,
18
+ ApiKeyList,
19
+ ApiKeyListRead,
20
+ ApiKeyRead,
21
+ ApiKeyResponse,
22
+ ApiKeyResponseRead,
23
+ } from "../types.js";
17
24
 
18
25
  export class ApiKeysResource {
19
26
  constructor(private readonly _core: HttpCore) {}
@@ -26,8 +33,8 @@ export class ApiKeysResource {
26
33
  * Auto-paginates: `for await (const item of …)` walks every page.
27
34
  * `GET /api_keys`
28
35
  */
29
- list(params?: ApiKeysListParams, options?: RequestOptions): PagePromise<ApiKey, ApiKeysListError> {
30
- return paginate<ApiKey, ApiKeysListError>(this._core, {
36
+ list(params?: ApiKeysListParams, options?: RequestOptions): PagePromise<ApiKeyRead, ApiKeysListError> {
37
+ return paginate<ApiKeyRead, ApiKeysListError>(this._core, {
31
38
  method: "GET",
32
39
  path: "/api_keys",
33
40
  query: {
@@ -57,11 +64,16 @@ export class ApiKeysResource {
57
64
  * Revoke an API key
58
65
  *
59
66
  * Idempotent: revoking an already-revoked key returns the same body, so a rotation script that
60
- * re-runs does not have to special-case having already succeeded.
67
+ * re-runs does not have to special-case having already succeeded. An OAuth member may revoke a
68
+ * key they created; an organization admin may revoke any key. Organization API keys retain
69
+ * account-wide authority.
61
70
  * `DELETE /api_keys/{api_key_id}`
62
71
  */
63
- async revoke(apiKeyId: string, options?: RequestOptions): Promise<ApiResult<ApiKey, ApiKeysRevokeError>> {
64
- return this._core.request<ApiKey, ApiKeysRevokeError>({
72
+ async revoke(
73
+ apiKeyId: string,
74
+ options?: RequestOptions,
75
+ ): Promise<ApiResult<ApiKeyResponseRead, ApiKeysRevokeError>> {
76
+ return this._core.request<ApiKeyResponseRead, ApiKeysRevokeError>({
65
77
  method: "DELETE",
66
78
  path: `/api_keys/${encodeURIComponent(String(apiKeyId))}`,
67
79
  errors: {
@@ -80,7 +92,10 @@ export class ApiKeysResource {
80
92
  export interface ApiKeysListParams {
81
93
  /** Maximum number of resources to return. */
82
94
  limit?: number;
83
- /** Opaque cursor from the preceding page's next_cursor. */
95
+ /**
96
+ * Opaque cursor from the preceding page's next_cursor. Valid only for the same account,
97
+ * operation, filters, and ordering that issued it.
98
+ */
84
99
  cursor?: string;
85
100
  }
86
101
 
@@ -0,0 +1,198 @@
1
+ // typeship — definitionRevisions resource.
2
+ // Generated by typeship — https://typeship.dev — do not edit by hand.
3
+
4
+ import { HttpCore, type ApiResult, type RequestOptions } from "../core/http.js";
5
+ import { paginate, PagePromise } from "../core/pagination.js";
6
+ import {
7
+ TransportError,
8
+ UnexpectedApiError,
9
+ ValidationError,
10
+ BadRequestError,
11
+ ForbiddenError,
12
+ NotFoundError,
13
+ RateLimitedError,
14
+ UnauthorizedError,
15
+ } from "../errors.js";
16
+ import type {
17
+ DefinitionDocumentId,
18
+ DefinitionId,
19
+ DefinitionRevision,
20
+ DefinitionRevisionId,
21
+ DefinitionRevisionList,
22
+ DefinitionRevisionListRead,
23
+ DefinitionRevisionRead,
24
+ DefinitionRevisionResponse,
25
+ DefinitionRevisionResponseRead,
26
+ } from "../types.js";
27
+
28
+ export class DefinitionRevisionsResource {
29
+ constructor(private readonly _core: HttpCore) {}
30
+ /**
31
+ * List Definition Revisions
32
+ *
33
+ * Immutable snapshots of the complete resolved document graph this Definition observed, newest
34
+ * first. Content is available from the revision and document endpoints and is never embedded in a
35
+ * list response.
36
+ *
37
+ * Auto-paginates: `for await (const item of …)` walks every page.
38
+ * `GET /definitions/{definition_id}/revisions`
39
+ */
40
+ list(
41
+ definitionId: DefinitionId,
42
+ params?: DefinitionRevisionsListParams,
43
+ options?: RequestOptions,
44
+ ): PagePromise<DefinitionRevisionRead, DefinitionRevisionsListError> {
45
+ return paginate<DefinitionRevisionRead, DefinitionRevisionsListError>(this._core, {
46
+ method: "GET",
47
+ path: `/definitions/${encodeURIComponent(String(definitionId))}/revisions`,
48
+ query: {
49
+ limit: params?.limit,
50
+ cursor: params?.cursor,
51
+ },
52
+ errors: {
53
+ "400": BadRequestError,
54
+ "401": UnauthorizedError,
55
+ "403": ForbiddenError,
56
+ "404": NotFoundError,
57
+ "429": RateLimitedError,
58
+ },
59
+ idempotent: true,
60
+ schemaKey: "definitionRevisions.list",
61
+ options,
62
+ }, {
63
+ style: "cursor",
64
+ itemsField: "data",
65
+ cursorParam: "cursor",
66
+ nextCursorField: "next_cursor",
67
+ hasMoreField: "has_more",
68
+ limitParam: "limit",
69
+ });
70
+ }
71
+
72
+ /**
73
+ * Retrieve a Definition Revision
74
+ *
75
+ * Metadata for one immutable resolved document graph. Fetch its canonical content or individual
76
+ * source documents from the content endpoints.
77
+ * `GET /definition_revisions/{definition_revision_id}`
78
+ */
79
+ async retrieve(
80
+ definitionRevisionId: DefinitionRevisionId,
81
+ options?: RequestOptions,
82
+ ): Promise<ApiResult<DefinitionRevisionResponseRead, DefinitionRevisionsRetrieveError>> {
83
+ return this._core.request<DefinitionRevisionResponseRead, DefinitionRevisionsRetrieveError>({
84
+ method: "GET",
85
+ path: `/definition_revisions/${encodeURIComponent(String(definitionRevisionId))}`,
86
+ errors: {
87
+ "401": UnauthorizedError,
88
+ "403": ForbiddenError,
89
+ "404": NotFoundError,
90
+ "429": RateLimitedError,
91
+ },
92
+ idempotent: true,
93
+ schemaKey: "definitionRevisions.retrieve",
94
+ options,
95
+ });
96
+ }
97
+
98
+ /**
99
+ * Retrieve a Definition Revision's canonical content
100
+ *
101
+ * Returns the exact canonical resolved content identified by the revision's graph digest,
102
+ * suitable for saving or piping into a diff.
103
+ * `GET /definition_revisions/{definition_revision_id}/content`
104
+ */
105
+ async retrieveContent(
106
+ definitionRevisionId: DefinitionRevisionId,
107
+ options?: RequestOptions,
108
+ ): Promise<ApiResult<string, DefinitionRevisionsRetrieveContentError>> {
109
+ return this._core.request<string, DefinitionRevisionsRetrieveContentError>({
110
+ method: "GET",
111
+ path: `/definition_revisions/${encodeURIComponent(String(definitionRevisionId))}/content`,
112
+ errors: {
113
+ "401": UnauthorizedError,
114
+ "403": ForbiddenError,
115
+ "404": NotFoundError,
116
+ "429": RateLimitedError,
117
+ },
118
+ idempotent: true,
119
+ schemaKey: "definitionRevisions.retrieveContent",
120
+ options,
121
+ });
122
+ }
123
+
124
+ /**
125
+ * Retrieve one source document from a Definition Revision
126
+ * `GET /definition_revisions/{definition_revision_id}/documents/{document_id}/content`
127
+ */
128
+ async retrieveDocumentContent(
129
+ definitionRevisionId: DefinitionRevisionId,
130
+ documentId: DefinitionDocumentId,
131
+ options?: RequestOptions,
132
+ ): Promise<ApiResult<string, DefinitionRevisionsRetrieveDocumentContentError>> {
133
+ return this._core.request<string, DefinitionRevisionsRetrieveDocumentContentError>({
134
+ method: "GET",
135
+ path: `/definition_revisions/${encodeURIComponent(String(definitionRevisionId))}/documents/${encodeURIComponent(String(documentId))}/content`,
136
+ errors: {
137
+ "401": UnauthorizedError,
138
+ "403": ForbiddenError,
139
+ "404": NotFoundError,
140
+ "429": RateLimitedError,
141
+ },
142
+ idempotent: true,
143
+ schemaKey: "definitionRevisions.retrieveDocumentContent",
144
+ options,
145
+ });
146
+ }
147
+ }
148
+
149
+ export interface DefinitionRevisionsListParams {
150
+ /** Maximum number of resources to return. */
151
+ limit?: number;
152
+ /**
153
+ * Opaque cursor from the preceding page's next_cursor. Valid only for the same account,
154
+ * operation, filters, and ordering that issued it.
155
+ */
156
+ cursor?: string;
157
+ }
158
+
159
+ /** Every error `list` can produce, as a discriminated union. */
160
+ export type DefinitionRevisionsListError =
161
+ | BadRequestError
162
+ | UnauthorizedError
163
+ | ForbiddenError
164
+ | NotFoundError
165
+ | RateLimitedError
166
+ | UnexpectedApiError
167
+ | TransportError
168
+ | ValidationError;
169
+
170
+ /** Every error `retrieve` can produce, as a discriminated union. */
171
+ export type DefinitionRevisionsRetrieveError =
172
+ | UnauthorizedError
173
+ | ForbiddenError
174
+ | NotFoundError
175
+ | RateLimitedError
176
+ | UnexpectedApiError
177
+ | TransportError
178
+ | ValidationError;
179
+
180
+ /** Every error `retrieveContent` can produce, as a discriminated union. */
181
+ export type DefinitionRevisionsRetrieveContentError =
182
+ | UnauthorizedError
183
+ | ForbiddenError
184
+ | NotFoundError
185
+ | RateLimitedError
186
+ | UnexpectedApiError
187
+ | TransportError
188
+ | ValidationError;
189
+
190
+ /** Every error `retrieveDocumentContent` can produce, as a discriminated union. */
191
+ export type DefinitionRevisionsRetrieveDocumentContentError =
192
+ | UnauthorizedError
193
+ | ForbiddenError
194
+ | NotFoundError
195
+ | RateLimitedError
196
+ | UnexpectedApiError
197
+ | TransportError
198
+ | ValidationError;
@@ -0,0 +1,97 @@
1
+ // typeship — definitions resource.
2
+ // Generated by typeship — https://typeship.dev — do not edit by hand.
3
+
4
+ import { HttpCore, type ApiResult, type RequestOptions } from "../core/http.js";
5
+ import {
6
+ TransportError,
7
+ UnexpectedApiError,
8
+ ValidationError,
9
+ BadRequestError,
10
+ ForbiddenError,
11
+ NotFoundError,
12
+ RateLimitedError,
13
+ UnauthorizedError,
14
+ UnprocessableEntityError,
15
+ } from "../errors.js";
16
+ import type {
17
+ Definition,
18
+ DefinitionId,
19
+ DefinitionRead,
20
+ DefinitionUpdateRequest,
21
+ } from "../types.js";
22
+
23
+ export class DefinitionsResource {
24
+ constructor(private readonly _core: HttpCore) {}
25
+ /**
26
+ * Retrieve a Definition
27
+ * `GET /definitions/{definition_id}`
28
+ */
29
+ async retrieve(
30
+ definitionId: DefinitionId,
31
+ options?: RequestOptions,
32
+ ): Promise<ApiResult<DefinitionRead, DefinitionsRetrieveError>> {
33
+ return this._core.request<DefinitionRead, DefinitionsRetrieveError>({
34
+ method: "GET",
35
+ path: `/definitions/${encodeURIComponent(String(definitionId))}`,
36
+ errors: {
37
+ "401": UnauthorizedError,
38
+ "403": ForbiddenError,
39
+ "404": NotFoundError,
40
+ "429": RateLimitedError,
41
+ },
42
+ idempotent: true,
43
+ schemaKey: "definitions.retrieve",
44
+ options,
45
+ });
46
+ }
47
+
48
+ /**
49
+ * Update and resolve a Definition
50
+ *
51
+ * Resolves the complete document graph and records a new immutable revision before saving.
52
+ * `PATCH /definitions/{definition_id}`
53
+ */
54
+ async update(
55
+ definitionId: DefinitionId,
56
+ body: DefinitionUpdateRequest,
57
+ options?: RequestOptions,
58
+ ): Promise<ApiResult<DefinitionRead, DefinitionsUpdateError>> {
59
+ return this._core.request<DefinitionRead, DefinitionsUpdateError>({
60
+ method: "PATCH",
61
+ path: `/definitions/${encodeURIComponent(String(definitionId))}`,
62
+ body,
63
+ errors: {
64
+ "400": BadRequestError,
65
+ "401": UnauthorizedError,
66
+ "403": ForbiddenError,
67
+ "404": NotFoundError,
68
+ "422": UnprocessableEntityError,
69
+ "429": RateLimitedError,
70
+ },
71
+ schemaKey: "definitions.update",
72
+ options,
73
+ });
74
+ }
75
+ }
76
+
77
+ /** Every error `retrieve` can produce, as a discriminated union. */
78
+ export type DefinitionsRetrieveError =
79
+ | UnauthorizedError
80
+ | ForbiddenError
81
+ | NotFoundError
82
+ | RateLimitedError
83
+ | UnexpectedApiError
84
+ | TransportError
85
+ | ValidationError;
86
+
87
+ /** Every error `update` can produce, as a discriminated union. */
88
+ export type DefinitionsUpdateError =
89
+ | BadRequestError
90
+ | UnauthorizedError
91
+ | ForbiddenError
92
+ | NotFoundError
93
+ | UnprocessableEntityError
94
+ | RateLimitedError
95
+ | UnexpectedApiError
96
+ | TransportError
97
+ | ValidationError;
@@ -14,29 +14,29 @@ import {
14
14
  UnauthorizedError,
15
15
  UnprocessableEntityError,
16
16
  } from "../errors.js";
17
- import type { GenerateRequest, GenerationResult } from "../types.js";
17
+ import type { GenerateRequest, GenerationResult, GenerationResultRead } from "../types.js";
18
18
 
19
19
  export class GenerateResource {
20
20
  constructor(private readonly _core: HttpCore) {}
21
21
  /**
22
- * Generate a package from a spec
22
+ * Generate one Target from a Definition
23
23
  *
24
24
  * Stateless generation: nothing is stored. Returns the full generated
25
25
  * package as files. Works without an API key: anonymous calls generate
26
26
  * the first 25 operations, rate limited per IP address, and the
27
27
  * response's `limits` object says what was held back and where to lift
28
- * it; anonymous calls from a spec URL also carry `claim.url`, a link
28
+ * it; anonymous calls from a Definition URL also carry `claim.url`, a link
29
29
  * that turns the run into a project once a person signs in. With a key, the free plan generates
30
30
  * the first 25 operations and
31
- * paid plans generate the whole spec. A present but invalid key is a
31
+ * paid plans generate the complete Definition. A present but invalid key is a
32
32
  * 401, not a downgrade to anonymous.
33
33
  * `POST /generate`
34
34
  */
35
35
  async run(
36
36
  body: GenerateRequest,
37
37
  options?: RequestOptions,
38
- ): Promise<ApiResult<GenerationResult, GenerateRunError>> {
39
- return this._core.request<GenerationResult, GenerateRunError>({
38
+ ): Promise<ApiResult<GenerationResultRead, GenerateRunError>> {
39
+ return this._core.request<GenerationResultRead, GenerateRunError>({
40
40
  method: "POST",
41
41
  path: "/generate",
42
42
  body,
@@ -12,7 +12,7 @@ import {
12
12
  RateLimitedError,
13
13
  UnauthorizedError,
14
14
  } from "../errors.js";
15
- import type { Generation, GenerationId } from "../types.js";
15
+ import type { GenerationId, GenerationResponse, GenerationResponseRead } from "../types.js";
16
16
 
17
17
  export class GenerationsResource {
18
18
  constructor(private readonly _core: HttpCore) {}
@@ -25,8 +25,8 @@ export class GenerationsResource {
25
25
  async retrieve(
26
26
  generationId: GenerationId,
27
27
  options?: RequestOptions,
28
- ): Promise<ApiResult<Generation, GenerationsRetrieveError>> {
29
- return this._core.request<Generation, GenerationsRetrieveError>({
28
+ ): Promise<ApiResult<GenerationResponseRead, GenerationsRetrieveError>> {
29
+ return this._core.request<GenerationResponseRead, GenerationsRetrieveError>({
30
30
  method: "GET",
31
31
  path: `/generations/${encodeURIComponent(String(generationId))}`,
32
32
  errors: {
@@ -44,7 +44,7 @@ export class GenerationsResource {
44
44
  /**
45
45
  * Fetch one file from a generation
46
46
  *
47
- * Raw file content, for generations whose output was too large to inline (files_omitted true).
47
+ * Raw file content, for generations whose target was too large to inline (files_omitted true).
48
48
  * The generation's files_index lists valid paths.
49
49
  * `GET /generations/{generation_id}/file`
50
50
  */