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,121 @@
1
+ import { existsSync } from "node:fs";
2
+ import { join, resolve } from "node:path";
3
+ import { AxiError, mapXcodebuildError } from "../errors.js";
4
+ import { requireProject } from "../context.js";
5
+ import { artifactDir, runBuild, stripPreamble } from "../xcodebuild.js";
6
+ import { duration, renderFields, renderHelp, renderOutput, tildePath, } from "../toon.js";
7
+ import { getFlag, getListFlag, hasFlag, positionals, rejectUnknownFlags, } from "../args.js";
8
+ export const LOCALIZE_HELP = `usage: xcodebuild-axi localize export|import [flags]
9
+ Moves XLIFF localization catalogs in and out of a project.
10
+ flags[6]:
11
+ --path <path> the .xcloc directory to write, or the one to import (required for import)
12
+ --language <code> ISO 639-1 language to export; repeatable or comma-separated
13
+ --default-language <code> the language translations are made from
14
+ --screenshots include localization screenshots in the export
15
+ --merge merge the import into existing translations instead of replacing
16
+ --scheme <name> limit the export to one scheme's targets
17
+ note:
18
+ Export writes one .xcloc bundle per language. Without --path they land in the
19
+ tool's cache and the path is printed.
20
+ exit:
21
+ 0 succeeded, 1 xcodebuild refused, 2 usage error
22
+ examples:
23
+ xcodebuild-axi localize export --language fr,de
24
+ xcodebuild-axi localize export --path build/loc --default-language en
25
+ xcodebuild-axi localize import --path build/loc/fr.xcloc --merge
26
+ `;
27
+ const FLAGS = [
28
+ "--path",
29
+ "--language",
30
+ "--default-language",
31
+ "--screenshots",
32
+ "--merge",
33
+ "--scheme",
34
+ ];
35
+ const VALUE_FLAGS = [
36
+ "--path",
37
+ "--language",
38
+ "--default-language",
39
+ "--scheme",
40
+ ];
41
+ export async function localizeCommand(args) {
42
+ rejectUnknownFlags(args, "localize", FLAGS, VALUE_FLAGS);
43
+ const [mode] = positionals(args, VALUE_FLAGS);
44
+ if (mode !== "export" && mode !== "import") {
45
+ throw new AxiError(mode === undefined
46
+ ? "localize needs either export or import"
47
+ : `Unknown localize mode '${mode}'`, "VALIDATION_ERROR", [
48
+ "xcodebuild-axi localize export --language fr",
49
+ "xcodebuild-axi localize import --path build/loc/fr.xcloc",
50
+ ]);
51
+ }
52
+ const project = requireProject();
53
+ const scheme = getFlag(args, "--scheme");
54
+ const rawPath = getFlag(args, "--path");
55
+ if (mode === "import" && rawPath === undefined) {
56
+ throw new AxiError("localize import needs --path pointing at an .xcloc", "VALIDATION_ERROR", ["xcodebuild-axi localize import --path build/loc/fr.xcloc"]);
57
+ }
58
+ const localizationPath = rawPath
59
+ ? resolve(rawPath)
60
+ : join(artifactDir(project), "localizations");
61
+ if (mode === "import" && !existsSync(localizationPath)) {
62
+ throw new AxiError(`No localization catalog at ${rawPath}`, "NOT_FOUND", [
63
+ "Run `xcodebuild-axi localize export` to produce one",
64
+ ]);
65
+ }
66
+ const languages = getListFlag(args, "--language");
67
+ const defaultLanguage = getFlag(args, "--default-language");
68
+ const run = await runBuild({
69
+ args: [
70
+ ...project.flags,
71
+ ...(scheme ? ["-scheme", scheme] : []),
72
+ mode === "export" ? "-exportLocalizations" : "-importLocalizations",
73
+ "-localizationPath",
74
+ localizationPath,
75
+ ...(mode === "export"
76
+ ? [
77
+ ...(defaultLanguage ? ["-defaultLanguage", defaultLanguage] : []),
78
+ ...languages.flatMap((code) => ["-exportLanguage", code]),
79
+ ...(hasFlag(args, "--screenshots") ? ["-includeScreenshots"] : []),
80
+ ]
81
+ : hasFlag(args, "--merge")
82
+ ? ["-mergeImport"]
83
+ : []),
84
+ ],
85
+ label: `${project.name}-localize-${mode}`,
86
+ project,
87
+ });
88
+ if (run.exitCode !== 0) {
89
+ const mapped = mapXcodebuildError(run.tail);
90
+ process.exitCode = 1;
91
+ return renderOutput([
92
+ renderFields({
93
+ localize: `${mode} failed`,
94
+ error: mapped?.message ?? firstError(run.tail),
95
+ log: tildePath(run.logPath),
96
+ }),
97
+ renderHelp(mapped?.suggestions ?? []),
98
+ ]);
99
+ }
100
+ return renderOutput([
101
+ renderFields({
102
+ localize: `${mode} succeeded`,
103
+ path: tildePath(localizationPath),
104
+ ...(languages.length > 0 ? { languages } : {}),
105
+ duration: duration(run.seconds),
106
+ }),
107
+ renderHelp(mode === "export"
108
+ ? [
109
+ "Translate the .xcloc bundles, then `xcodebuild-axi localize import --path <bundle>`",
110
+ ]
111
+ : []),
112
+ ]);
113
+ }
114
+ function firstError(tail) {
115
+ return (stripPreamble(tail)
116
+ .split("\n")
117
+ .map((line) => line.trim())
118
+ .filter((line) => /error/i.test(line))
119
+ .pop() ?? "xcodebuild refused the localization request");
120
+ }
121
+ //# sourceMappingURL=localize.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"localize.js","sourceRoot":"","sources":["../../../src/commands/localize.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACxE,OAAO,EACL,QAAQ,EACR,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,SAAS,GACV,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,OAAO,EACP,WAAW,EACX,OAAO,EACP,WAAW,EACX,kBAAkB,GACnB,MAAM,YAAY,CAAC;AAEpB,MAAM,CAAC,MAAM,aAAa,GAAG;;;;;;;;;;;;;;;;;;CAkB5B,CAAC;AAEF,MAAM,KAAK,GAAG;IACZ,QAAQ;IACR,YAAY;IACZ,oBAAoB;IACpB,eAAe;IACf,SAAS;IACT,UAAU;CACF,CAAC;AAEX,MAAM,WAAW,GAAG;IAClB,QAAQ;IACR,YAAY;IACZ,oBAAoB;IACpB,UAAU;C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I,SAAS;gBAC1B,KAAK,EAAE,MAAM,EAAE,OAAO,IAAI,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC;gBAC9C,GAAG,EAAE,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC;aAC5B,CAAC;YACF,UAAU,CAAC,MAAM,EAAE,WAAW,IAAI,EAAE,CAAC;SACtC,CAAC,CAAC;IACL,CAAC;IAED,OAAO,YAAY,CAAC;QAClB,YAAY,CAAC;YACX,QAAQ,EAAE,GAAG,IAAI,YAAY;YAC7B,IAAI,EAAE,SAAS,CAAC,gBAAgB,CAAC;YACjC,GAAG,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAC9C,QAAQ,EAAE,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC;SAChC,CAAC;QACF,UAAU,CACR,IAAI,KAAK,QAAQ;YACf,CAAC,CAAC;gBACE,qFAAqF;aACtF;YACH,CAAC,CAAC,EAAE,CACP;KACF,CAAC,CAAC;AACL,CAAC;AAED,SAAS,UAAU,CAAC,IAAY;IAC9B,OAAO,CACL,aAAa,CAAC,IAAI,CAAC;SAChB,KAAK,CAAC,IAAI,CAAC;SACX,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;SAC1B,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;SACrC,GAAG,EAAE,IAAI,6CAA6C,CAC1D,CAAC;AACJ,CAAC"}
@@ -0,0 +1,8 @@
1
+ export declare const MIGRATE_HELP = "usage: xcodebuild-axi migrate [flags]\nReports the project file format, and converts it to a newer one.\nflags[3]:\n --format <name> the format to convert to, e.g. \"Xcode 27.0\"\n --project <path> which .xcodeproj, when the workspace holds more than one\n --yes actually convert; without it this only reports\nnote:\n This converts a .xcodeproj, not a workspace \u2014 a workspace has no format of\n its own. In a workspace directory the single contained project is picked\n automatically, and named for you when there is more than one.\n\n It also rewrites the .pbxproj in place, so it is the one command here that\n changes files you track. Run it with a clean working tree, and without --yes\n first to see the current format and what is available.\nexit:\n 0 reported or converted, 1 xcodebuild refused, 2 usage error\nexamples:\n xcodebuild-axi migrate\n xcodebuild-axi migrate --format \"Xcode 27.0\" --yes\n xcodebuild-axi migrate --project App/App.xcodeproj --format \"Xcode 27.0\" --yes\n";
2
+ export declare function migrateCommand(args: string[]): Promise<string>;
3
+ /** Exported for tests: the list only ever appears inside a rejection. */
4
+ export declare function parseFormats(output: string): string[];
5
+ /** Exported for tests. */
6
+ export declare function parseWorkspaceProjects(contents: string, baseDir: string): string[];
7
+ /** Exported for tests. */
8
+ export declare function errorLine(output: string): string;
@@ -0,0 +1,177 @@
1
+ import { readFileSync } from "node:fs";
2
+ import { dirname, join, resolve } from "node:path";
3
+ import { AxiError } from "../errors.js";
4
+ import { requireProject } from "../context.js";
5
+ import { runMetadata, stripPreamble } from "../xcodebuild.js";
6
+ import { renderFields, renderHelp, renderOutput, tildePath } from "../toon.js";
7
+ import { getFlag, hasFlag, rejectUnknownFlags } from "../args.js";
8
+ export const MIGRATE_HELP = `usage: xcodebuild-axi migrate [flags]
9
+ Reports the project file format, and converts it to a newer one.
10
+ flags[3]:
11
+ --format <name> the format to convert to, e.g. "Xcode 27.0"
12
+ --project <path> which .xcodeproj, when the workspace holds more than one
13
+ --yes actually convert; without it this only reports
14
+ note:
15
+ This converts a .xcodeproj, not a workspace — a workspace has no format of
16
+ its own. In a workspace directory the single contained project is picked
17
+ automatically, and named for you when there is more than one.
18
+
19
+ It also rewrites the .pbxproj in place, so it is the one command here that
20
+ changes files you track. Run it with a clean working tree, and without --yes
21
+ first to see the current format and what is available.
22
+ exit:
23
+ 0 reported or converted, 1 xcodebuild refused, 2 usage error
24
+ examples:
25
+ xcodebuild-axi migrate
26
+ xcodebuild-axi migrate --format "Xcode 27.0" --yes
27
+ xcodebuild-axi migrate --project App/App.xcodeproj --format "Xcode 27.0" --yes
28
+ `;
29
+ const FLAGS = ["--format", "--project", "--yes"];
30
+ const VALUE_FLAGS = ["--format", "--project"];
31
+ /** A name no Xcode will ever ship, used to make xcodebuild list the real ones. */
32
+ const IMPOSSIBLE_FORMAT = "__xcodebuild-axi-probe__";
33
+ export async function migrateCommand(args) {
34
+ rejectUnknownFlags(args, "migrate", FLAGS, VALUE_FLAGS);
35
+ const context = requireProject();
36
+ if (context.kind === "package") {
37
+ throw new AxiError("A Swift package has no project file format to convert", "VALIDATION_ERROR", ["`migrate` applies to an .xcodeproj, which Package.swift does not have"]);
38
+ }
39
+ // `-convert-project` acts on a project file. Passing `-workspace` makes
40
+ // xcodebuild demand a scheme and then fail at something unrelated, so the
41
+ // workspace is resolved down to the .xcodeproj it contains.
42
+ const projectPath = resolveProjectFile(context, getFlag(args, "--project"));
43
+ const projectName = projectPath.split("/").pop() ?? projectPath;
44
+ const format = getFlag(args, "--format");
45
+ const current = readObjectVersion(projectPath);
46
+ if (format === undefined) {
47
+ const available = await availableFormats();
48
+ return renderOutput([
49
+ renderFields({
50
+ project: tildePath(projectPath),
51
+ ...(current ? { object_version: current } : {}),
52
+ formats: available,
53
+ }),
54
+ renderHelp([
55
+ `Run \`xcodebuild-axi migrate --format "${available.at(-1) ?? "Xcode 27.0"}" --yes\` to convert`,
56
+ ]),
57
+ ]);
58
+ }
59
+ if (!hasFlag(args, "--yes")) {
60
+ // Rewriting a tracked file on the strength of one flag is the kind of
61
+ // surprise an agent cannot undo for the user, so it takes two.
62
+ throw new AxiError(`migrate would rewrite ${projectName} in place — pass --yes to confirm`, "VALIDATION_ERROR", [
63
+ `xcodebuild-axi migrate --format "${format}" --yes`,
64
+ "Commit or stash first; this edits the .pbxproj your repo tracks",
65
+ ]);
66
+ }
67
+ const { stdout, stderr, exitCode } = await runMetadata([
68
+ "-project",
69
+ projectPath,
70
+ "-convert-project",
71
+ format,
72
+ ]);
73
+ if (exitCode !== 0) {
74
+ const message = errorLine(`${stderr}\n${stdout}`);
75
+ const available = await availableFormats();
76
+ throw new AxiError(message || `Could not convert to '${format}'`, "UNKNOWN", available.length > 0 ? [`formats: ${available.join(", ")}`] : []);
77
+ }
78
+ return renderOutput([
79
+ renderFields({
80
+ migrate: "converted",
81
+ project: tildePath(projectPath),
82
+ format,
83
+ ...(current ? { was_object_version: current } : {}),
84
+ object_version: readObjectVersion(projectPath) ?? "unknown",
85
+ }),
86
+ renderHelp([
87
+ "Review the .pbxproj diff before committing — this changed a tracked file",
88
+ ]),
89
+ ]);
90
+ }
91
+ /**
92
+ * The format list is only ever printed inside a rejection, so asking for a
93
+ * name that cannot exist is the cheapest way to read it. xcodebuild validates
94
+ * the format before it touches the project, so nothing is converted.
95
+ */
96
+ async function availableFormats() {
97
+ const { stdout, stderr } = await runMetadata([
98
+ "-convert-project",
99
+ IMPOSSIBLE_FORMAT,
100
+ ]);
101
+ return parseFormats(`${stderr}\n${stdout}`);
102
+ }
103
+ /** Exported for tests: the list only ever appears inside a rejection. */
104
+ export function parseFormats(output) {
105
+ const match = /Pass a project format by name or version number:\s*(.+?)\.\s*$/m.exec(output);
106
+ if (!match?.[1])
107
+ return [];
108
+ // xcodebuild lists "Xcode 3.0" twice; a duplicate in a help list is noise.
109
+ return [...new Set(match[1].split(",").map((entry) => entry.trim()))].filter((entry) => entry.length > 0);
110
+ }
111
+ /**
112
+ * Pick the .xcodeproj to convert.
113
+ *
114
+ * A workspace is a list of projects, so it has no format of its own. One
115
+ * contained project is unambiguous; more than one is a question only the
116
+ * caller can answer, and the answer is cheaper to give with the names in hand.
117
+ */
118
+ function resolveProjectFile(context, explicit) {
119
+ if (explicit !== undefined)
120
+ return resolve(explicit);
121
+ if (context.kind === "project")
122
+ return context.path;
123
+ const contained = projectsInWorkspace(context.path);
124
+ if (contained.length === 1)
125
+ return contained[0];
126
+ if (contained.length === 0) {
127
+ throw new AxiError(`${context.name} references no .xcodeproj to convert`, "VALIDATION_ERROR", ["Pass `--project <path.xcodeproj>` to name one directly"]);
128
+ }
129
+ throw new AxiError(`${context.name} holds ${contained.length} projects — pass --project to pick one`, "VALIDATION_ERROR", contained.map((path) => `xcodebuild-axi migrate --project ${tildePath(path)}`));
130
+ }
131
+ /** The workspace file is XML listing `location = "group:Some.xcodeproj"`. */
132
+ function projectsInWorkspace(workspacePath) {
133
+ let contents;
134
+ try {
135
+ contents = readFileSync(join(workspacePath, "contents.xcworkspacedata"), "utf-8");
136
+ }
137
+ catch {
138
+ return [];
139
+ }
140
+ return parseWorkspaceProjects(contents, dirname(workspacePath));
141
+ }
142
+ /** Exported for tests. */
143
+ export function parseWorkspaceProjects(contents, baseDir) {
144
+ const found = [];
145
+ for (const match of contents.matchAll(/location\s*=\s*"([^"]+)"/g)) {
146
+ const location = match[1];
147
+ if (location === undefined || !location.endsWith(".xcodeproj"))
148
+ continue;
149
+ const relative = location.replace(/^(group|container|self):/, "");
150
+ // Locations are relative to the workspace's own directory.
151
+ found.push(resolve(baseDir, relative));
152
+ }
153
+ return [...new Set(found)];
154
+ }
155
+ /** `objectVersion` in the pbxproj is the format, without running anything. */
156
+ function readObjectVersion(projectPath) {
157
+ try {
158
+ const match = /objectVersion\s*=\s*(\d+)/.exec(readFileSync(join(projectPath, "project.pbxproj"), "utf-8").slice(0, 2000));
159
+ return match?.[1];
160
+ }
161
+ catch {
162
+ return undefined;
163
+ }
164
+ }
165
+ /** Exported for tests. */
166
+ export function errorLine(output) {
167
+ return (stripPreamble(output)
168
+ .split("\n")
169
+ .map((line) => line.trim())
170
+ .filter((line) => line.startsWith("xcodebuild: error:"))
171
+ .map((line) => line.replace(/^xcodebuild: error:\s*/, ""))
172
+ // xcodebuild appends the whole format list to its rejection, and the
173
+ // suggestions already carry a deduplicated copy.
174
+ .map((line) => line.split("Pass a project format")[0]?.trim() ?? line)
175
+ .pop() ?? "");
176
+ }
177
+ //# sourceMappingURL=migrate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migrate.js","sourceRo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SACvD,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,wBAAwB,EAAE,EAAE,CAAC,CAAC;QAC1D,qEAAqE;QACrE,iDAAiD;SAChD,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,IAAI,CAAC;SACrE,GAAG,EAAE,IAAI,EAAE,CACf,CAAC;AACJ,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const PACKAGES_HELP = "usage: xcodebuild-axi packages [flags]\nReports the Swift package versions this project is pinned to, read straight\nfrom Package.resolved \u2014 no build, no subprocess.\nflags[17]:\n --resolve actually resolve dependencies first (network, slow)\n --filter <text> only packages whose identity contains this\n --scheme <name> with --resolve against a workspace: the scheme to resolve for\n --offline resolve using only the versions already in Package.resolved\n --cache <path> clone remote packages into this directory\n --package-cache <path> shared package cache directory (across projects)\n --no-auto-resolve never resolve automatically; fail if Package.resolved is stale\n --skip-package-updates use the packages already cloned, without checking for updates\n --no-package-cache ignore the shared package repository cache\n --skip-plugin-validation trust build plugins without prompting\n --skip-signature-validation do not verify package signatures\n --package-auth <kind> keychain or netrc\n --registry-url <url> default package registry\n --scm-to-registry <kind> none, identity, or swift-package-registry\n --fingerprint-policy <kind> strict or warn\n --signing-entity-policy <kind> strict or warn\n --scm-provider <kind> system or xcode\nnote:\n The resolution flags only matter alongside --resolve; reading the pins is a\n file read either way.\nexamples:\n xcodebuild-axi packages\n xcodebuild-axi packages --filter swift-composable\n xcodebuild-axi packages --resolve --offline\n";
2
+ export declare function packagesCommand(args: string[]): Promise<string>;
@@ -0,0 +1,108 @@
1
+ import { AxiError, mapXcodebuildError } from "../errors.js";
2
+ import { requireProject } from "../context.js";
3
+ import { requireScheme } from "../scheme.js";
4
+ import { findResolvedFile, packageArgs, PACKAGE_FLAG_HELP, PACKAGE_FLAGS, PACKAGE_VALUE_FLAGS, readPins, resolvedFileCandidates, } from "../packages.js";
5
+ import { runBuild } from "../xcodebuild.js";
6
+ import { duration, renderFields, renderHelp, renderList, renderOutput, tildePath, } from "../toon.js";
7
+ import { getFlag, hasFlag, rejectUnknownFlags } from "../args.js";
8
+ export const PACKAGES_HELP = `usage: xcodebuild-axi packages [flags]
9
+ Reports the Swift package versions this project is pinned to, read straight
10
+ from Package.resolved — no build, no subprocess.
11
+ flags[17]:
12
+ --resolve actually resolve dependencies first (network, slow)
13
+ --filter <text> only packages whose identity contains this
14
+ --scheme <name> with --resolve against a workspace: the scheme to resolve for
15
+ ${PACKAGE_FLAG_HELP}
16
+ note:
17
+ The resolution flags only matter alongside --resolve; reading the pins is a
18
+ file read either way.
19
+ examples:
20
+ xcodebuild-axi packages
21
+ xcodebuild-axi packages --filter swift-composable
22
+ xcodebuild-axi packages --resolve --offline
23
+ `;
24
+ const FLAGS = ["--resolve", "--filter", "--scheme", ...PACKAGE_FLAGS];
25
+ const VALUE_FLAGS = ["--filter", "--scheme", ...PACKAGE_VALUE_FLAGS];
26
+ export async function packagesCommand(args) {
27
+ rejectUnknownFlags(args, "packages", FLAGS, VALUE_FLAGS);
28
+ const project = requireProject();
29
+ const blocks = [];
30
+ if (hasFlag(args, "--resolve")) {
31
+ // xcodebuild refuses `-resolvePackageDependencies -workspace` without a
32
+ // scheme, and says so only after loading the whole workspace. Resolve one
33
+ // up front — `requireScheme` picks it automatically when there is only one.
34
+ const scheme = project.kind === "workspace"
35
+ ? await requireScheme(project, getFlag(args, "--scheme"), "packages --resolve")
36
+ : getFlag(args, "--scheme");
37
+ const run = await runBuild({
38
+ args: [
39
+ ...project.flags,
40
+ ...(scheme ? ["-scheme", scheme] : []),
41
+ "-resolvePackageDependencies",
42
+ ...packageArgs(args),
43
+ ],
44
+ label: `${project.name}-resolve`,
45
+ project,
46
+ });
47
+ if (run.exitCode !== 0) {
48
+ const mapped = mapXcodebuildError(run.tail);
49
+ throw new AxiError(mapped?.message ?? "Package resolution failed", mapped?.code ?? "UNKNOWN", [
50
+ ...(mapped?.suggestions ?? []),
51
+ `full transcript: ${tildePath(run.logPath)}`,
52
+ ]);
53
+ }
54
+ blocks.push(renderFields({ resolve: "succeeded", duration: duration(run.seconds) }));
55
+ }
56
+ const resolvedPath = findResolvedFile(project);
57
+ if (!resolvedPath) {
58
+ return renderOutput([
59
+ ...blocks,
60
+ renderFields({
61
+ packages: `no Package.resolved found for ${project.name}`,
62
+ }),
63
+ renderHelp([
64
+ "Run `xcodebuild-axi packages --resolve` to create one",
65
+ `looked in: ${resolvedFileCandidates(project).map(tildePath).join(", ")}`,
66
+ ]),
67
+ ]);
68
+ }
69
+ const filter = getFilter(args);
70
+ let pins = readPins(resolvedPath);
71
+ const total = pins.length;
72
+ if (filter) {
73
+ pins = pins.filter((pin) => pin.identity.includes(filter) ||
74
+ pin.location.toLowerCase().includes(filter));
75
+ }
76
+ if (pins.length === 0) {
77
+ return renderOutput([
78
+ ...blocks,
79
+ renderFields({
80
+ packages: filter
81
+ ? `0 of ${total} packages match '${getFlag(args, "--filter")}'`
82
+ : "0 packages pinned",
83
+ }),
84
+ renderFields({ resolved: tildePath(resolvedPath) }),
85
+ ]);
86
+ }
87
+ return renderOutput([
88
+ ...blocks,
89
+ renderFields({
90
+ count: filter ? `${pins.length} of ${total}` : total,
91
+ resolved: tildePath(resolvedPath),
92
+ }),
93
+ renderList("packages", pins.map((pin) => ({
94
+ package: pin.identity,
95
+ version: pin.version,
96
+ revision: pin.revision,
97
+ }))),
98
+ renderHelp(filter
99
+ ? []
100
+ : [
101
+ "Run `xcodebuild-axi packages --resolve` to update them from the network",
102
+ ]),
103
+ ]);
104
+ }
105
+ function getFilter(args) {
106
+ return getFlag(args, "--filter")?.toLowerCase();
107
+ }
108
+ //# sourceMappingURL=packages.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"packages.js","sourceRoot":"","sources":["../../../src/commands/packages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QA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ACpB,QAAQ,EAAE,GAAG,CAAC,QAAQ;SACvB,CAAC,CAAC,CACJ;QACD,UAAU,CACR,MAAM;YACJ,CAAC,CAAC,EAAE;YACJ,CAAC,CAAC;gBACE,yEAAyE;aAC1E,CACN;KACF,CAAC,CAAC;AACL,CAAC;AAED,SAAS,SAAS,CAAC,IAAc;IAC/B,OAAO,OAAO,CAAC,IAAI,EAAE,UAAU,CAAC,EAAE,WAAW,EAAE,CAAC;AAClD,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const PLATFORMS_HELP = "usage: xcodebuild-axi platforms [subcommand] [flags]\nInstalled simulator runtimes, and the toolchain downloads that add more.\nsubcommands[7]:\n (none) list the installed runtimes\n download <platform> iOS, watchOS, tvOS, visionOS, or --all\n import <path.dmg> install a runtime from a downloaded disk image\n component <op> <name> show, download, import, or delete a component\n device-support prepare symbols for a physical device\n first-launch install bundled packages and accept the license\n license report whether the Xcode license has been accepted\nflags[11]:\n --all with download: every platform Xcode offers\n --export-path <path> download to this directory instead of installing\n --build-version <v> a specific OS or asset build to fetch\n --arch-variant <v> universal or arm64\n --import-path <path> with `component import`: the bundle to install\n --platform <name> with device-support: iOS, macOS, and so on\n --os-version <v> with device-support: e.g. 26.0\n --model-code <code> with device-support: e.g. iPhone16,1\n --architecture <arch> with device-support: e.g. arm64e\n --status with first-launch: report whether it is needed, and stop\n --check-updates with first-launch: also check for newer components\nnote:\n Downloads are multi-gigabyte and stream to a log rather than to stdout; the\n log path is printed either way. Known component: MetalToolchain.\nexit:\n 0 succeeded, 1 the download or install failed, 2 usage error\nexamples:\n xcodebuild-axi platforms\n xcodebuild-axi platforms download iOS\n xcodebuild-axi platforms component show MetalToolchain\n xcodebuild-axi platforms device-support --platform iOS --os-version 26.0\n xcodebuild-axi platforms license\n";
2
+ export declare function platformsCommand(args: string[]): Promise<string>;