rork-xcode 0.9.0 → 0.11.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.
package/README.md CHANGED
@@ -100,7 +100,7 @@ const text = project.build();
100
100
 
101
101
  ### Targets and build settings
102
102
 
103
- `getBuildSetting` resolves hierarchically the way Xcode does: the target's default configuration first, then the project-level configuration. Writes go to every configuration of the target, so Debug and Release stay consistent.
103
+ `getBuildSetting` resolves hierarchically the way Xcode does, reading the target's default configuration first and the project-level configuration below it. Writes go to every configuration of the target, so Debug and Release stay consistent.
104
104
 
105
105
  ```ts
106
106
  const app = project.findMainAppTarget("ios"); // "macos" | "tvos" | "watchos" | "visionos"
@@ -114,6 +114,13 @@ for (const target of project.nativeTargets()) {
114
114
  }
115
115
  ```
116
116
 
117
+ `resolveBuildSetting` reads the same layers and expands the `$(NAME)` and `${NAME}` references in the value. Referenced settings resolve through the chain, `$(inherited)` continues from the next layer down, and `$(TARGET_NAME)` falls back to the target's name, so the template's `PRODUCT_NAME = "$(TARGET_NAME)"` resolves without any setup. References the document cannot answer (build-system paths like `$(BUILT_PRODUCTS_DIR)`) stay verbatim unless a caller-supplied lookup answers them, so nothing is invented.
118
+
119
+ ```ts
120
+ app?.resolveBuildSetting("PRODUCT_NAME"); // "DemoApp", from PRODUCT_NAME = "$(TARGET_NAME)"
121
+ app?.resolveBuildSetting("WIDGET_ID"); // "com.example.demo.widget", through PRODUCT_BUNDLE_IDENTIFIER
122
+ ```
123
+
117
124
  `project.targets()` returns every target kind. Aggregate targets (`PBXAggregateTarget`) and legacy external-build-tool targets (`PBXLegacyTarget`) share the full target surface, from configurations and build settings to phases and dependency wiring.
118
125
 
119
126
  ```ts
@@ -206,6 +213,17 @@ if (widget) project.removeTarget(widget);
206
213
  project.referrersOf(app.id); // every object referencing an id, for custom teardowns
207
214
  ```
208
215
 
