xcodebuild-axi 0.1.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 (131) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/LICENSE +21 -0
  3. package/README.md +304 -0
  4. package/dist/bin/xcodebuild-axi.d.ts +2 -0
  5. package/dist/bin/xcodebuild-axi.js +8 -0
  6. package/dist/bin/xcodebuild-axi.js.map +1 -0
  7. package/dist/src/action.d.ts +68 -0
  8. package/dist/src/action.js +373 -0
  9. package/dist/src/action.js.map +1 -0
  10. package/dist/src/archive.d.ts +33 -0
  11. package/dist/src/archive.js +77 -0
  12. package/dist/src/archive.js.map +1 -0
  13. package/dist/src/args.d.ts +23 -0
  14. package/dist/src/args.js +123 -0
  15. package/dist/src/args.js.map +1 -0
  16. package/dist/src/auth.d.ts +11 -0
  17. package/dist/src/auth.js +51 -0
  18. package/dist/src/auth.js.map +1 -0
  19. package/dist/src/cli.d.ts +20 -0
  20. package/dist/src/cli.js +132 -0
  21. package/dist/src/cli.js.map +1 -0
  22. package/dist/src/commands/analyze.d.ts +2 -0
  23. package/dist/src/commands/analyze.js +32 -0
  24. package/dist/src/commands/analyze.js.map +1 -0
  25. package/dist/src/commands/archive.d.ts +2 -0
  26. package/dist/src/commands/archive.js +63 -0
  27. package/dist/src/commands/archive.js.map +1 -0
  28. package/dist/src/commands/build.d.ts +2 -0
  29. package/dist/src/commands/build.js +60 -0
  30. package/dist/src/commands/build.js.map +1 -0
  31. package/dist/src/commands/clean.d.ts +2 -0
  32. package/dist/src/commands/clean.js +39 -0
  33. package/dist/src/commands/clean.js.map +1 -0
  34. package/dist/src/commands/coverage.d.ts +2 -0
  35. package/dist/src/commands/coverage.js +111 -0
  36. package/dist/src/commands/coverage.js.map +1 -0
  37. package/dist/src/commands/destinations.d.ts +2 -0
  38. package/dist/src/commands/destinations.js +56 -0
  39. package/dist/src/commands/destinations.js.map +1 -0
  40. package/dist/src/commands/export.d.ts +2 -0
  41. package/dist/src/commands/export.js +170 -0
  42. package/dist/src/commands/export.js.map +1 -0
  43. package/dist/src/commands/find.d.ts +2 -0
  44. package/dist/src/commands/find.js +70 -0
  45. package/dist/src/commands/find.js.map +1 -0
  46. package/dist/src/commands/home.d.ts +9 -0
  47. package/dist/src/commands/home.js +97 -0
  48. package/dist/src/commands/home.js.map +1 -0
  49. package/dist/src/commands/info.d.ts +2 -0
  50. package/dist/src/commands/info.js +95 -0
  51. package/dist/src/commands/info.js.map +1 -0
  52. package/dist/src/commands/localize.d.ts +2 -0
  53. package/dist/src/commands/localize.js +121 -0
  54. package/dist/src/commands/localize.js.map +1 -0
  55. package/dist/src/commands/migrate.d.ts +8 -0
  56. package/dist/src/commands/migrate.js +177 -0
  57. package/dist/src/commands/migrate.js.map +1 -0
  58. package/dist/src/commands/packages.d.ts +2 -0
  59. package/dist/src/commands/packages.js +108 -0
  60. package/dist/src/commands/packages.js.map +1 -0
  61. package/dist/src/commands/platforms.d.ts +2 -0
  62. package/dist/src/commands/platforms.js +379 -0
  63. package/dist/src/commands/platforms.js.map +1 -0
  64. package/dist/src/commands/result.d.ts +2 -0
  65. package/dist/src/commands/result.js +100 -0
  66. package/dist/src/commands/result.js.map +1 -0
  67. package/dist/src/commands/schemes.d.ts +2 -0
  68. package/dist/src/commands/schemes.js +39 -0
  69. package/dist/src/commands/schemes.js.map +1 -0
  70. package/dist/src/commands/settings.d.ts +2 -0
  71. package/dist/src/commands/settings.js +191 -0
  72. package/dist/src/commands/settings.js.map +1 -0
  73. package/dist/src/commands/setup.d.ts +2 -0
  74. package/dist/src/commands/setup.js +84 -0
  75. package/dist/src/commands/setup.js.map +1 -0
  76. package/dist/src/commands/sim.d.ts +2 -0
  77. package/dist/src/commands/sim.js +187 -0
  78. package/dist/src/commands/sim.js.map +1 -0
  79. package/dist/src/commands/test.d.ts +2 -0
  80. package/dist/src/commands/test.js +317 -0
  81. package/dist/src/commands/test.js.map +1 -0
  82. package/dist/src/commands/testplans.d.ts +8 -0
  83. package/dist/src/commands/testplans.js +75 -0
  84. package/dist/src/commands/testplans.js.map +1 -0
  85. package/dist/src/commands/tests.d.ts +13 -0
  86. package/dist/src/commands/tests.js +154 -0
  87. package/dist/src/commands/tests.js.map +1 -0
  88. package/dist/src/commands/xcframework.d.ts +2 -0
  89. package/dist/src/commands/xcframework.js +77 -0
  90. package/dist/src/commands/xcframework.js.map +1 -0
  91. package/dist/src/context.d.ts +23 -0
  92. package/dist/src/context.js +72 -0
  93. package/dist/src/context.js.map +1 -0
  94. package/dist/src/destination.d.ts +50 -0
  95. package/dist/src/destination.js +174 -0
  96. package/dist/src/destination.js.map +1 -0
  97. package/dist/src/errors.d.ts +6 -0
  98. package/dist/src/errors.js +55 -0
  99. package/dist/src/errors.js.map +1 -0
  100. package/dist/src/packages.d.ts +31 -0
  101. package/dist/src/packages.js +117 -0
  102. package/dist/src/packages.js.map +1 -0
  103. package/dist/src/report.d.ts +20 -0
  104. package/dist/src/report.js +39 -0
  105. package/dist/src/report.js.map +1 -0
  106. package/dist/src/scheme.d.ts +22 -0
  107. package/dist/src/scheme.js +66 -0
  108. package/dist/src/scheme.js.map +1 -0
  109. package/dist/src/simctl.d.ts +33 -0
  110. package/dist/src/simctl.js +85 -0
  111. package/dist/src/simctl.js.map +1 -0
  112. package/dist/src/surface.d.ts +55 -0
  113. package/dist/src/surface.js +350 -0
  114. package/dist/src/surface.js.map +1 -0
  115. package/dist/src/toon.d.ts +34 -0
  116. package/dist/src/toon.js +79 -0
  117. package/dist/src/toon.js.map +1 -0
  118. package/dist/src/version.d.ts +1 -0
  119. package/dist/src/version.js +24 -0
  120. package/dist/src/version.js.map +1 -0
  121. package/dist/src/xccov.d.ts +25 -0
  122. package/dist/src/xccov.js +78 -0
  123. package/dist/src/xccov.js.map +1 -0
  124. package/dist/src/xcodebuild.d.ts +65 -0
  125. package/dist/src/xcodebuild.js +163 -0
  126. package/dist/src/xcodebuild.js.map +1 -0
  127. package/dist/src/xcresult.d.ts +96 -0
  128. package/dist/src/xcresult.js +156 -0
  129. package/dist/src/xcresult.js.map +1 -0
  130. package/package.json +75 -0
  131. package/skills/xcodebuild-axi/SKILL.md +64 -0
