@onmyway133/asc-cli 1.0.1

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 (55) hide show
  1. package/README.md +299 -0
  2. package/bun.lock +231 -0
  3. package/dist/index.js +179 -0
  4. package/docs/API_COVERAGE.md +355 -0
  5. package/docs/openapi/latest.json +230597 -0
  6. package/docs/openapi/paths.txt +1208 -0
  7. package/openapi-ts.config.ts +25 -0
  8. package/package.json +32 -0
  9. package/scripts/gen-paths-index.py +24 -0
  10. package/src/api/client.ts +132 -0
  11. package/src/api/generated/client/client.gen.ts +298 -0
  12. package/src/api/generated/client/index.ts +25 -0
  13. package/src/api/generated/client/types.gen.ts +214 -0
  14. package/src/api/generated/client/utils.gen.ts +316 -0
  15. package/src/api/generated/client.gen.ts +16 -0
  16. package/src/api/generated/core/auth.gen.ts +41 -0
  17. package/src/api/generated/core/bodySerializer.gen.ts +82 -0
  18. package/src/api/generated/core/params.gen.ts +169 -0
  19. package/src/api/generated/core/pathSerializer.gen.ts +171 -0
  20. package/src/api/generated/core/queryKeySerializer.gen.ts +117 -0
  21. package/src/api/generated/core/serverSentEvents.gen.ts +242 -0
  22. package/src/api/generated/core/types.gen.ts +104 -0
  23. package/src/api/generated/core/utils.gen.ts +140 -0
  24. package/src/api/generated/index.ts +4 -0
  25. package/src/api/generated/sdk.gen.ts +11701 -0
  26. package/src/api/generated/types.gen.ts +92035 -0
  27. package/src/api/hey-api-client.ts +20 -0
  28. package/src/api/types.ts +160 -0
  29. package/src/auth/credentials.ts +125 -0
  30. package/src/auth/jwt.ts +118 -0
  31. package/src/commands/app-info.ts +110 -0
  32. package/src/commands/apps.ts +44 -0
  33. package/src/commands/auth.ts +327 -0
  34. package/src/commands/availability.ts +52 -0
  35. package/src/commands/beta-review.ts +145 -0
  36. package/src/commands/builds.ts +97 -0
  37. package/src/commands/game-center.ts +114 -0
  38. package/src/commands/iap.ts +105 -0
  39. package/src/commands/metadata.ts +81 -0
  40. package/src/commands/pricing.ts +110 -0
  41. package/src/commands/reports.ts +116 -0
  42. package/src/commands/reviews.ts +93 -0
  43. package/src/commands/screenshots.ts +139 -0
  44. package/src/commands/signing.ts +214 -0
  45. package/src/commands/subscriptions.ts +144 -0
  46. package/src/commands/testflight.ts +110 -0
  47. package/src/commands/versions.ts +76 -0
  48. package/src/commands/xcode-cloud.ts +207 -0
  49. package/src/index.ts +1661 -0
  50. package/src/utils/help-spec.ts +835 -0
  51. package/src/utils/output.ts +79 -0
  52. package/tests/auth.test.ts +105 -0
  53. package/tests/client.test.ts +22 -0
  54. package/tests/output.test.ts +36 -0
  55. package/tsconfig.json +15 -0