216
+ ### Renaming
217
+
218
+ `renameTarget` renames a target and every place the document knows it by name. That covers the target's `name` and `productName`, its product file reference, the `remoteInfo` of container proxies pointing at it, `TEST_TARGET_NAME` values naming it, and the path segments of `TEST_HOST` and `BUNDLE_LOADER` that name the target or its product. Names match whole, so renaming `DemoApp` leaves `DemoAppTests` alone, and a `PRODUCT_NAME` of `$(TARGET_NAME)` follows by itself. On-disk renames (source folders, entitlements files) and the group paths pointing at those folders stay with the caller.
219
+
220
+ ```ts
221
+ const app = project.findMainAppTarget("ios");
222
+ if (app) project.renameTarget(app, "RenamedApp");
223
+ ```
224
+
225
+ Scheme files live next to the project rather than inside it, so the scheme model carries the counterpart (see [Schemes](#schemes)).
226
+
209
227
  ### Escape hatch
210
228
 
211
229
  Every view exposes its raw dictionary, so anything the typed surface does not cover stays one property away, and `project.objects()` iterates every object with its typed view:
@@ -235,25 +253,21 @@ for (const [id, object] of project.objects()) {
235
253
 
236
254
  `.xcscheme` files describe how Xcode builds, runs, tests, and archives a target. They are not property lists but a small XML dialect of their own, and the scheme module covers it with the same contract as the pbxproj functions. An Xcode-written scheme rebuilds byte for byte, any other input reaches Xcode's canonical layout in one build, and malformed input fails with a typed error carrying line and column.
237
255
 
238
- `Xcscheme` is the model. Buildable references are the elements editing flows touch, and they come back as typed views:
256
+ `Xcscheme` is the model. Renames are one call per move. `renameTarget` is the scheme-file side of the project model's `renameTarget` and touches only the named target's references, and `renameContainer` follows a rename of the `.xcodeproj` directory itself. Both return whether anything changed, so callers can skip rewriting untouched files:
239
257
 
240
258
  ```ts
241
259
  import { Xcscheme } from "rork-xcode";
242
260
 
243
261
  const scheme = Xcscheme.parse(xcschemeText);
244
262
 
245
- // Rename the app while keeping each product's own shape, so a testable
246
- // like DemoAppTests.xctest stays a test bundle.
247
- for (const reference of scheme.buildableReferences()) {
248
- const { blueprintName, buildableName } = reference;
249
- if (blueprintName) reference.blueprintName = blueprintName.replace("DemoApp", "RenamedApp");
250
- if (buildableName) reference.buildableName = buildableName.replace("DemoApp", "RenamedApp");
251
- reference.referencedContainer = "container:RenamedApp.xcodeproj";
252
- }
263
+ scheme.renameTarget("DemoApp", "RenamedApp"); // DemoAppTests stays untouched
264
+ scheme.renameContainer("DemoApp", "RenamedApp"); // container:RenamedApp.xcodeproj
253
265
 
254
266
  const text = scheme.build();
255
267
  ```
256
268
 
269
+ For anything else, buildable references come back as typed views through `scheme.buildableReferences()`, with property access to the blueprint name, buildable name, container, and identifier.
270
+
257
271
  `Xcscheme.create` produces the scheme Xcode's own "New Scheme" action writes for an application target, wired to the target's object id from the project document:
258
272
 
259
273
  ```ts
@@ -268,7 +282,7 @@ Underneath, the document is a plain tree of elements with ordered attributes and
268
282
 
269
283
  ## Xcconfig files
270
284
 
271
- Build settings do not only live in the pbxproj. Projects push them into `.xcconfig` files referenced through `baseConfigurationReference`, and the xcconfig module reads and writes that format with the fidelity the rest of the library promises. The format is hand-authored with no canonical layout, so the contract here is losslessness: parsing and building an untouched file reproduces it byte for byte comments, blank lines, column alignment, and line endings included. Malformed lines fail loudly with a typed error carrying line and column rather than being dropped, so a file the parser accepts is a file it fully understood.
285
+ Build settings do not only live in the pbxproj. Projects push them into `.xcconfig` files referenced through `baseConfigurationReference`, and the xcconfig module reads and writes that format with the fidelity the rest of the library promises. The format is hand-authored with no canonical layout, so the contract here is losslessness. Parsing and building an untouched file reproduces it byte for byte, including comments, blank lines, column alignment, and line endings. Malformed lines fail loudly with a typed error carrying line and column rather than being dropped, so a file the parser accepts is a file it fully understood.
272
286
 
273
287
  `Xcconfig` is the model. Reads follow the file top to bottom the way Xcode does, and writes edit single lines while leaving every other byte alone:
274
288
 
@@ -300,13 +314,31 @@ const settings = config.settings({
300
314
  });
301
315
  ```
302
316
 
303
- Registering a file on the project makes `getBuildSetting` resolve through it in Xcode's order target settings, the target's xcconfig, project settings, the project's xcconfig:
317
+ Registering a file on the project makes `getBuildSetting` resolve through it in Xcode's order of target settings, then the target's xcconfig, then project settings, then the project's xcconfig:
304
318
 
305
319
  ```ts
306
320
  project.registerXcconfig(reference, Xcconfig.parse(text));
307
321
  app.getBuildSetting("SDKROOT"); // now sees values the xcconfig defines
308
322
  ```
309
323
 
324
+ ## Build-setting references
325
+
326
+ Values reference other build settings as `$(NAME)` and `${NAME}`, in the pbxproj, in xcconfig files, and in Info.plist templates. The syntax is Xcode's own, down to the `:` operators, and Xcode's app templates write values in exactly this shape, for example `PRODUCT_BUNDLE_IDENTIFIER = com.yourcompany.$(PRODUCT_NAME:rfc1034identifier)`. `expandBuildSettingReferences` evaluates the syntax through a caller-supplied lookup, so the same code serves all three formats. Substituted text expands recursively, names may themselves contain references (`$(SETTING_$(VARIANT))`), cycles stay finite, and a reference the lookup cannot answer stays verbatim, so partial resolution loses no information.
327
+
328
+ ```ts
329
+ import { expandBuildSettingReferences } from "rork-xcode";
330
+
331
+ // A value as found in a project file. The references and their operators
332
+ // are part of the document, so the expander takes them from the text
333
+ // rather than from options.
334
+ const found = "com.example.$(PRODUCT_NAME:rfc1034identifier)";
335
+
336
+ expandBuildSettingReferences(found, (name) => (name === "PRODUCT_NAME" ? "My App" : undefined));
337
+ // "com.example.My-App"
338
+ ```
339
+
340
+ The `:` operators are honored for `lower`, `upper`, `rfc1034identifier` (the mapping into RFC 1034 host-name characters that bundle identifiers need), `c99extidentifier`, and `default=`. A reference carrying any other operator stays verbatim rather than expanding to a wrongly transformed value. The model composes the expander with settings resolution as `target.resolveBuildSetting(key)`, described under [Targets and build settings](#targets-and-build-settings).
341
+
310
342
  ## Performance
311
343
 
312
344
  `rork-xcode` is measured against the pbxproj parsers on npm, [`@bacons/xcode`](https://www.npmjs.com/package/@bacons/xcode) (its `/json` parse/build entry point) and [`xcode`](https://www.npmjs.com/package/xcode) (the long-standing package used by native build tooling), on three documents: two real Xcode-written projects from the test suite and a deterministically generated five-target app with 800 source files. It is the fastest at both operations on every document, with zero dependencies.
@@ -336,7 +368,7 @@ Measured on an Apple M5 Max, Node.js 24, single thread, with `@bacons/xcode` 1.0
336
368
  ## Verification
337
369
 
338
370
  - The committed fixture corpus spans project generations from Xcode 3 to Xcode 16, captured from real projects with identifiers neutralized: synchronized folders with both exception-set kinds, classic groups, variant groups, aggregate and legacy targets, reference proxies, build rules, Swift packages, and a ~100 KiB multiplatform framework project.
339
- - Documents already in current Xcode's layout must round-trip byte for byte; documents from other tool generations must normalize to a byte-stable fixed point with unchanged values.
371
+ - Documents already in current Xcode's layout must round-trip byte for byte, and documents from other tool generations must normalize to a byte-stable fixed point with unchanged values.
340
372
  - On macOS, the suite cross-validates every fixture and its rebuilt form with `plutil`, Apple's own property list parser and the empirical ground truth for what Apple tooling accepts.
341
373
  - A corpus sweep (`pnpm corpus`) walks every Xcode project, scheme, and xcconfig on the machine, verifies each one parses and reaches a byte-stable fixed point (byte-exact losslessness for xcconfig, which has no canonical layout), exercises the object model against every project, and cross-validates a sample against plutil's own reading.
342
374
  - CI runs the full gate on Linux and macOS, and executes the built artifact on the oldest supported Node to enforce the `engines` floor.
package/dist/index.d.ts CHANGED
@@ -10,33 +10,34 @@
10
10
  * - `( item, item, ... )` parses to a {@link PbxprojArray}.
11
11
  * - `<48656c6c6f>` data runs parse to `Uint8Array`.
12
12
  * - Unquoted integers and decimals (`46`, `3.14`, `-12`) parse to `number`
13
- * under one print-back rule: the literal converts exactly when the number
14
- * formats back to the identical text.
13
+ * under one print-back rule, where the literal converts exactly when the
14
+ * number formats back to the identical text.
15
15
  * - Everything else (quoted text, identifiers, uuids, paths) parses to
16
16
  * `string`.
17
17
  *
18
- * The print-back rule is what keeps round-trips faithful: any literal the
18
+ * The print-back rule is what keeps round-trips faithful. Any literal the
19
19
  * conversion would reshape stays a string, so serializing never changes a
20
20
  * scalar's bytes. Leading-zero runs like `0755` would corrupt file modes,
21
- * trailing-zero decimals like `5.0` would drop the zero build settings are
22
- * written with, bare-dot decimals like `.5` would grow a leading zero, and
21
+ * trailing-zero decimals like `5.0` would drop the zero that build
22
+ * settings are written with, bare-dot decimals like `.5` would grow a
23
+ * leading zero, and
23
24
  * digit runs beyond `Number.MAX_SAFE_INTEGER` would lose precision (a
24
- * 24-character identifier can be all digits); all of these therefore parse
25
- * as strings.
25
+ * 24-character identifier can be all digits), so all of these parse as
26
+ * strings.
26
27
  *
27
28
  * @module
28
29
  */
29
30
  /**
30
31
  * A value representable in a `project.pbxproj` document.
31
32
  *
32
- * Notably absent are booleans and null: the format has no notation for
33
+ * Notably absent are booleans and null. The format has no notation for
33
34
  * either, and Xcode models flags as the strings `"YES"` and `"NO"`.
34
35
  */
35
36
  type PbxprojValue = string | number | Uint8Array | PbxprojArray | PbxprojObject;
36
37
  /**
37
38
  * A `( ... )` list: an ordered array of values.
38
39
  *
39
- * This is a plain JavaScript array; the interface exists only to give the
40
+ * This is a plain JavaScript array. The interface exists only to give the
40
41
  * recursive {@link PbxprojValue} type a name.
41
42
  */
42
43
  interface PbxprojArray extends Array<PbxprojValue> {}
@@ -55,18 +56,18 @@ interface PbxprojObject {
55
56
  /**
56
57
  * Serializes a project document to `project.pbxproj` text.
57
58
  *
58
- * The input is the same shape {@link parsePbxproj} produces; see the module
59
- * documentation of `types.ts` for the value model. Output is stable: two
59
+ * The input is the same shape {@link parsePbxproj} produces. See the module
60
+ * documentation of `types.ts` for the value model. Output is stable, so two
60
61
  * calls with semantically equal documents produce identical text, and the
61
62
  * layout matches what Xcode itself writes so diffs stay minimal.
62
63
  *
63
64
  * @param root The document root. Real project documents carry `objects`,
64
65
  * `rootObject`, and the version fields, but any dictionary serializes.
65
66
  * @returns The document text, terminated by a newline.
66
- * @throws PbxprojBuildError when a value has no pbxproj representation:
67
- * `null`, `undefined`, booleans, bigints, functions, symbols, class
68
- * instances, or non-finite numbers. The error names the path of the
69
- * offending value.
67
+ * @throws PbxprojBuildError when a value has no pbxproj representation,
68
+ * meaning `null`, `undefined`, booleans, bigints, functions, symbols,
69
+ * class instances, or non-finite numbers. The error names the path of
70
+ * the offending value.
70
71
  */
71
72
  declare function buildPbxproj(root: PbxprojObject): string;
72
73
  //#endregion
@@ -107,7 +108,7 @@ declare class PbxprojParseError extends Error {
107
108
  /** Where in the source text parsing failed. */
108
109
  readonly position: PbxprojErrorPosition;
109
110
  /**
110
- * @param message Failure description without location; the location is
111
+ * @param message Failure description without location. The location is
111
112
  * appended automatically.
112
113
  * @param source Full source text, used to compute the position.
113
114
  * @param offset Character offset of the failure inside `source`.
@@ -126,7 +127,7 @@ declare class XcschemeParseError extends Error {
126
127
  /** Where in the source text parsing failed. */
127
128
  readonly position: PbxprojErrorPosition;
128
129
  /**
129
- * @param message Failure description without location; the location is
130
+ * @param message Failure description without location. The location is
130
131
  * appended automatically.
131
132
  * @param source Full source text, used to compute the position.
132
133
  * @param offset Character offset of the failure inside `source`.
@@ -145,7 +146,7 @@ declare class XcconfigParseError extends Error {
145
146
  /** Where in the source text parsing failed. */
146
147
  readonly position: PbxprojErrorPosition;
147
148
  /**
148
- * @param message Failure description without location; the location is
149
+ * @param message Failure description without location. The location is
149
150
  * appended automatically.
150
151
  * @param source Full source text, used to compute the position.
151
152
  * @param offset Character offset of the failure inside `source`.
@@ -163,14 +164,14 @@ declare class XcschemeBuildError extends Error {
163
164
  /** Path to the offending element from the root, e.g. `Scheme.BuildAction[0]`. */
164
165
  readonly path: string;
165
166
  /**
166
- * @param message Failure description without location; the element path
167
+ * @param message Failure description without location. The element path
167
168
  * is appended automatically.
168
169
  * @param path Path to the offending element from the root.
169
170
  */
170
171
  constructor(message: string, path: string);
171
172
  }
172
173
  /**
173
- * Thrown by the object model when an operation cannot proceed: the
174
+ * Thrown by the object model when an operation cannot proceed, because the
174
175
  * document lacks the structure the operation needs (no objects dictionary,
175
176
  * no root project object), a view's object was removed from the document,
176
177
  * or a creation request names a product type the model cannot scaffold.
@@ -199,26 +200,93 @@ declare class PbxprojBuildError extends Error {
199
200
  /** Path to the offending value from the root, e.g. `$.objects.13B07F86.name`. */
200
201
  readonly path: string;
201
202
  /**
202
- * @param message Failure description without location; the value path is
203
+ * @param message Failure description without location. The value path is
203
204
  * appended automatically.
204
205
  * @param path Path to the offending value from the root, `$`.
205
206
  */
206
207
  constructor(message: string, path: string);
207
208
  }
208
209
  //#endregion
210
+ //#region src/expansion.d.ts
211
+ /**
212
+ * Expansion of `$(NAME)` and `${NAME}` build-setting references.
213
+ *
214
+ * Values in the pbxproj, in xcconfig files, and in Info.plist templates
215
+ * reference other build settings, and every consumer that needs the
216
+ * resolved string ends up re-implementing the substitution informally.
217
+ * The expander here is a pure function over a caller-supplied lookup, so
218
+ * the same code serves all three formats. The model composes it with
219
+ * settings resolution in `Target.resolveBuildSetting`.
220
+ *
221
+ * @module
222
+ */
223
+ /**
224
+ * The value a reference expands to, or `undefined` to leave the
225
+ * reference in place. Returning the empty string expands to nothing,
226
+ * which is how Xcode itself treats settings that exist but are empty.
227
+ */
228
+ type BuildSettingLookup = (name: string) => string | undefined;
229
+ interface ExpandBuildSettingOptions {
230
+ /**
231
+ * Whether lookup answers are expanded again, which is the default and
232
+ * suits lookups reading raw stored values. A lookup that resolves
233
+ * references itself, like the model's layered resolution, turns this
234
+ * off so text it deliberately left verbatim is not reinterpreted in
235
+ * the outer value's context.
236
+ */
237
+ expandLookupValues?: boolean;
238
+ }
239
+ /**
240
+ * Expands every `$(NAME)` and `${NAME}` reference in a value through the
241
+ * lookup. Substituted text is expanded again, so references are followed
242
+ * through chains of values, and reference names may themselves contain
243
+ * references (`$(SETTING_$(VARIANT))`), which expand innermost first.
244
+ *
245
+ * A lookup answer of `undefined` leaves the reference in the output
246
+ * verbatim, so partial resolution loses no information. A reference
247
+ * whose expansion would recurse into itself also stays verbatim, which
248
+ * keeps cyclic definitions finite. Xcode's `:` operators are honored for
249
+ * the forms below, and a reference carrying any other operator stays
250
+ * verbatim rather than expanding to a wrongly transformed value.
251
+ *
252
+ * The supported operators are `lower` and `upper` for case mapping,
253
+ * `rfc1034identifier` and `c99extidentifier` for the identifier
254
+ * mappings bundle identifiers and product module names use, and
255
+ * `default=value` for substituting a fallback when the setting resolves
256
+ * empty or is not known to the lookup.
257
+ */
258
+ declare function expandBuildSettingReferences(value: string, lookup: BuildSettingLookup, options?: ExpandBuildSettingOptions): string;
259
+ /**
260
+ * The transforming operators the expander supports, keyed by the name
261
+ * they are written with. `default=` is not listed because it carries an
262
+ * argument and substitutes rather than transforms, so the reference
263
+ * expansion handles it structurally.
264
+ */
265
+ declare const OPERATOR_TRANSFORMS: {
266
+ c99extidentifier: (value: string) => string;
267
+ lower: (value: string) => string;
268
+ rfc1034identifier: (value: string) => string;
269
+ upper: (value: string) => string;
270
+ };
271
+ /**
272
+ * A transforming operator name honored in `$(NAME:operator)` references,
273
+ * alongside the structural `default=`.
274
+ */
275
+ type BuildSettingOperator = keyof typeof OPERATOR_TRANSFORMS;
276
+ //#endregion
209
277
  //#region src/model/isa.d.ts
210
278
  /**
211
279
  * Names and well-known values of the pbxproj object vocabulary.
212
280
  *
213
- * Everything here mirrors strings Xcode itself writes; nothing is invented.
214
- * Centralizing them keeps the object model free of string literals and
215
- * gives call sites one place to import from.
281
+ * Everything here mirrors strings Xcode itself writes, and nothing is
282
+ * invented. Centralizing them keeps the object model free of string
283
+ * literals and gives call sites one place to import from.
216
284
  *
217
285
  * @module
218
286
  */
219
287
  /**
220
288
  * The `isa` names the object model works with. The parser and serializer
221
- * accept any isa; this list only covers the kinds the model creates or
289
+ * accept any isa, and this list only covers the kinds the model creates or
222
290
  * gives typed access to.
223
291
  */
224
292
  declare const Isa: {
@@ -592,6 +660,16 @@ interface BuildStyleProperties extends PbxprojObject {
592
660
  }
593
661
  //#endregion
594
662
  //#region src/model/target.d.ts
663
+ interface ResolveBuildSettingOptions {
664
+ /**
665
+ * Answers references the document itself cannot, for example
666
+ * `$(BUILT_PRODUCTS_DIR)` when the caller knows the build layout. The
667
+ * lookup is consulted after the setting layers and before the built-in
668
+ * `$(TARGET_NAME)` fallback, and a reference it leaves unanswered
669
+ * stays verbatim in the result.
670
+ */
671
+ lookup?: BuildSettingLookup;
672
+ }
595
673
  /**
596
674
  * The behavior every target kind shares. A target of any kind carries
597
675
  * build configurations and settings, build phases, and dependencies, and
@@ -629,13 +707,29 @@ declare class Target<Properties extends TargetProperties = TargetProperties> ext
629
707
  *
630
708
  * Configurations based on `.xcconfig` files take part once the files
631
709
  * are registered through {@link XcodeProject.registerXcconfig}, in
632
- * Xcode's order: target settings, the target's xcconfig, project
633
- * settings, the project's xcconfig.
710
+ * Xcode's order of target settings, then the target's xcconfig, then
711
+ * project settings, then the project's xcconfig.
634
712
  *
635
- * Only string values are returned; a list- or number-valued setting reads
636
- * as `undefined`.
713
+ * Only string values are returned, so a list- or number-valued setting
714
+ * reads as `undefined`.
637
715
  */
638
716
  getBuildSetting(key: string): string | undefined;
717
+ /**
718
+ * Reads a build setting like {@link getBuildSetting} and expands the
719
+ * `$(NAME)` and `${NAME}` references in it. Referenced settings resolve
720
+ * through the same layering, `$(inherited)` and a setting referencing
721
+ * itself continue from the next layer down the way Xcode composes
722
+ * values, and `$(TARGET_NAME)` falls back to the target's name, so the
723
+ * common `PRODUCT_NAME = "$(TARGET_NAME)"` resolves without any caller
724
+ * setup.
725
+ *
726
+ * References the model cannot resolve (build-system paths like
727
+ * `$(BUILT_PRODUCTS_DIR)`, environment values) stay in the result
728
+ * verbatim unless the caller's lookup answers them, so no information
729
+ * is invented. See {@link expandBuildSettingReferences} for the
730
+ * operator forms honored during expansion.
731
+ */
732
+ resolveBuildSetting(key: string, options?: ResolveBuildSettingOptions): string | undefined;
639
733
  /**
640
734
  * Writes a build setting on every configuration of the target, so Debug
641
735
  * and Release stay consistent.
@@ -879,7 +973,7 @@ declare class Group<Properties extends GroupProperties = GroupProperties> extend
879
973
  * it to the group's children.
880
974
  *
881
975
  * The reference's `lastKnownFileType` derives from the file extension
882
- * when it is a known kind; otherwise the reference carries no type and
976
+ * when it is a known kind. Otherwise the reference carries no type and
883
977
  * Xcode re-derives one on open.
884
978
  *
885
979
  * @param path File path relative to the group, for example
@@ -905,8 +999,8 @@ declare class VariantGroup extends Group {
905
999
  declare class BuildPhase<Properties extends BuildPhaseProperties = BuildPhaseProperties> extends XcodeObject<Properties> {
906
1000
  /**
907
1001
  * The phase's display name, when it carries an explicit one. Xcode names
908
- * copy-files and shell-script phases; the standard phases derive their
909
- * names from their isa.
1002
+ * copy-files and shell-script phases, while the standard phases derive
1003
+ * their names from their isa.
910
1004
  */
911
1005
  get name(): string | undefined;
912
1006
  /**
@@ -934,7 +1028,7 @@ declare class BuildPhase<Properties extends BuildPhaseProperties = BuildPhasePro
934
1028
  * @param reference The file reference or package product the build file
935
1029
  * should point at.
936
1030
  * @param options.referenceKey Which build-file field carries the
937
- * reference: `fileRef` for file references (the default) or
1031
+ * reference, either `fileRef` for file references (the default) or
938
1032
  * `productRef` for Swift package products.
939
1033
  * @param options.settings Optional per-file settings, for example
940
1034
  * `{ ATTRIBUTES: ["RemoveHeadersOnCopy"] }`.
@@ -1029,7 +1123,7 @@ declare class BuildFile extends XcodeObject<BuildFileProperties> {
1029
1123
  /**
1030
1124
  * The view of the file reference the build file points at, when it
1031
1125
  * points at one. Build files for Swift package products carry a
1032
- * `productRef` instead; see {@link productDependency}.
1126
+ * `productRef` instead, resolved through {@link productDependency}.
1033
1127
  */
1034
1128
  fileReference(): XcodeObject | undefined;
1035
1129
  /**
@@ -1055,12 +1149,12 @@ declare class SyncRootGroup extends XcodeObject<SyncRootGroupProperties> {
1055
1149
  *
1056
1150
  * Xcode keeps one exception set per target and folder, so when this
1057
1151
  * group already carries a set for the target, the file names merge into
1058
- * it instead of creating a second set; names already excluded are not
1059
- * duplicated.
1152
+ * it instead of creating a second set, and names already excluded are
1153
+ * not duplicated.
1060
1154
  *
1061
1155
  * The standard use is keeping a scaffolded `Info.plist` from being
1062
- * double-copied: the build already processes it through the target's
1063
- * `INFOPLIST_FILE` setting.
1156
+ * double-copied, since the build already processes it through the
1157
+ * target's `INFOPLIST_FILE` setting.
1064
1158
  *
1065
1159
  * @param target The target whose membership the exceptions restrict.
1066
1160
  * @param membershipExceptions File names inside the folder to exclude.
@@ -1540,7 +1634,7 @@ declare class RootProject extends XcodeObject<RootProjectProperties> {
1540
1634
  mainGroup(): Group | undefined;
1541
1635
  /**
1542
1636
  * The settings dictionary of the project-level default configuration.
1543
- * Targets inherit from these settings; see
1637
+ * Targets inherit from these settings, as described on
1544
1638
  * {@link NativeTarget.getBuildSetting}.
1545
1639
  */
1546
1640
  defaultConfigurationSettings(): PbxprojObject | undefined;
@@ -1619,7 +1713,7 @@ declare class XcodeProject {
1619
1713
  static parse(text: string): XcodeProject;
1620
1714
  /**
1621
1715
  * Wraps an already parsed document in a model. The document is used in
1622
- * place, not copied; model mutations write into it.
1716
+ * place rather than copied, so model mutations write into it.
1623
1717
  */
1624
1718
  static fromDocument(document: PbxprojObject): XcodeProject;
1625
1719
  /**
@@ -1630,7 +1724,7 @@ declare class XcodeProject {
1630
1724
  /**
1631
1725
  * The raw properties dictionary of an object.
1632
1726
  *
1633
- * @throws XcodeModelError when no object with the id exists; views use
1727
+ * @throws XcodeModelError when no object with the id exists. Views use
1634
1728
  * this accessor, so a view of a deleted object fails loudly instead of
1635
1729
  * resurrecting the entry.
1636
1730
  */
@@ -1653,8 +1747,8 @@ declare class XcodeProject {
1653
1747
  objects(): IterableIterator<[string, XcodeObject]>;
1654
1748
  /**
1655
1749
  * Generates a deterministic 24-character id from a seed, avoiding every
1656
- * id the document currently contains. The id is not reserved; adding an
1657
- * object with it (see {@link add}) is what claims it.
1750
+ * id the document currently contains. The id is not reserved, and only
1751
+ * adding an object with it (see {@link add}) claims it.
1658
1752
  */
1659
1753
  generateId(seed: string): string;
1660
1754
  /**
@@ -1723,7 +1817,8 @@ declare class XcodeProject {
1723
1817
  * and Resources build phases, and registers it on the project.
1724
1818
  *
1725
1819
  * @throws XcodeModelError for product types the model cannot create a
1726
- * product reference for; see {@link AddNativeTargetOptions.productType}.
1820
+ * product reference for, listed on
1821
+ * {@link AddNativeTargetOptions.productType}.
1727
1822
  */
1728
1823
  addNativeTarget(options: AddNativeTargetOptions): NativeTarget;
1729
1824
  /**
@@ -1733,7 +1828,7 @@ declare class XcodeProject {
1733
1828
  /**
1734
1829
  * Adds a remote Swift package reference and registers it on the project.
1735
1830
  * When the project already references the repository, the existing
1736
- * reference is returned unchanged, requirement included; adjust an
1831
+ * reference is returned unchanged, requirement included. Adjust an
1737
1832
  * existing requirement through the reference's properties. Link products
1738
1833
  * to targets with {@link NativeTarget.addSwiftPackageProduct}.
1739
1834
  *
@@ -1786,7 +1881,7 @@ declare class XcodeProject {
1786
1881
  * list containing it, or a nested dictionary carrying it as a key or
1787
1882
  * string value.
1788
1883
  *
1789
- * The scan is linear over the document; removal flows call it once per
1884
+ * The scan is linear over the document. Removal flows call it once per
1790
1885
  * removed object, which keeps teardown proportional to what is actually
1791
1886
  * removed.
1792
1887
  */
@@ -1798,7 +1893,7 @@ declare class XcodeProject {
1798
1893
  * (such as `TargetAttributes`) drop its entry.
1799
1894
  *
1800
1895
  * Removing an id the document does not contain is a no-op. This is the
1801
- * low-level removal; {@link removeTarget} composes it into a full
1896
+ * low-level removal, and {@link removeTarget} composes it into a full
1802
1897
  * teardown.
1803
1898
  */
1804
1899
  removeObject(id: string): void;
@@ -1811,7 +1906,7 @@ declare class XcodeProject {
1811
1906
  * dependencies on others), its membership exception sets, and
1812
1907
  * synchronized folders no remaining target links.
1813
1908
  *
1814
- * On-disk sources are untouched; the removal is document-only, like
1909
+ * On-disk sources are untouched. The removal is document-only, like
1815
1910
  * deleting a target in Xcode and keeping its folder.
1816
1911
  *
1817
1912
  * @throws XcodeModelError when the target belongs to another project,
@@ -1819,13 +1914,33 @@ declare class XcodeProject {
1819
1914
  * objects that happen to share them.
1820
1915
  */
1821
1916
  removeTarget(target: Target): void;
1917
+ /**
1918
+ * Renames a target and every place the document knows it by name. That
1919
+ * covers the target's `name` and `productName`, its product file
1920
+ * reference (`OldName.app` becomes `NewName.app`, whatever the
1921
+ * extension), the `remoteInfo` of container item proxies pointing at
1922
+ * the target, `TEST_TARGET_NAME` settings naming it, and the path
1923
+ * segments of `TEST_HOST` and `BUNDLE_LOADER` settings that name the
1924
+ * target or its product. A `PRODUCT_NAME` of the target's own
1925
+ * configurations is rewritten only when it spells the old name
1926
+ * literally. The usual `$(TARGET_NAME)` follows by itself.
1927
+ *
1928
+ * Scheme files live outside the pbxproj, so buildable references are
1929
+ * renamed separately through `Xcscheme.renameTarget`. On-disk renames
1930
+ * (source folders, entitlements files) and the group paths pointing at
1931
+ * those folders stay with the caller. Sibling targets such as
1932
+ * `OldNameTests` are renamed with their own calls.
1933
+ *
1934
+ * @throws XcodeModelError when the target belongs to another project.
1935
+ */
1936
+ renameTarget(target: Target, newName: string): void;
1822
1937
  /**
1823
1938
  * Finds a file reference by its project-relative path, resolving each
1824
1939
  * reference's location through the group tree from the main group
1825
1940
  * (nested group `path` components join with `/`).
1826
1941
  *
1827
1942
  * Members of file-system-synchronized folders are not listed in the
1828
- * document and therefore cannot be found; check
1943
+ * document and therefore cannot be found. Check
1829
1944
  * {@link NativeTarget.syncGroupPaths} for folder-level containment
1830
1945
  * instead.
1831
1946
  */
@@ -1987,8 +2102,8 @@ declare class XcodeObject<Properties extends PbxprojObject = PbxprojObject> {
1987
2102
  * nested dictionaries keyed by object id (such as the root project's
1988
2103
  * `TargetAttributes`) drop its entry.
1989
2104
  *
1990
- * This is the low-level removal; it does not cascade to objects that only
1991
- * made sense alongside this one. Higher-level operations like
2105
+ * This is the low-level removal, so it does not cascade to objects that
2106
+ * only made sense alongside this one. Higher-level operations like
1992
2107
  * {@link XcodeProject.removeTarget} compose it into full teardowns.
1993
2108
  */
1994
2109
  removeFromProject(): void;
@@ -2006,7 +2121,7 @@ declare class XcodeObject<Properties extends PbxprojObject = PbxprojObject> {
2006
2121
  * @param text Source text of the document.
2007
2122
  * @returns The document's root value. For real project files this is the
2008
2123
  * root dictionary with `objects`, `rootObject`, and version fields.
2009
- * @throws PbxprojParseError when the document is malformed; the error
2124
+ * @throws PbxprojParseError when the document is malformed. The error
2010
2125
  * carries the line and column of the failure.
2011
2126
  */
2012
2127
  declare function parsePbxproj(text: string): PbxprojValue;
@@ -2178,6 +2293,22 @@ declare class Xcscheme {
2178
2293
  * of these, so rename flows iterate this list.
2179
2294
  */
2180
2295
  buildableReferences(): BuildableReference[];
2296
+ /**
2297
+ * Renames every buildable reference pointing at a target. The blueprint
2298
+ * name is matched whole, and the buildable name is matched by its stem,
2299
+ * so `OldApp.app` becomes `NewApp.app` while `OldAppTests.xctest`, a
2300
+ * different target's product, stays untouched. This is the scheme-file
2301
+ * side of `XcodeProject.renameTarget`. Returns whether anything
2302
+ * changed, so callers can skip rewriting untouched files.
2303
+ */
2304
+ renameTarget(oldName: string, newName: string): boolean;
2305
+ /**
2306
+ * Rewrites every buildable reference's container after the
2307
+ * `.xcodeproj` directory itself is renamed, so `container:Old.xcodeproj`
2308
+ * becomes `container:New.xcodeproj`. The project names are matched
2309
+ * exactly. Returns whether anything changed.
2310
+ */
2311
+ renameContainer(oldProjectName: string, newProjectName: string): boolean;
2181
2312
  }
2182
2313
  /**
2183
2314
  * Options for {@link createXcscheme}.
@@ -2220,7 +2351,7 @@ declare function parseXcscheme(text: string): XcschemeDocument;
2220
2351
  * Deterministic object identifiers for generated pbxproj objects.
2221
2352
  *
2222
2353
  * Xcode identifies every object with 24 hexadecimal characters. Generated
2223
- * ids here are deterministic: the same seed always produces the same id, so
2354
+ * ids here are deterministic. The same seed always produces the same id, so
2224
2355
  * programmatic edits are reproducible and diffs stay minimal across runs.
2225
2356
  * The format is `XX` + the first 20 characters of `md5(seed)` + `XX`, which
2226
2357
  * is a valid identifier that remains recognizable as generated.
@@ -2258,4 +2389,4 @@ declare function buildXcconfig(document: XcconfigDocument): string;
2258
2389
  */
2259
2390
  declare function parseXcconfig(source: string): XcconfigDocument;
2260
2391
  //#endregion
2261
- export { type AddNativeTargetOptions, AggregateTarget, type ApplePlatform, AppleScriptBuildPhase, BuildConfiguration, type BuildConfigurationProperties, BuildFile, BuildFileExceptionSet, type BuildFileProperties, BuildPhase, type BuildPhaseIsa, BuildPhaseMembershipExceptionSet, type BuildPhaseMembershipExceptionSetProperties, type BuildPhaseOf, type BuildPhaseProperties, BuildRule, type BuildRuleProperties, type BuildSettings, BuildStyle, type BuildStyleProperties, BuildableReference, ConfigurationList, type ConfigurationListProperties, ContainerItemProxy, type ContainerItemProxyProperties, CopyFilesBuildPhase, type CopyFilesBuildPhaseProperties, CopyFilesDestination, type CreateXcschemeOptions, ExceptionSet, type ExceptionSetProperties, FileReference, type FileReferenceProperties, FrameworksBuildPhase, Group, type GroupProperties, HeadersBuildPhase, Isa, type IsaValue, LegacyTarget, type LegacyTargetProperties, LocalSwiftPackageReference, type LocalSwiftPackageReferenceProperties, NativeTarget, type NativeTargetProperties, type PbxprojArray, PbxprojBuildError, type PbxprojErrorPosition, type PbxprojObject, PbxprojParseError, type PbxprojValue, ProductType, type ProjectIssue, type ProjectIssueKind, ReferenceProxy, type ReferenceProxyProperties, RemoteSwiftPackageReference, type RemoteSwiftPackageReferenceProperties, ResourcesBuildPhase, RezBuildPhase, RootProject, type RootProjectProperties, ShellScriptBuildPhase, type ShellScriptBuildPhaseProperties, SourcesBuildPhase, SwiftPackageProductDependency, type SwiftPackageProductDependencyProperties, SwiftPackageReference, type SwiftPackageReferenceProperties, SyncRootGroup, type SyncRootGroupProperties, Target, TargetDependency, type TargetDependencyProperties, type TargetProperties, VariantGroup, VersionGroup, type VersionGroupProperties, type ViewByIsa, type ViewOf, Xcconfig, type XcconfigAssignment, type XcconfigBlank, type XcconfigComment, type XcconfigCondition, type XcconfigDocument, type XcconfigInclude, type XcconfigIncludeResolver, XcconfigParseError, type XcconfigSettingsOptions, type XcconfigStatement, XcodeModelError, XcodeObject, XcodeProject, Xcscheme, XcschemeBuildError, type XcschemeComment, type XcschemeDocument, type XcschemeElement, type XcschemeNode, XcschemeParseError, buildPbxproj, buildXcconfig, buildXcscheme, createXcscheme, generateObjectId, isXcschemeElement, parseApplePlatform, parsePbxproj, parseXcconfig, parseXcscheme, xcschemeElements };
2392
+ export { type AddNativeTargetOptions, AggregateTarget, type ApplePlatform, AppleScriptBuildPhase, BuildConfiguration, type BuildConfigurationProperties, BuildFile, BuildFileExceptionSet, type BuildFileProperties, BuildPhase, type BuildPhaseIsa, BuildPhaseMembershipExceptionSet, type BuildPhaseMembershipExceptionSetProperties, type BuildPhaseOf, type BuildPhaseProperties, BuildRule, type BuildRuleProperties, type BuildSettingLookup, type BuildSettingOperator, type BuildSettings, BuildStyle, type BuildStyleProperties, BuildableReference, ConfigurationList, type ConfigurationListProperties, ContainerItemProxy, type ContainerItemProxyProperties, CopyFilesBuildPhase, type CopyFilesBuildPhaseProperties, CopyFilesDestination, type CreateXcschemeOptions, ExceptionSet, type ExceptionSetProperties, type ExpandBuildSettingOptions, FileReference, type FileReferenceProperties, FrameworksBuildPhase, Group, type GroupProperties, HeadersBuildPhase, Isa, type IsaValue, LegacyTarget, type LegacyTargetProperties, LocalSwiftPackageReference, type LocalSwiftPackageReferenceProperties, NativeTarget, type NativeTargetProperties, type PbxprojArray, PbxprojBuildError, type PbxprojErrorPosition, type PbxprojObject, PbxprojParseError, type PbxprojValue, ProductType, type ProjectIssue, type ProjectIssueKind, ReferenceProxy, type ReferenceProxyProperties, RemoteSwiftPackageReference, type RemoteSwiftPackageReferenceProperties, type ResolveBuildSettingOptions, ResourcesBuildPhase, RezBuildPhase, RootProject, type RootProjectProperties, ShellScriptBuildPhase, type ShellScriptBuildPhaseProperties, SourcesBuildPhase, SwiftPackageProductDependency, type SwiftPackageProductDependencyProperties, SwiftPackageReference, type SwiftPackageReferenceProperties, SyncRootGroup, type SyncRootGroupProperties, Target, TargetDependency, type TargetDependencyProperties, type TargetProperties, VariantGroup, VersionGroup, type VersionGroupProperties, type ViewByIsa, type ViewOf, Xcconfig, type XcconfigAssignment, type XcconfigBlank, type XcconfigComment, type XcconfigCondition, type XcconfigDocument, type XcconfigInclude, type XcconfigIncludeResolver, XcconfigParseError, type XcconfigSettingsOptions, type XcconfigStatement, XcodeModelError, XcodeObject, XcodeProject, Xcscheme, XcschemeBuildError, type XcschemeComment, type XcschemeDocument, type XcschemeElement, type XcschemeNode, XcschemeParseError, buildPbxproj, buildXcconfig, buildXcscheme, createXcscheme, expandBuildSettingReferences, generateObjectId, isXcschemeElement, parseApplePlatform, parsePbxproj, parseXcconfig, parseXcscheme, xcschemeElements };