@@ -0,0 +1,350 @@
1
+ /**
2
+ * How much of `xcodebuild` this tool actually covers.
3
+ *
4
+ * Wrapping a CLI silently narrows it, and the narrowing is invisible until an
5
+ * agent needs the one flag that got left out. So the mapping is declared here
6
+ * rather than inferred: every option `xcodebuild -help` prints is classified,
7
+ * and `npm run coverage -- --check` fails if a new Xcode adds one this file
8
+ * has never heard of.
9
+ */
10
+ /**
11
+ * The Xcode whose `xcodebuild -help` this map was written against.
12
+ *
13
+ * The option list is not stable across Xcode releases — 26 listed `-dry-run`
14
+ * and `-downloadAllPreviouslySelectedPlatforms`, 27 dropped both and added the
15
+ * `platforms` and codesize families. So a machine running a different Xcode
16
+ * will legitimately disagree with this file, and only a machine running this
17
+ * one can say the map is actually stale. `scripts/coverage.ts` fails on a
18
+ * mismatch here and merely reports one elsewhere.
19
+ */
20
+ export const AUTHORED_AGAINST = "27.0";
21
+ export const OPTION_COVERAGE = {
22
+ "-allowProvisioningDeviceRegistration": {
23
+ status: "exposed",
24
+ via: "archive --allow-device-registration",
25
+ },
26
+ "-allowProvisioningUpdates": {
27
+ status: "exposed",
28
+ via: "build --allow-provisioning",
29
+ },
30
+ "-alltargets": { status: "exposed", via: "build --all-targets" },
31
+ "-arch": { status: "exposed", via: "build --arch" },
32
+ "-architecture": {
33
+ status: "exposed",
34
+ via: "platforms device-support --architecture",
35
+ },
36
+ "-archivePath": { status: "exposed", via: "archive --archive-path" },
37
+ "-authenticationKeyID": { status: "exposed", via: "archive --auth-key-id" },
38
+ "-authenticationKeyIssuerID": {
39
+ status: "exposed",
40
+ via: "archive --auth-key-issuer",
41
+ },
42
+ "-authenticationKeyPath": {
43
+ status: "exposed",
44
+ via: "archive --auth-key-path",
45
+ },
46
+ "-checkFirstLaunchStatus": {
47
+ status: "exposed",
48
+ via: "platforms first-launch --status",
49
+ },
50
+ "-clonedSourcePackagesDirPath": {
51
+ status: "exposed",
52
+ via: "packages --cache",
53
+ },
54
+ "-codesizeProfileOutputDir": { status: "exposed", via: "build --codesize" },
55
+ "-collect-test-diagnostics": { status: "exposed", via: "test --diagnostics" },
56
+ "-configuration": { status: "exposed", via: "build --configuration" },
57
+ "-create-xcframework": { status: "exposed", via: "xcframework" },
58
+ "-default-test-execution-time-allowance": {
59
+ status: "exposed",
60
+ via: "test --default-test-timeout",
61
+ },
62
+ "-defaultLanguage": {
63
+ status: "exposed",
64
+ via: "localize export --default-language",
65
+ },
66
+ "-defaultPackageRegistryURL": {
67
+ status: "exposed",
68
+ via: "packages --registry-url",
69
+ },
70
+ "-deleteComponent": { status: "exposed", via: "platforms component delete" },
71
+ "-derivedDataPath": { status: "exposed", via: "build --derived-data" },
72
+ "-destination": { status: "exposed", via: "build --destination" },
73
+ "-destination-timeout": {
74
+ status: "exposed",
75
+ via: "build --destination-timeout",
76
+ },
77
+ "-disableAutomaticPackageResolution": {
78
+ status: "exposed",
79
+ via: "build --no-auto-resolve",
80
+ },
81
+ "-disablePackageRepositoryCache": {
82
+ status: "exposed",
83
+ via: "build --no-package-cache",
84
+ },
85
+ "-downloadAllPlatforms": {
86
+ status: "exposed",
87
+ via: "platforms download --all",
88
+ },
89
+ "-downloadComponent": {
90
+ status: "exposed",
91
+ via: "platforms component download",
92
+ },
93
+ "-downloadPlatform": { status: "exposed", via: "platforms download" },
94
+ "-enableAddressSanitizer": {
95
+ status: "exposed",
96
+ via: "build --sanitizer address",
97
+ },
98
+ "-enableCodeCoverage": { status: "exposed", via: "test --coverage" },
99
+ "-enableCodesizeProfile": { status: "exposed", via: "build --codesize" },
100
+ "-enablePerformanceTestsDiagnostics": {
101
+ status: "exposed",
102
+ via: "test --perf-diagnostics",
103
+ },
104
+ "-enableThreadSanitizer": {
105
+ status: "exposed",
106
+ via: "build --sanitizer thread",
107
+ },
108
+ "-enableUndefinedBehaviorSanitizer": {
109
+ status: "exposed",
110
+ via: "build --sanitizer undefined",
111
+ },
112
+ "-enumerate-tests": { status: "exposed", via: "tests" },
113
+ "-exportArchive": { status: "exposed", via: "export" },
114
+ "-exportLanguage": { status: "exposed", via: "localize export --language" },
115
+ "-exportLocalizations": { status: "exposed", via: "localize export" },
116
+ "-exportNotarizedApp": { status: "exposed", via: "export --notarized" },
117
+ "-exportOptionsPlist": { status: "exposed", via: "export --options" },
118
+ "-exportPath": { status: "exposed", via: "export --output" },
119
+ "-find-executable": { status: "exposed", via: "find" },
120
+ "-find-library": { status: "exposed", via: "find --library" },
121
+ "-hideShellScriptEnvironment": {
122
+ status: "exposed",
123
+ via: "build --hide-script-env",
124
+ },
125
+ "-importComponent": { status: "exposed", via: "platforms component import" },
126
+ "-importLocalizations": { status: "exposed", via: "localize import" },
127
+ "-importPath": {
128
+ status: "exposed",
129
+ via: "platforms component import --import-path",
130
+ },
131
+ "-importPlatform": { status: "exposed", via: "platforms import" },
132
+ "-jobs": { status: "exposed", via: "build --jobs" },
133
+ "-list": { status: "exposed", via: "schemes" },
134
+ "-localizationPath": { status: "exposed", via: "localize --path" },
135
+ "-maximum-concurrent-test-device-destinations": {
136
+ status: "exposed",
137
+ via: "test --max-device-destinations",
138
+ },
139
+ "-maximum-concurrent-test-simulator-destinations": {
140
+ status: "exposed",
141
+ via: "test --max-sim-destinations",
142
+ },
143
+ "-maximum-parallel-testing-workers": {
144
+ status: "exposed",
145
+ via: "test --max-workers",
146
+ },
147
+ "-maximum-test-execution-time-allowance": {
148
+ status: "exposed",
149
+ via: "test --test-timeout",
150
+ },
151
+ "-modelCode": {
152
+ status: "exposed",
153
+ via: "platforms device-support --model-code",
154
+ },
155
+ "-only-test-configuration": {
156
+ status: "exposed",
157
+ via: "test --only-configuration",
158
+ },
159
+ "-only-testing": { status: "exposed", via: "test --only" },
160
+ "-onlyUsePackageVersionsFromResolvedFile": {
161
+ status: "exposed",
162
+ via: "packages --offline",
163
+ },
164
+ "-osVersion": {
165
+ status: "exposed",
166
+ via: "platforms device-support --os-version",
167
+ },
168
+ "-packageAuthorizationProvider": {
169
+ status: "exposed",
170
+ via: "packages --package-auth",
171
+ },
172
+ "-packageCachePath": { status: "exposed", via: "packages --package-cache" },
173
+ "-packageDependencySCMToRegistryTransformation": {
174
+ status: "exposed",
175
+ via: "packages --scm-to-registry",
176
+ },
177
+ "-packageFingerprintPolicy": {
178
+ status: "exposed",
179
+ via: "packages --fingerprint-policy",
180
+ },
181
+ "-packageSigningEntityPolicy": {
182
+ status: "exposed",
183
+ via: "packages --signing-entity-policy",
184
+ },
185
+ "-parallel-testing-enabled": {
186
+ status: "exposed",
187
+ via: "test --parallel / --no-parallel",
188
+ },
189
+ "-parallel-testing-worker-count": {
190
+ status: "exposed",
191
+ via: "test --max-workers",
192
+ },
193
+ "-parallelizeTargets": {
194
+ status: "exposed",
195
+ via: "build --parallelize-targets",
196
+ },
197
+ "-platform": {
198
+ status: "exposed",
199
+ via: "platforms device-support --platform",
200
+ },
201
+ "-prepareDeviceSupport": {
202
+ status: "exposed",
203
+ via: "platforms device-support",
204
+ },
205
+ "-resolvePackageDependencies": {
206
+ status: "exposed",
207
+ via: "packages --resolve",
208
+ },
209
+ "-retry-tests-on-failure": { status: "exposed", via: "test --retry" },
210
+ "-run-tests-until-failure": {
211
+ status: "exposed",
212
+ via: "test --until-failure",
213
+ },
214
+ "-runFirstLaunch": { status: "exposed", via: "platforms first-launch" },
215
+ "-scheme": { status: "exposed", via: "build --scheme" },
216
+ "-scmProvider": { status: "exposed", via: "packages --scm-provider" },
217
+ "-sdk": { status: "exposed", via: "build --sdk" },
218
+ "-showBuildSettings": { status: "exposed", via: "settings" },
219
+ "-showBuildSettingsForIndex": {
220
+ status: "exposed",
221
+ via: "settings --for-index",
222
+ },
223
+ "-showBuildTimingSummary": { status: "exposed", via: "build --timing" },
224
+ "-showComponent": { status: "exposed", via: "platforms component show" },
225
+ "-showdestinations": { status: "exposed", via: "destinations" },
226
+ "-showsdks": { status: "exposed", via: "info --sdks" },
227
+ "-showTestPlans": { status: "exposed", via: "testplans" },
228
+ "-skip-test-configuration": {
229
+ status: "exposed",
230
+ via: "test --skip-configuration",
231
+ },
232
+ "-skip-testing": { status: "exposed", via: "test --skip" },
233
+ "-skipPackagePluginValidation": {
234
+ status: "exposed",
235
+ via: "build --skip-plugin-validation",
236
+ },
237
+ "-skipPackageSignatureValidation": {
238
+ status: "exposed",
239
+ via: "build --skip-signature-validation",
240
+ },
241
+ "-skipPackageUpdates": {
242
+ status: "exposed",
243
+ via: "build --skip-package-updates",
244
+ },
245
+ "-skipUnavailableActions": {
246
+ status: "exposed",
247
+ via: "build --skip-unavailable-actions",
248
+ },
249
+ "-target": { status: "exposed", via: "build --target" },
250
+ "-test-iterations": { status: "exposed", via: "test --iterations" },
251
+ "-test-repetition-relaunch-enabled": {
252
+ status: "exposed",
253
+ via: "test --relaunch",
254
+ },
255
+ "-test-timeouts-enabled": { status: "exposed", via: "test --test-timeout" },
256
+ "-testLanguage": { status: "exposed", via: "test --language" },
257
+ "-testPlan": { status: "exposed", via: "test --test-plan" },
258
+ "-testProductsPath": { status: "exposed", via: "test --test-products" },
259
+ "-testRegion": { status: "exposed", via: "test --region" },
260
+ "-toolchain": { status: "exposed", via: "build --toolchain" },
261
+ "-version": { status: "exposed", via: "info" },
262
+ "-xcconfig": { status: "exposed", via: "build --xcconfig" },
263
+ "-xctestrun": { status: "exposed", via: "test --xctestrun" },
264
+ "-json": {
265
+ status: "always",
266
+ why: "every read-only query asks for JSON, then reports TOON",
267
+ },
268
+ "-project": {
269
+ status: "always",
270
+ why: "set from the .xcodeproj found in the working directory",
271
+ },
272
+ "-resultBundlePath": {
273
+ status: "always",
274
+ why: "every action writes a bundle to the tool's cache — that bundle is what the report is read from",
275
+ },
276
+ "-skipMacroValidation": {
277
+ status: "always",
278
+ why: "macro trust is an interactive prompt in disguise, and an agent cannot answer it",
279
+ },
280
+ "-test-enumeration-format": {
281
+ status: "always",
282
+ why: "always json, so `tests` can parse it",
283
+ },
284
+ "-test-enumeration-output-path": {
285
+ status: "always",
286
+ why: "written to the tool's cache and read back, never printed",
287
+ },
288
+ "-test-enumeration-style": {
289
+ status: "always",
290
+ why: "always flat; `tests` does its own grouping by target and suite",
291
+ },
292
+ "-workspace": {
293
+ status: "always",
294
+ why: "set from the .xcworkspace found in the working directory",
295
+ },
296
+ "-convert-project": { status: "exposed", via: "migrate --format" },
297
+ "-help": {
298
+ status: "superseded",
299
+ why: "`xcodebuild-axi --help`, which answers it in a fraction of the tokens",
300
+ },
301
+ "-license": { status: "exposed", via: "platforms license" },
302
+ "-quiet": { status: "exposed", via: "build --log-level quiet" },
303
+ "-resultBundleVersion": { status: "exposed", via: "build --bundle-version" },
304
+ "-resultStreamPath": { status: "exposed", via: "build --stream" },
305
+ "-usage": {
306
+ status: "superseded",
307
+ why: "`xcodebuild-axi <command> --help`, per command rather than all 117 at once",
308
+ },
309
+ "-verbose": { status: "exposed", via: "build --log-level verbose" },
310
+ };
311
+ /** The build actions, classified the same way. */
312
+ export const ACTION_COVERAGE = {
313
+ build: { status: "exposed", via: "build" },
314
+ "build-for-testing": { status: "exposed", via: "build --for-testing" },
315
+ analyze: { status: "exposed", via: "analyze" },
316
+ archive: { status: "exposed", via: "archive" },
317
+ test: { status: "exposed", via: "test" },
318
+ "test-without-building": {
319
+ status: "exposed",
320
+ via: "test --without-building",
321
+ },
322
+ docbuild: { status: "exposed", via: "build --docs" },
323
+ clean: { status: "exposed", via: "clean" },
324
+ install: { status: "exposed", via: "build --install" },
325
+ installsrc: {
326
+ status: "n/a",
327
+ why: "copies sources into SRCROOT as root; a packaging step, not an agent loop",
328
+ },
329
+ };
330
+ export function tally(map) {
331
+ const values = Object.values(map);
332
+ const count = (status) => values.filter((entry) => entry.status === status).length;
333
+ const exposed = count("exposed");
334
+ const always = count("always");
335
+ const superseded = count("superseded");
336
+ const na = count("n/a");
337
+ const covered = exposed + always + superseded;
338
+ return {
339
+ total: values.length,
340
+ exposed,
341
+ always,
342
+ superseded,
343
+ na,
344
+ covered,
345
+ // `n/a` options stay in the denominator on purpose. Declining to wrap
346
+ // something is a choice this number should have to pay for.
347
+ percent: Math.round((covered / values.length) * 1000) / 10,
348
+ };
349
+ }
350
+ //# sourceMappingURL=surface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"surface.js","sourceRoot":"","sources":["../../src/surface.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC;AAYvC,MAAM,CAAC,MAAM,eAAe,GAAmC;IAC7D,sCAAsC,EAAE;QACtC,MAAM,EAAE,SAAS;QACjB,GAAG,EAAE,qCAAqC;KAC3C;IACD,2BAA2B,EAAE;QAC3B,MAAM,EAAE,SAAS;QACjB,GAAG,EAAE,4BAA4B;KAClC;IACD,aAAa,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,EAAE,qBAAqB,EAAE;IAChE,OAAO,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,EAAE,cAAc,EAAE;IACnD,eAAe,EAAE;QACf,MAAM,EAAE,SAAS;QACjB,GAAG,EAAE,yCAAyC;KAC/C;IACD,cAAc,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,EAAE,wBAAwB,EAAE;IACpE,sBAAsB,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,EAAE,uBAAuB,EAAE;IAC3E,4BAA4B,EAAE;QAC5B,MAAM,EAAE,SAAS;QACjB,GAAG,EAAE,2BAA2B;KACjC;IACD,wBAAwB,EAAE;QACxB,MAAM,EAAE,SAAS;QACjB,GAAG,EAAE,yBAAyB;KAC/B;IACD,yBAAyB,EAAE;QACzB,MAAM,EAAE,SAAS;QACjB,GAAG,EAAE,iCAAiC;KACvC;IACD,8BAA8B,EAAE;QAC9B,MAAM,EAAE,SAAS;QACjB,GAAG,EAAE,kBAAkB;KACxB;IACD,2BAA2B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E,cAAc,EAAE;IACpD,KAAK,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,EAAE,OAAO,EAAE;IAC1C,OAAO,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,EAAE,iBAAiB,EAAE;IACtD,UAAU,EAAE;QACV,MAAM,EAAE,KAAK;QACb,GAAG,EAAE,0EAA0E;KAChF;CACF,CAAC;AAaF,MAAM,UAAU,KAAK,CAAC,GAAmC;IACvD,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IAClC,MAAM,KAAK,GAAG,CAAC,MAAgC,EAAE,EAAE,CACjD,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,KAAK,MAAM,CAAC,CAAC,MAAM,CAAC;IAE3D,MAAM,OAAO,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC;IACjC,MAAM,MAAM,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC;IAC/B,MAAM,UAAU,GAAG,KAAK,CAAC,YAAY,CAAC,CAAC;IACvC,MAAM,EAAE,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC;IACxB,MAAM,OAAO,GAAG,OAAO,GAAG,MAAM,GAAG,UAAU,CAAC;IAE9C,OAAO;QACL,KAAK,EAAE,MAAM,CAAC,MAAM;QACpB,OAAO;QACP,MAAM;QACN,UAAU;QACV,EAAE;QACF,OAAO;QACP,sEAAsE;QACtE,4DAA4D;QAC5D,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,GAAG,EAAE;KAC3D,CAAC;AACJ,CAAC"}
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Output rendering. TOON at the boundary, plain objects everywhere inside
3
+ * (AXI principle 1).
4
+ */
5
+ /** Render a labeled list of uniform rows as a TOON table. */
6
+ export declare function renderList(label: string, rows: Record<string, unknown>[]): string;
7
+ /** Render a labeled object as TOON. */
8
+ export declare function renderDetail(label: string, value: Record<string, unknown>): string;
9
+ /** Render bare top-level key/value lines. */
10
+ export declare function renderFields(fields: Record<string, unknown>): string;
11
+ /**
12
+ * Render next-step suggestions (AXI principle 9).
13
+ *
14
+ * Hand-formatted rather than passed to `encode()`, which inlines arrays of
15
+ * primitives onto one line — unreadable once the entries are full commands.
16
+ */
17
+ export declare function renderHelp(lines: string[]): string;
18
+ /** Join rendered blocks, dropping the empty ones. */
19
+ export declare function renderOutput(blocks: string[]): string;
20
+ /**
21
+ * Truncate long free text, telling the agent what it is missing and how to get
22
+ * it (AXI principle 3). Returns the text unchanged when it already fits.
23
+ */
24
+ export declare function truncate(text: string, limit?: number): {
25
+ text: string;
26
+ truncated: boolean;
27
+ total: number;
28
+ };
29
+ /** Collapse `$HOME` to `~` so paths stay short and stable across machines. */
30
+ export declare function tildePath(absolute: string): string;
31
+ /** Seconds, rendered the way a human skims them. */
32
+ export declare function duration(seconds: number): string;
33
+ /** Relative age of a timestamp, for "when did this last run". */
34
+ export declare function relativeTime(epochSeconds: number | undefined): string;
@@ -0,0 +1,79 @@
1
+ import { encode } from "@toon-format/toon";
2
+ /**
3
+ * Output rendering. TOON at the boundary, plain objects everywhere inside
4
+ * (AXI principle 1).
5
+ */
6
+ /** Render a labeled list of uniform rows as a TOON table. */
7
+ export function renderList(label, rows) {
8
+ return encode({ [label]: rows });
9
+ }
10
+ /** Render a labeled object as TOON. */
11
+ export function renderDetail(label, value) {
12
+ return encode({ [label]: value });
13
+ }
14
+ /** Render bare top-level key/value lines. */
15
+ export function renderFields(fields) {
16
+ return encode(fields);
17
+ }
18
+ /**
19
+ * Render next-step suggestions (AXI principle 9).
20
+ *
21
+ * Hand-formatted rather than passed to `encode()`, which inlines arrays of
22
+ * primitives onto one line — unreadable once the entries are full commands.
23
+ */
24
+ export function renderHelp(lines) {
25
+ const present = lines.filter((line) => line.length > 0);
26
+ if (present.length === 0)
27
+ return "";
28
+ return `help[${present.length}]:\n${present.map((l) => ` ${l}`).join("\n")}`;
29
+ }
30
+ /** Join rendered blocks, dropping the empty ones. */
31
+ export function renderOutput(blocks) {
32
+ return blocks.filter((block) => block.length > 0).join("\n");
33
+ }
34
+ /**
35
+ * Truncate long free text, telling the agent what it is missing and how to get
36
+ * it (AXI principle 3). Returns the text unchanged when it already fits.
37
+ */
38
+ export function truncate(text, limit = 800) {
39
+ const total = text.length;
40
+ if (total <= limit)
41
+ return { text, truncated: false, total };
42
+ return {
43
+ text: `${text.slice(0, limit)}\n... (truncated, ${total} chars total)`,
44
+ truncated: true,
45
+ total,
46
+ };
47
+ }
48
+ /** Collapse `$HOME` to `~` so paths stay short and stable across machines. */
49
+ export function tildePath(absolute) {
50
+ const home = process.env["HOME"];
51
+ if (home && absolute.startsWith(`${home}/`)) {
52
+ return `~${absolute.slice(home.length)}`;
53
+ }
54
+ return absolute;
55
+ }
56
+ /** Seconds, rendered the way a human skims them. */
57
+ export function duration(seconds) {
58
+ if (!Number.isFinite(seconds) || seconds < 0)
59
+ return "unknown";
60
+ if (seconds < 60)
61
+ return `${seconds.toFixed(1)}s`;
62
+ const minutes = Math.floor(seconds / 60);
63
+ const rest = Math.round(seconds % 60);
64
+ return `${minutes}m${rest.toString().padStart(2, "0")}s`;
65
+ }
66
+ /** Relative age of a timestamp, for "when did this last run". */
67
+ export function relativeTime(epochSeconds) {
68
+ if (epochSeconds === undefined || !Number.isFinite(epochSeconds))
69
+ return "unknown";
70
+ const diff = Math.floor(Date.now() / 1000 - epochSeconds);
71
+ if (diff < 60)
72
+ return "just now";
73
+ if (diff < 3600)
74
+ return `${Math.floor(diff / 60)}m ago`;
75
+ if (diff < 86400)
76
+ return `${Math.floor(diff / 3600)}h ago`;
77
+ return `${Math.floor(diff / 86400)}d ago`;
78
+ }
79
+ //# sourceMappingURL=toon.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toon.js","sourceRoot":"","sources":["../../src/toon.ts"],"names":[],"mappings":"AAAA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,YAAY,CAAC;QAC9D,OAAO,SAAS,CAAC;IACnB,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,GAAG,YAAY,CAAC,CAAC;IAC1D,IAAI,IAAI,GAAG,EAAE;QAAE,OAAO,UAAU,CAAC;IACjC,IAAI,IAAI,GAAG,IAAI;QAAE,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,EAAE,CAAC,OAAO,CAAC;IACxD,IAAI,IAAI,GAAG,KAAK;QAAE,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC;IAC3D,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC;AAC5C,CAAC"}
@@ -0,0 +1 @@
1
+ export declare const VERSION: string;
@@ -0,0 +1,24 @@
1
+ // Leaf module: imports node builtins only, never the command graph.
2
+ // `bin/xcodebuild-axi.ts` imports this on the `--version` fast path, so any new
3
+ // import here is paid on every invocation of that path. AXI principle 10.
4
+ import { existsSync, readFileSync } from "node:fs";
5
+ import { dirname, join } from "node:path";
6
+ import { fileURLToPath } from "node:url";
7
+ function readPackageVersion() {
8
+ const here = dirname(fileURLToPath(import.meta.url));
9
+ for (const candidate of [
10
+ join(here, "..", "package.json"),
11
+ join(here, "..", "..", "package.json"),
12
+ ]) {
13
+ if (!existsSync(candidate)) {
14
+ continue;
15
+ }
16
+ const parsed = JSON.parse(readFileSync(candidate, "utf-8"));
17
+ if (typeof parsed.version === "string" && parsed.version.length > 0) {
18
+ return parsed.version;
19
+ }
20
+ }
21
+ throw new Error("Could not determine xcodebuild-axi package version");
22
+ }
23
+ export const VERSION = readPackageVersion();
24
+ //# sourceMappingURL=version.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,oEAAoE;AACpE,gFAAgF;AAChF,0EAA0E;AAC1E,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,SAAS,kBAAkB;IACzB,MAAM,IAAI,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IAErD,KAAK,MAAM,SAAS,IAAI;QACtB,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,cAAc,CAAC;QAChC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,cAAc,CAAC;KACvC,EAAE,CAAC;QACF,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;YAC3B,SAAS;QACX,CAAC;QAED,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,SAAS,EAAE,OAAO,CAAC,CAEzD,CAAC;QACF,IAAI,OAAO,MAAM,CAAC,OAAO,KAAK,QAAQ,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACpE,OAAO,MAAM,CAAC,OAAO,CAAC;QACxB,CAAC;IACH,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAC;AACxE,CAAC;AAED,MAAM,CAAC,MAAM,OAAO,GAAG,kBAAkB,EAAE,CAAC"}
@@ -0,0 +1,25 @@
1
+ export interface CoverageTarget {
2
+ name: string;
3
+ lineCoverage: number;
4
+ coveredLines: number;
5
+ executableLines: number;
6
+ files?: CoverageFile[];
7
+ }
8
+ export interface CoverageFile {
9
+ name: string;
10
+ path: string;
11
+ lineCoverage: number;
12
+ coveredLines: number;
13
+ executableLines: number;
14
+ }
15
+ export interface CoverageReport {
16
+ lineCoverage: number;
17
+ coveredLines: number;
18
+ executableLines: number;
19
+ targets: CoverageTarget[];
20
+ }
21
+ export declare function readCoverage(resultPath: string, options?: {
22
+ files?: boolean;
23
+ }): Promise<CoverageReport>;
24
+ /** 0.8342 -> "83.4%". */
25
+ export declare function percent(fraction: number): string;
@@ -0,0 +1,78 @@
1
+ import { execFile } from "node:child_process";
2
+ import { AxiError } from "./errors.js";
3
+ /**
4
+ * Code coverage, read out of a result bundle with `xccov`.
5
+ *
6
+ * The per-file report for a real app runs to thousands of lines; the number
7
+ * an agent actually wants is one percentage per target, and the list of files
8
+ * that drag it down.
9
+ */
10
+ const MAX_BUFFER_BYTES = 64 * 1024 * 1024;
11
+ function xccov(args) {
12
+ return new Promise((resolvePromise, rejectPromise) => {
13
+ execFile("xcrun", ["xccov", ...args], { maxBuffer: MAX_BUFFER_BYTES, encoding: "utf-8" }, (error, stdout, stderr) => {
14
+ if (error && stdout.trim().length === 0) {
15
+ // xccov's own phrasing for the common case, translated into
16
+ // something that names the command that fixes it.
17
+ if (/No coverage data/i.test(stderr)) {
18
+ rejectPromise(new AxiError("That result bundle carries no coverage data", "RESULT_NOT_FOUND", ["Re-run the tests with `xcodebuild-axi test --coverage`"]));
19
+ return;
20
+ }
21
+ rejectPromise(new AxiError(firstLine(stderr) || "xccov failed", "RESULT_NOT_FOUND"));
22
+ return;
23
+ }
24
+ resolvePromise(stdout);
25
+ });
26
+ });
27
+ }
28
+ export async function readCoverage(resultPath, options = {}) {
29
+ const stdout = await xccov(["view", "--report", "--json", resultPath]);
30
+ let parsed;
31
+ try {
32
+ parsed = JSON.parse(stdout);
33
+ }
34
+ catch {
35
+ throw new AxiError("xccov returned output that could not be read", "RESULT_NOT_FOUND");
36
+ }
37
+ const targets = (parsed.targets ?? []).map((target) => ({
38
+ name: target.name ?? "unknown",
39
+ lineCoverage: target.lineCoverage ?? 0,
40
+ coveredLines: target.coveredLines ?? 0,
41
+ executableLines: target.executableLines ?? 0,
42
+ ...(options.files
43
+ ? {
44
+ files: (target.files ?? []).map((file) => ({
45
+ name: file.name ?? "unknown",
46
+ path: file.path ?? "",
47
+ lineCoverage: file.lineCoverage ?? 0,
48
+ coveredLines: file.coveredLines ?? 0,
49
+ executableLines: file.executableLines ?? 0,
50
+ })),
51
+ }
52
+ : {}),
53
+ }));
54
+ // The top-level totals are not always present, and a report that silently
55
+ // reports 0% because a field was missing is worse than one that adds up the
56
+ // targets itself.
57
+ const coveredLines = parsed.coveredLines ??
58
+ targets.reduce((sum, target) => sum + target.coveredLines, 0);
59
+ const executableLines = parsed.executableLines ??
60
+ targets.reduce((sum, target) => sum + target.executableLines, 0);
61
+ return {
62
+ lineCoverage: parsed.lineCoverage ??
63
+ (executableLines > 0 ? coveredLines / executableLines : 0),
64
+ coveredLines,
65
+ executableLines,
66
+ targets,
67
+ };
68
+ }
69
+ /** 0.8342 -> "83.4%". */
70
+ export function percent(fraction) {
71
+ if (!Number.isFinite(fraction))
72
+ return "unknown";
73
+ return `${(fraction * 100).toFixed(1)}%`;
74
+ }
75
+ function firstLine(text) {
76
+ return text.trim().split("\n")[0] ?? "";
77
+ }
78
+ //# sourceMappingURL=xccov.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"xccov.js","sourceRoot":"","sources":["../../src/xccov.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC;;;;;;GAMG;AAEH,MAAM,gBAAgB,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;AA4C1C,SAAS,KAAK,CAAC,IAAc;IAC3B,OAAO,IAAI,OAAO,CAAC,CAAC,cAAc,EAAE,aAAa,EAAE,EAAE;QACnD,QAAQ,CACN,OAAO,EACP,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,EAClB,EAAE,SAAS,EAAE,gBAAgB,EAAE,QAAQ,EAAE,OAAO,EAAE,EAClD,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE;YACxB,IAAI,KAAK,I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