@@ -0,0 +1,207 @@
1
+ import { ascFetch, ascFetchAll } from "../api/client.ts"
2
+ import { detectFormat, formatDate, printJSON, printSuccess, printTable, truncate } from "../utils/output.ts"
3
+
4
+ // ---- Xcode Cloud Products ----
5
+
6
+ export async function xcodeCloudProductsList(opts: {
7
+ appId?: string
8
+ output?: string
9
+ } = {}): Promise<void> {
10
+ const url = opts.appId
11
+ ? `/v1/apps/${opts.appId}/ciProduct`
12
+ : "/v1/ciProducts"
13
+ const items = await ascFetchAll<{
14
+ id: string
15
+ attributes: { name?: string; createdDate?: string; productType?: string }
16
+ }>(url)
17
+ const fmt = detectFormat(opts.output)
18
+ if (fmt === "json") { printJSON(items); return }
19
+ printTable(
20
+ ["Product ID", "Name", "Type", "Created"],
21
+ items.map(p => [
22
+ p.id,
23
+ p.attributes.name ?? "-",
24
+ p.attributes.productType ?? "-",
25
+ formatDate(p.attributes.createdDate ?? ""),
26
+ ]),
27
+ `Xcode Cloud Products (${items.length})`,
28
+ )
29
+ }
30
+
31
+ // ---- Workflows ----
32
+
33
+ export async function workflowsList(opts: {
34
+ productId: string
35
+ output?: string
36
+ }): Promise<void> {
37
+ const items = await ascFetchAll<{
38
+ id: string
39
+ attributes: {
40
+ name?: string
41
+ description?: string
42
+ isEnabled?: boolean
43
+ isLockedForEditing?: boolean
44
+ lastModifiedDate?: string
45
+ }
46
+ }>(`/v1/ciProducts/${opts.productId}/workflows`)
47
+ const fmt = detectFormat(opts.output)
48
+ if (fmt === "json") { printJSON(items); return }
49
+ printTable(
50
+ ["Workflow ID", "Name", "Enabled", "Last Modified"],
51
+ items.map(w => [
52
+ w.id,
53
+ truncate(w.attributes.name ?? "-", 40),
54
+ String(w.attributes.isEnabled ?? "-"),
55
+ formatDate(w.attributes.lastModifiedDate ?? ""),
56
+ ]),
57
+ `Workflows (${items.length})`,
58
+ )
59
+ }
60
+
61
+ export async function workflowGet(workflowId: string, opts: { output?: string } = {}): Promise<void> {
62
+ const result = await ascFetch<{
63
+ data: {
64
+ id: string
65
+ attributes: {
66
+ name?: string
67
+ description?: string
68
+ isEnabled?: boolean
69
+ isLockedForEditing?: boolean
70
+ lastModifiedDate?: string
71
+ branchStartCondition?: unknown
72
+ pullRequestStartCondition?: unknown
73
+ scheduledStartCondition?: unknown
74
+ tagStartCondition?: unknown
75
+ }
76
+ }
77
+ }>(`/v1/ciWorkflows/${workflowId}`)
78
+ const fmt = detectFormat(opts.output)
79
+ if (fmt === "json") { printJSON(result.data.data); return }
80
+ const a = result.data.data.attributes
81
+ console.log(`ID: ${result.data.data.id}`)
82
+ console.log(`Name: ${a.name ?? "-"}`)
83
+ console.log(`Description: ${a.description ?? "-"}`)
84
+ console.log(`Enabled: ${a.isEnabled ?? "-"}`)
85
+ console.log(`Last Modified: ${formatDate(a.lastModifiedDate ?? "")}`)
86
+ }
87
+
88
+ // ---- Builds ----
89
+
90
+ export async function xcodeCloudBuildsList(opts: {
91
+ workflowId?: string
92
+ productId?: string
93
+ output?: string
94
+ } = {}): Promise<void> {
95
+ const url = opts.workflowId
96
+ ? `/v1/ciWorkflows/${opts.workflowId}/buildRuns`
97
+ : opts.productId
98
+ ? `/v1/ciProducts/${opts.productId}/buildRuns`
99
+ : "/v1/ciBuildRuns"
100
+ const items = await ascFetchAll<{
101
+ id: string
102
+ attributes: {
103
+ number?: number
104
+ createdDate?: string
105
+ startedDate?: string
106
+ finishedDate?: string
107
+ sourceCommit?: { commitSha?: string; message?: string }
108
+ executionProgress?: string
109
+ completionStatus?: string
110
+ }
111
+ }>(url)
112
+ const fmt = detectFormat(opts.output)
113
+ if (fmt === "json") { printJSON(items); return }
114
+ printTable(
115
+ ["Build ID", "#", "Status", "Progress", "Started"],
116
+ items.map(b => [
117
+ b.id,
118
+ String(b.attributes.number ?? "-"),
119
+ b.attributes.completionStatus ?? "RUNNING",
120
+ b.attributes.executionProgress ?? "-",
121
+ formatDate(b.attributes.startedDate ?? b.attributes.createdDate ?? ""),
122
+ ]),
123
+ `Xcode Cloud Builds (${items.length})`,
124
+ )
125
+ }
126
+
127
+ export async function xcodeCloudBuildRun(opts: {
128
+ workflowId: string
129
+ branch?: string
130
+ tag?: string
131
+ }): Promise<void> {
132
+ const attributes: Record<string, unknown> = { isPullRequestBuild: false }
133
+ if (opts.branch) attributes["sourceCommit"] = { branch: opts.branch }
134
+ const result = await ascFetch<{ data: { id: string; attributes: { number?: number } } }>("/v1/ciBuildRuns", {
135
+ method: "POST",
136
+ body: {
137
+ data: {
138
+ type: "ciBuildRuns",
139
+ attributes,
140
+ relationships: {
141
+ workflow: { data: { type: "ciWorkflows", id: opts.workflowId } },
142
+ },
143
+ },
144
+ },
145
+ })
146
+ const num = result.data.data.attributes.number
147
+ printSuccess(`Build run started: ${result.data.data.id}${num ? ` (#${num})` : ""}`)
148
+ }
149
+
150
+ // ---- Artifacts ----
151
+
152
+ export async function xcodeCloudArtifactsList(opts: {
153
+ buildRunId: string
154
+ output?: string
155
+ }): Promise<void> {
156
+ const items = await ascFetchAll<{
157
+ id: string
158
+ attributes: {
159
+ fileName?: string
160
+ fileSize?: number
161
+ downloadUrl?: string
162
+ assetType?: string
163
+ }
164
+ }>(`/v1/ciBuildRuns/${opts.buildRunId}/artifacts`)
165
+ const fmt = detectFormat(opts.output)
166
+ if (fmt === "json") { printJSON(items); return }
167
+ printTable(
168
+ ["ID", "File Name", "Type", "Size"],
169
+ items.map(a => [
170
+ a.id,
171
+ a.attributes.fileName ?? "-",
172
+ a.attributes.assetType ?? "-",
173
+ a.attributes.fileSize ? `${Math.round(a.attributes.fileSize / 1024)}KB` : "-",
174
+ ]),
175
+ `Artifacts (${items.length})`,
176
+ )
177
+ }
178
+
179
+ // ---- Test Results ----
180
+
181
+ export async function xcodeCloudTestResultsList(opts: {
182
+ buildRunId: string
183
+ output?: string
184
+ }): Promise<void> {
185
+ const items = await ascFetchAll<{
186
+ id: string
187
+ attributes: {
188
+ className?: string
189
+ name?: string
190
+ status?: string
191
+ duration?: number
192
+ failureDetails?: Array<{ checksum?: string; failureType?: string; fileName?: string; lineNumber?: number; message?: string }>
193
+ }
194
+ }>(`/v1/ciBuildRuns/${opts.buildRunId}/testResults`)
195
+ const fmt = detectFormat(opts.output)
196
+ if (fmt === "json") { printJSON(items); return }
197
+ printTable(
198
+ ["ID", "Test", "Status", "Duration (s)"],
199
+ items.map(t => [
200
+ t.id,
201
+ truncate(`${t.attributes.className ?? ""}.${t.attributes.name ?? ""}`, 50),
202
+ t.attributes.status ?? "-",
203
+ t.attributes.duration != null ? t.attributes.duration.toFixed(2) : "-",
204
+ ]),
205
+ `Test Results (${items.length})`,
206
+ )
207
+ }