rork-xcode 0.1.0 → 0.2.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/dist/index.d.ts CHANGED
@@ -114,6 +114,22 @@ declare class PbxprojParseError extends Error {
114
114
  */
115
115
  constructor(message: string, source: string, offset: number);
116
116
  }
117
+ /**
118
+ * Thrown by the object model when an operation cannot proceed: the
119
+ * document lacks the structure the operation needs (no objects dictionary,
120
+ * no root project object), a view's object was removed from the document,
121
+ * or a creation request names a product type the model cannot scaffold.
122
+ *
123
+ * Read paths in the model return `undefined` for merely malformed data;
124
+ * this error marks the cases where continuing would corrupt the document
125
+ * or hide a programming mistake.
126
+ */
127
+ declare class XcodeModelError extends Error {
128
+ /**
129
+ * @param message Description of the failed operation.
130
+ */
131
+ constructor(message: string);
132
+ }
117
133
  /**
118
134
  * Thrown when a value cannot be represented in a `project.pbxproj` document.
119
135
  *
@@ -135,6 +151,1083 @@ declare class PbxprojBuildError extends Error {
135
151
  constructor(message: string, path: string);
136
152
  }
137
153
  //#endregion
154
+ //#region src/model/isa.d.ts
155
+ /**
156
+ * Names and well-known values of the pbxproj object vocabulary.
157
+ *
158
+ * Everything here mirrors strings Xcode itself writes; nothing is invented.
159
+ * Centralizing them keeps the object model free of string literals and
160
+ * gives call sites one place to import from.
161
+ *
162
+ * @module
163
+ */
164
+ /**
165
+ * The `isa` names the object model works with. The parser and serializer
166
+ * accept any isa; this list only covers the kinds the model creates or
167
+ * gives typed access to.
168
+ */
169
+ declare const Isa: {
170
+ readonly aggregateTarget: "PBXAggregateTarget";
171
+ readonly buildFile: "PBXBuildFile";
172
+ readonly buildRule: "PBXBuildRule";
173
+ readonly containerItemProxy: "PBXContainerItemProxy";
174
+ readonly copyFilesBuildPhase: "PBXCopyFilesBuildPhase";
175
+ readonly fileReference: "PBXFileReference";
176
+ readonly fileSystemSynchronizedBuildFileExceptionSet: "PBXFileSystemSynchronizedBuildFileExceptionSet";
177
+ readonly fileSystemSynchronizedRootGroup: "PBXFileSystemSynchronizedRootGroup";
178
+ readonly frameworksBuildPhase: "PBXFrameworksBuildPhase";
179
+ readonly group: "PBXGroup";
180
+ readonly legacyTarget: "PBXLegacyTarget";
181
+ readonly nativeTarget: "PBXNativeTarget";
182
+ readonly project: "PBXProject";
183
+ readonly referenceProxy: "PBXReferenceProxy";
184
+ readonly resourcesBuildPhase: "PBXResourcesBuildPhase";
185
+ readonly sourcesBuildPhase: "PBXSourcesBuildPhase";
186
+ readonly targetDependency: "PBXTargetDependency";
187
+ readonly variantGroup: "PBXVariantGroup";
188
+ readonly buildConfiguration: "XCBuildConfiguration";
189
+ readonly configurationList: "XCConfigurationList";
190
+ readonly localSwiftPackageReference: "XCLocalSwiftPackageReference";
191
+ readonly remoteSwiftPackageReference: "XCRemoteSwiftPackageReference";
192
+ readonly swiftPackageProductDependency: "XCSwiftPackageProductDependency";
193
+ readonly versionGroup: "XCVersionGroup";
194
+ };
195
+ /**
196
+ * Product type identifiers of the targets the model creates or reasons
197
+ * about. Other product types pass through untouched.
198
+ */
199
+ declare const ProductType: {
200
+ readonly application: "com.apple.product-type.application";
201
+ readonly messagesApplication: "com.apple.product-type.application.messages";
202
+ readonly appExtension: "com.apple.product-type.app-extension";
203
+ readonly messagesExtension: "com.apple.product-type.app-extension.messages";
204
+ readonly extensionKitExtension: "com.apple.product-type.extensionkit-extension";
205
+ readonly onDemandInstallCapableApplication: "com.apple.product-type.application.on-demand-install-capable";
206
+ readonly watchApp: "com.apple.product-type.application.watchapp2";
207
+ };
208
+ /**
209
+ * The Apple platforms the model can resolve a main application target for.
210
+ */
211
+ type ApplePlatform = "ios" | "macos" | "tvos" | "watchos" | "visionos";
212
+ /**
213
+ * `dstSubfolderSpec` values for copy-files build phases, named after the
214
+ * destination each selects.
215
+ */
216
+ declare const CopyFilesDestination: {
217
+ readonly plugins: 13;
218
+ readonly productsDirectory: 16;
219
+ };
220
+ //#endregion
221
+ //#region src/model/doctor.d.ts
222
+ /**
223
+ * The kinds of problem {@link validateProject} reports.
224
+ *
225
+ * - `dangling-root`: the document's `rootObject` is missing or does not
226
+ * resolve to a `PBXProject`.
227
+ * - `missing-isa`: an object carries no kind, which Xcode cannot read.
228
+ * - `dangling-reference`: a known reference property points at an id the
229
+ * document does not contain.
230
+ * - `unreachable-object`: nothing on the path from the root references
231
+ * the object. Xcode ignores such orphans, and
232
+ * {@link pruneOrphanObjects} removes them.
233
+ */
234
+ type ProjectIssueKind = "dangling-root" | "missing-isa" | "dangling-reference" | "unreachable-object";
235
+ /**
236
+ * One problem found by {@link validateProject}.
237
+ */
238
+ interface ProjectIssue {
239
+ /** The problem's kind, one of {@link ProjectIssueKind}. */
240
+ kind: ProjectIssueKind;
241
+ /** Human-readable description with the involved ids and properties. */
242
+ message: string;
243
+ /** The object the problem sits on, when it sits on one. */
244
+ objectId?: string;
245
+ }
246
+ //#endregion
247
+ //#region src/model/properties.d.ts
248
+ /**
249
+ * Build settings of one configuration. The named keys are the ones
250
+ * programmatic edits touch most. Projects carry many more, and all of
251
+ * them stay accessible through the index signature.
252
+ */
253
+ interface BuildSettings extends PbxprojObject {
254
+ ASSETCATALOG_COMPILER_APPICON_NAME?: string;
255
+ CODE_SIGN_ENTITLEMENTS?: string;
256
+ CODE_SIGN_IDENTITY?: string;
257
+ CODE_SIGN_STYLE?: string;
258
+ CURRENT_PROJECT_VERSION?: number | string;
259
+ DEVELOPMENT_TEAM?: string;
260
+ GENERATE_INFOPLIST_FILE?: string;
261
+ INFOPLIST_FILE?: string;
262
+ IPHONEOS_DEPLOYMENT_TARGET?: string;
263
+ LD_RUNPATH_SEARCH_PATHS?: string;
264
+ MACOSX_DEPLOYMENT_TARGET?: string;
265
+ MARKETING_VERSION?: number | string;
266
+ PRODUCT_BUNDLE_IDENTIFIER?: string;
267
+ PRODUCT_NAME?: string;
268
+ PROVISIONING_PROFILE_SPECIFIER?: string;
269
+ SDKROOT?: string;
270
+ SKIP_INSTALL?: string;
271
+ SUPPORTED_PLATFORMS?: string;
272
+ SWIFT_VERSION?: string;
273
+ TARGETED_DEVICE_FAMILY?: number | string;
274
+ TVOS_DEPLOYMENT_TARGET?: string;
275
+ WATCHOS_DEPLOYMENT_TARGET?: string;
276
+ XROS_DEPLOYMENT_TARGET?: string;
277
+ }
278
+ /**
279
+ * Properties shared by every target kind. Native, aggregate, and legacy
280
+ * targets all carry a name, a configuration list, build phases, and
281
+ * dependencies.
282
+ */
283
+ interface TargetProperties extends PbxprojObject {
284
+ buildConfigurationList?: string;
285
+ buildPhases?: string[];
286
+ dependencies?: string[];
287
+ name?: string;
288
+ productName?: string;
289
+ }
290
+ /**
291
+ * Properties of a `PBXNativeTarget`.
292
+ */
293
+ interface NativeTargetProperties extends TargetProperties {
294
+ buildRules?: string[];
295
+ fileSystemSynchronizedGroups?: string[];
296
+ packageProductDependencies?: string[];
297
+ productReference?: string;
298
+ productType?: string;
299
+ }
300
+ /**
301
+ * Properties of a `PBXLegacyTarget`, a target that shells out to an
302
+ * external build tool such as make.
303
+ */
304
+ interface LegacyTargetProperties extends TargetProperties {
305
+ buildArgumentsString?: string;
306
+ buildToolPath?: string;
307
+ buildWorkingDirectory?: string;
308
+ passBuildSettingsInEnvironment?: number;
309
+ }
310
+ /**
311
+ * Properties of a `PBXBuildRule`, a per-target rule mapping a file kind to
312
+ * the compiler or script that processes it.
313
+ */
314
+ interface BuildRuleProperties extends PbxprojObject {
315
+ compilerSpec?: string;
316
+ filePatterns?: string;
317
+ fileType?: string;
318
+ inputFiles?: string[];
319
+ isEditable?: number;
320
+ name?: string;
321
+ outputFiles?: string[];
322
+ runOncePerArchitecture?: number;
323
+ script?: string;
324
+ }
325
+ /**
326
+ * Properties of the root `PBXProject` object.
327
+ */
328
+ interface RootProjectProperties extends PbxprojObject {
329
+ attributes?: PbxprojObject;
330
+ buildConfigurationList?: string;
331
+ developmentRegion?: string;
332
+ knownRegions?: string[];
333
+ mainGroup?: string;
334
+ packageReferences?: string[];
335
+ productRefGroup?: string;
336
+ projectDirPath?: string;
337
+ projectRoot?: string;
338
+ targets?: string[];
339
+ }
340
+ /**
341
+ * Properties of a `PBXGroup` or `PBXVariantGroup`.
342
+ */
343
+ interface GroupProperties extends PbxprojObject {
344
+ children?: string[];
345
+ name?: string;
346
+ path?: string;
347
+ sourceTree?: string;
348
+ }
349
+ /**
350
+ * Properties of an `XCVersionGroup`, the container of a versioned Core
351
+ * Data model (`.xcdatamodeld`). Its children are the model versions and
352
+ * `currentVersion` names the active one.
353
+ */
354
+ interface VersionGroupProperties extends GroupProperties {
355
+ currentVersion?: string;
356
+ versionGroupType?: string;
357
+ }
358
+ /**
359
+ * Properties of a `PBXReferenceProxy`, the stand-in for a product built
360
+ * by a target of another project referenced from this one.
361
+ */
362
+ interface ReferenceProxyProperties extends PbxprojObject {
363
+ fileType?: string;
364
+ name?: string;
365
+ path?: string;
366
+ remoteRef?: string;
367
+ sourceTree?: string;
368
+ }
369
+ /**
370
+ * Properties shared by the `PBX*BuildPhase` kinds. Copy-files and
371
+ * shell-script phases carry the destination and script keys. The standard
372
+ * phases leave them absent.
373
+ */
374
+ interface BuildPhaseProperties extends PbxprojObject {
375
+ buildActionMask?: number;
376
+ dstPath?: string;
377
+ dstSubfolderSpec?: number;
378
+ files?: string[];
379
+ inputFileListPaths?: string[];
380
+ inputPaths?: string[];
381
+ name?: string;
382
+ outputFileListPaths?: string[];
383
+ outputPaths?: string[];
384
+ runOnlyForDeploymentPostprocessing?: number;
385
+ shellPath?: string;
386
+ shellScript?: string;
387
+ }
388
+ /**
389
+ * Properties of a `PBXFileSystemSynchronizedRootGroup`.
390
+ */
391
+ interface SyncRootGroupProperties extends PbxprojObject {
392
+ exceptions?: string[];
393
+ explicitFileTypes?: PbxprojObject;
394
+ explicitFolders?: string[];
395
+ path?: string;
396
+ sourceTree?: string;
397
+ }
398
+ /**
399
+ * Properties of a `PBXFileReference`.
400
+ */
401
+ interface FileReferenceProperties extends PbxprojObject {
402
+ explicitFileType?: string;
403
+ fileEncoding?: number;
404
+ includeInIndex?: number;
405
+ lastKnownFileType?: string;
406
+ name?: string;
407
+ path?: string;
408
+ sourceTree?: string;
409
+ }
410
+ /**
411
+ * Properties of a `PBXBuildFile`.
412
+ */
413
+ interface BuildFileProperties extends PbxprojObject {
414
+ fileRef?: string;
415
+ productRef?: string;
416
+ settings?: PbxprojObject;
417
+ }
418
+ /**
419
+ * Properties of an `XCBuildConfiguration`.
420
+ */
421
+ interface BuildConfigurationProperties extends PbxprojObject {
422
+ baseConfigurationReference?: string;
423
+ buildSettings?: BuildSettings;
424
+ name?: string;
425
+ }
426
+ /**
427
+ * Properties of an `XCConfigurationList`.
428
+ */
429
+ interface ConfigurationListProperties extends PbxprojObject {
430
+ buildConfigurations?: string[];
431
+ defaultConfigurationIsVisible?: number;
432
+ defaultConfigurationName?: string;
433
+ }
434
+ /**
435
+ * Properties of a `PBXTargetDependency`.
436
+ */
437
+ interface TargetDependencyProperties extends PbxprojObject {
438
+ name?: string;
439
+ target?: string;
440
+ targetProxy?: string;
441
+ }
442
+ /**
443
+ * Properties of a `PBXContainerItemProxy`.
444
+ */
445
+ interface ContainerItemProxyProperties extends PbxprojObject {
446
+ containerPortal?: string;
447
+ proxyType?: number;
448
+ remoteGlobalIDString?: string;
449
+ remoteInfo?: string;
450
+ }
451
+ /**
452
+ * Properties of an `XCRemoteSwiftPackageReference` or
453
+ * `XCLocalSwiftPackageReference`. Remote references carry the repository
454
+ * and requirement. Local ones carry the relative path.
455
+ */
456
+ interface SwiftPackageReferenceProperties extends PbxprojObject {
457
+ relativePath?: string;
458
+ repositoryURL?: string;
459
+ requirement?: PbxprojObject;
460
+ }
461
+ /**
462
+ * Properties of an `XCSwiftPackageProductDependency`.
463
+ */
464
+ interface SwiftPackageProductDependencyProperties extends PbxprojObject {
465
+ package?: string;
466
+ productName?: string;
467
+ }
468
+ /**
469
+ * Properties of a `PBXFileSystemSynchronizedBuildFileExceptionSet` or its
470
+ * build-phase-membership variant.
471
+ */
472
+ interface ExceptionSetProperties extends PbxprojObject {
473
+ buildPhase?: string;
474
+ membershipExceptions?: string[];
475
+ target?: string;
476
+ }
477
+ //#endregion
478
+ //#region src/model/target.d.ts
479
+ /**
480
+ * The behavior every target kind shares. A target of any kind carries
481
+ * build configurations and settings, build phases, and dependencies, and
482
+ * this class holds their accessors and mutations. `PBXNativeTarget`,
483
+ * `PBXAggregateTarget`, and `PBXLegacyTarget` all extend it, so code that
484
+ * walks or rewires targets can accept any of them.
485
+ */
486
+ declare class Target<Properties extends TargetProperties = TargetProperties> extends XcodeObject<Properties> {
487
+ /**
488
+ * The target's name, when present.
489
+ */
490
+ get name(): string | undefined;
491
+ /**
492
+ * The views of the target's build configurations, in list order.
493
+ */
494
+ buildConfigurations(): XcodeObject[];
495
+ /**
496
+ * The settings dictionary of the target's default configuration: the one
497
+ * named by the list's `defaultConfigurationName`, falling back to the
498
+ * first configuration. Returns `undefined` when the target has no
499
+ * configurations or the default carries no settings dictionary.
500
+ */
501
+ defaultConfigurationSettings(): PbxprojObject | undefined;
502
+ /**
503
+ * Reads a build setting from the target's default configuration,
504
+ * inheriting from the project-level configuration when the target omits
505
+ * the key. This mirrors how Xcode resolves settings hierarchically;
506
+ * generated app templates set values like `SDKROOT` only at the project
507
+ * level.
508
+ *
509
+ * Only string values are returned; a list- or number-valued setting reads
510
+ * as `undefined`.
511
+ */
512
+ getBuildSetting(key: string): string | undefined;
513
+ /**
514
+ * Writes a build setting on every configuration of the target, so Debug
515
+ * and Release stay consistent.
516
+ */
517
+ setBuildSetting(key: string, value: string): void;
518
+ /**
519
+ * Removes a build setting from every configuration of the target.
520
+ */
521
+ removeBuildSetting(key: string): void;
522
+ /**
523
+ * The views of the target's dependency objects
524
+ * (`PBXTargetDependency`), in declaration order. Resolve a dependency's
525
+ * target through its `target` property.
526
+ */
527
+ dependencies(): XcodeObject[];
528
+ /**
529
+ * The views of the target's build phases, in build order.
530
+ */
531
+ buildPhases(): BuildPhase[];
532
+ /**
533
+ * Finds the target's first build phase with the given isa, and, when
534
+ * `name` is provided, the given display name.
535
+ */
536
+ findBuildPhase(isa: string, name?: string): BuildPhase | undefined;
537
+ /**
538
+ * Returns the target's build phase with the given isa and properties,
539
+ * creating and appending it when missing. The properties apply only on
540
+ * creation; an existing phase is returned as is.
541
+ *
542
+ * The match key is the isa plus the `name` property when one is given,
543
+ * so differently named copy-files phases coexist.
544
+ */
545
+ ensureBuildPhase(isa: string, properties?: PbxprojObject): BuildPhase;
546
+ /**
547
+ * The target's shell-script phase with the given name, created with the
548
+ * usual defaults (`/bin/sh`, empty input and output lists) when missing.
549
+ * The script and other properties apply only on creation.
550
+ *
551
+ * @param name Display name of the phase, which is also its match key.
552
+ * @param properties Phase properties, most usefully `shellScript`.
553
+ */
554
+ ensureShellScriptPhase(name: string, properties?: PbxprojObject): BuildPhase;
555
+ /**
556
+ * Adds a dependency on another target of the same project, wiring the
557
+ * `PBXContainerItemProxy` and `PBXTargetDependency` pair Xcode uses to
558
+ * express it. Adding an existing dependency is a no-op.
559
+ *
560
+ * @returns The view of the target dependency object.
561
+ */
562
+ addDependency(dependency: Target): XcodeObject;
563
+ }
564
+ /**
565
+ * A `PBXNativeTarget` is a product the project compiles and packages
566
+ * itself, such as an application or an app extension.
567
+ */
568
+ declare class NativeTarget extends Target<NativeTargetProperties> {
569
+ /**
570
+ * The target's product type identifier, for example
571
+ * `com.apple.product-type.application`.
572
+ */
573
+ get productType(): string | undefined;
574
+ /**
575
+ * Rewrites the target's product type. Used by packaging repairs that
576
+ * convert foundation extensions into ExtensionKit extensions.
577
+ */
578
+ set productType(value: string);
579
+ /**
580
+ * The view of the target's product file reference, when the target has
581
+ * one.
582
+ */
583
+ get productReference(): XcodeObject | undefined;
584
+ /**
585
+ * Whether the target builds for watchOS, decided by its product type or
586
+ * its watchOS deployment-target setting.
587
+ */
588
+ isWatchOS(): boolean;
589
+ /**
590
+ * The views of the target's Swift package product dependencies, in
591
+ * declaration order.
592
+ */
593
+ packageProductDependencies(): XcodeObject[];
594
+ /**
595
+ * The views of the target's file-system-synchronized folders, in
596
+ * declaration order.
597
+ */
598
+ syncGroups(): SyncRootGroup[];
599
+ /**
600
+ * The views of the target's build rules, in evaluation order. Empty for
601
+ * targets without custom rules, which is nearly all of them.
602
+ */
603
+ buildRules(): BuildRule[];
604
+ /**
605
+ * The target's sources phase, created when missing.
606
+ */
607
+ ensureSourcesPhase(): BuildPhase;
608
+ /**
609
+ * The target's frameworks phase, created when missing.
610
+ */
611
+ ensureFrameworksPhase(): BuildPhase;
612
+ /**
613
+ * The target's resources phase, created when missing.
614
+ */
615
+ ensureResourcesPhase(): BuildPhase;
616
+ /**
617
+ * Embeds another target's product into this target through the
618
+ * copy-files phase its product type calls for ("Embed Foundation
619
+ * Extensions", "Embed App Clips", "Embed Watch Content", or "Embed
620
+ * ExtensionKit Extensions").
621
+ *
622
+ * An existing phase with the same name is reused, its destination is
623
+ * repaired to the type's canonical values, and the product's build file
624
+ * is deduplicated, so embedding is idempotent.
625
+ *
626
+ * @returns The view of the embed phase, or `undefined` when the embedded
627
+ * target has no product reference to embed.
628
+ */
629
+ embed(extension: NativeTarget): BuildPhase | undefined;
630
+ /**
631
+ * The on-disk folder paths of the file-system-synchronized groups linked
632
+ * to this target. Empty for targets without synchronized folders
633
+ * (projects predating Xcode 16).
634
+ */
635
+ syncGroupPaths(): string[];
636
+ /**
637
+ * Creates a file-system-synchronized folder for an on-disk path, links it
638
+ * to this target, and registers it in the project's main group so Xcode
639
+ * shows it in the navigator. When the target already links a folder with
640
+ * the same path, that folder is returned instead, so re-running a
641
+ * scaffold step cannot duplicate groups.
642
+ *
643
+ * @param path Folder path relative to the project root, for example the
644
+ * target's name.
645
+ * @returns The view of the target's synchronized folder for the path.
646
+ */
647
+ addSyncGroup(path: string): SyncRootGroup;
648
+ /**
649
+ * Links a Swift package product to this target. It creates the
650
+ * `XCSwiftPackageProductDependency`, registers it on the target, and
651
+ * ensures the frameworks phase carries its build file. Linking an
652
+ * already linked product is a no-op.
653
+ *
654
+ * @param options.productName The product to link, as the package
655
+ * manifest names it.
656
+ * @param options.packageReference The package reference view returned by
657
+ * {@link XcodeProject.addSwiftPackage} or
658
+ * {@link XcodeProject.findSwiftPackage}.
659
+ * @returns The view of the product dependency.
660
+ */
661
+ addSwiftPackageProduct(options: {
662
+ productName: string;
663
+ packageReference: XcodeObject;
664
+ }): XcodeObject;
665
+ /**
666
+ * Links a system framework (for example `Messages`) to this target. It
667
+ * reuses or creates the file reference under the SDK's frameworks
668
+ * directory and makes sure the frameworks phase carries its build file.
669
+ * Linking an already linked framework is a no-op.
670
+ *
671
+ * @param name Framework name without the `.framework` suffix.
672
+ * @returns The view of the framework's file reference.
673
+ */
674
+ addSystemFramework(name: string): XcodeObject;
675
+ }
676
+ /**
677
+ * An aggregate target produces nothing itself. It exists to group other
678
+ * targets through its dependencies and to run script or copy-files
679
+ * phases, and the shared target surface covers everything it carries.
680
+ */
681
+ declare class AggregateTarget extends Target {}
682
+ /**
683
+ * A legacy target shells out to an external build tool such as make
684
+ * instead of using Xcode's build system.
685
+ */
686
+ declare class LegacyTarget extends Target<LegacyTargetProperties> {
687
+ /**
688
+ * The build tool the target invokes, as an absolute path.
689
+ */
690
+ get buildToolPath(): string | undefined;
691
+ /**
692
+ * The arguments passed to the build tool, as one shell-style string.
693
+ */
694
+ get buildArgumentsString(): string | undefined;
695
+ /**
696
+ * The working directory the build tool runs in, when the target sets
697
+ * one.
698
+ */
699
+ get buildWorkingDirectory(): string | undefined;
700
+ }
701
+ //#endregion
702
+ //#region src/model/objects.d.ts
703
+ /**
704
+ * A `PBXGroup` is a folder in Xcode's navigator, holding references to
705
+ * files and other groups. Variant groups (`PBXVariantGroup`) share this
706
+ * view. The type parameter lets subclasses carry a more specific property
707
+ * shape.
708
+ */
709
+ declare class Group<Properties extends GroupProperties = GroupProperties> extends XcodeObject<Properties> {
710
+ /**
711
+ * Ids of the group's children, in navigator order. Non-string entries of
712
+ * a malformed document are skipped.
713
+ */
714
+ get childIds(): string[];
715
+ /**
716
+ * The views of the group's children, in navigator order.
717
+ */
718
+ children(): XcodeObject[];
719
+ /**
720
+ * Adds an existing object (a file reference or another group) to the end
721
+ * of the group's children. Adding a child the group already lists is a
722
+ * no-op.
723
+ */
724
+ addChild(child: XcodeObject): void;
725
+ /**
726
+ * Returns the descendant group for a `/`-separated path, creating any
727
+ * missing groups along the way. Each component matches a child group by
728
+ * its `path`, falling back to its `name`; created groups carry the
729
+ * component as their `path` so they mirror folders on disk.
730
+ *
731
+ * ```ts
732
+ * const generated = mainGroup.ensureGroup("Sources/Generated");
733
+ * generated.createFile("Config.swift");
734
+ * ```
735
+ */
736
+ ensureGroup(path: string): Group;
737
+ /**
738
+ * Creates a `PBXFileReference` for a path relative to this group and adds
739
+ * it to the group's children.
740
+ *
741
+ * The reference's `lastKnownFileType` derives from the file extension
742
+ * when it is a known kind; otherwise the reference carries no type and
743
+ * Xcode re-derives one on open.
744
+ *
745
+ * @param path File path relative to the group, for example
746
+ * `Demo/Config.swift`.
747
+ * @returns The view of the created file reference.
748
+ */
749
+ createFile(path: string): XcodeObject;
750
+ }
751
+ /**
752
+ * A build phase is an ordered list of build files processed by one step
753
+ * of a target's build. Every `PBX*BuildPhase` kind shares this view.
754
+ */
755
+ declare class BuildPhase extends XcodeObject<BuildPhaseProperties> {
756
+ /**
757
+ * The phase's display name, when it carries an explicit one. Xcode names
758
+ * copy-files and shell-script phases; the standard phases derive their
759
+ * names from their isa.
760
+ */
761
+ get name(): string | undefined;
762
+ /**
763
+ * Ids of the phase's `PBXBuildFile` entries, in build order.
764
+ */
765
+ get buildFileIds(): string[];
766
+ /**
767
+ * Whether the phase already lists the build file.
768
+ */
769
+ containsBuildFile(buildFileId: string): boolean;
770
+ /**
771
+ * Appends an existing build file to the phase unless it is already
772
+ * listed.
773
+ */
774
+ appendBuildFile(buildFileId: string): void;
775
+ /**
776
+ * Removes a build file from the phase. Removing an id the phase does not
777
+ * list is a no-op.
778
+ */
779
+ removeBuildFile(buildFileId: string): void;
780
+ /**
781
+ * Ensures the phase carries a `PBXBuildFile` for the referenced object,
782
+ * creating one when no existing build file in this phase points at it.
783
+ *
784
+ * @param reference The file reference or package product the build file
785
+ * should point at.
786
+ * @param options.referenceKey Which build-file field carries the
787
+ * reference: `fileRef` for file references (the default) or
788
+ * `productRef` for Swift package products.
789
+ * @param options.settings Optional per-file settings, for example
790
+ * `{ ATTRIBUTES: ["RemoveHeadersOnCopy"] }`.
791
+ * @returns The view of the phase's build file for the reference.
792
+ */
793
+ ensureBuildFile(reference: XcodeObject, options?: {
794
+ referenceKey?: "fileRef" | "productRef";
795
+ settings?: Record<string, string[] | string>;
796
+ }): XcodeObject;
797
+ }
798
+ /**
799
+ * A `PBXFileSystemSynchronizedRootGroup` is an Xcode 16 folder whose
800
+ * members are synchronized from disk instead of listed individually.
801
+ */
802
+ declare class SyncRootGroup extends XcodeObject<SyncRootGroupProperties> {
803
+ /**
804
+ * The group's on-disk folder path, when present.
805
+ */
806
+ get path(): string | undefined;
807
+ /**
808
+ * Excludes files from a target's membership in this synchronized folder
809
+ * through a `PBXFileSystemSynchronizedBuildFileExceptionSet` linked into
810
+ * the group's exceptions.
811
+ *
812
+ * Xcode keeps one exception set per target and folder, so when this
813
+ * group already carries a set for the target, the file names merge into
814
+ * it instead of creating a second set; names already excluded are not
815
+ * duplicated.
816
+ *
817
+ * The standard use is keeping a scaffolded `Info.plist` from being
818
+ * double-copied: the build already processes it through the target's
819
+ * `INFOPLIST_FILE` setting.
820
+ *
821
+ * @param target The target whose membership the exceptions restrict.
822
+ * @param membershipExceptions File names inside the folder to exclude.
823
+ * @returns The view of the target's exception set for this folder.
824
+ */
825
+ addMembershipExceptions(target: NativeTarget, membershipExceptions: string[]): XcodeObject;
826
+ }
827
+ /**
828
+ * A `PBXBuildRule` tells a target which compiler or script processes a
829
+ * kind of file.
830
+ */
831
+ declare class BuildRule extends XcodeObject<BuildRuleProperties> {
832
+ /**
833
+ * The rule's script, when it is a script rule rather than a reference
834
+ * to a compiler specification.
835
+ */
836
+ get script(): string | undefined;
837
+ }
838
+ /**
839
+ * An `XCVersionGroup` contains a versioned Core Data model
840
+ * (`.xcdatamodeld`). Its children are the model versions and
841
+ * `currentVersion` names the active one.
842
+ */
843
+ declare class VersionGroup extends Group<VersionGroupProperties> {
844
+ /**
845
+ * The view of the active model version's file reference, when the group
846
+ * names one.
847
+ */
848
+ currentVersion(): XcodeObject | undefined;
849
+ /**
850
+ * Makes a model version the active one, adding it to the group's
851
+ * children when it is not listed yet.
852
+ */
853
+ setCurrentVersion(reference: XcodeObject): void;
854
+ }
855
+ /**
856
+ * A `PBXReferenceProxy` stands in for a product built by a target of
857
+ * another project referenced from this one.
858
+ */
859
+ declare class ReferenceProxy extends XcodeObject<ReferenceProxyProperties> {
860
+ /**
861
+ * The proxy's product path inside the other project's build directory,
862
+ * when present.
863
+ */
864
+ get path(): string | undefined;
865
+ /**
866
+ * The view of the container item proxy that names the remote target,
867
+ * when the reference resolves.
868
+ */
869
+ remoteReference(): XcodeObject | undefined;
870
+ }
871
+ //#endregion
872
+ //#region src/model/project.d.ts
873
+ /**
874
+ * The `PBXProject` object at the document root. It owns the target list,
875
+ * the main group, and the project-level configurations.
876
+ */
877
+ declare class RootProject extends XcodeObject<RootProjectProperties> {
878
+ /**
879
+ * Ids of the project's targets, in project order.
880
+ */
881
+ targetIds(): string[];
882
+ /**
883
+ * The view of the project's main group, when the document has one. The
884
+ * main group is the root of Xcode's navigator tree.
885
+ */
886
+ mainGroup(): Group | undefined;
887
+ /**
888
+ * The settings dictionary of the project-level default configuration.
889
+ * Targets inherit from these settings; see
890
+ * {@link NativeTarget.getBuildSetting}.
891
+ */
892
+ defaultConfigurationSettings(): PbxprojObject | undefined;
893
+ /**
894
+ * The views of the project's Swift package references, remote and local,
895
+ * in declaration order.
896
+ */
897
+ packageReferences(): XcodeObject[];
898
+ /**
899
+ * The group product references live in, creating it (and registering it
900
+ * as the project's `productRefGroup`) when missing.
901
+ */
902
+ ensureProductsGroup(): Group;
903
+ }
904
+ /**
905
+ * Options for {@link XcodeProject.addNativeTarget}.
906
+ */
907
+ interface AddNativeTargetOptions {
908
+ /** Target name, also used as the product name. */
909
+ name: string;
910
+ /**
911
+ * Product type identifier. Must be one of the creatable kinds:
912
+ * applications, app extensions, their Messages variants, watch
913
+ * applications, App Clips, and ExtensionKit extensions.
914
+ */
915
+ productType: string;
916
+ /**
917
+ * Build settings applied to every created configuration. Each
918
+ * configuration receives its own copy.
919
+ */
920
+ buildSettings?: Record<string, number | string>;
921
+ /**
922
+ * Names of the configurations to create. Defaults to `Debug` and
923
+ * `Release`, matching the pair Xcode scaffolds.
924
+ */
925
+ configurationNames?: string[];
926
+ /**
927
+ * The configuration name recorded as the list's default. Defaults to
928
+ * `Release`.
929
+ */
930
+ defaultConfigurationName?: string;
931
+ }
932
+ /**
933
+ * A parsed `project.pbxproj` with typed, mutable access to its objects.
934
+ *
935
+ * ```ts
936
+ * const project = XcodeProject.parse(pbxprojText);
937
+ * const app = project.findMainAppTarget("ios");
938
+ * app?.setBuildSetting("MARKETING_VERSION", "1.2.0");
939
+ * const text = project.build();
940
+ * ```
941
+ */
942
+ declare class XcodeProject {
943
+ /** The parsed document this model wraps. */
944
+ readonly document: PbxprojObject;
945
+ /** The document's `objects` dictionary. */
946
+ private readonly objectsDictionary;
947
+ /**
948
+ * Identity map of object views, one view per id, created on first
949
+ * access, so views of the same object compare with `===`.
950
+ */
951
+ private readonly views;
952
+ private constructor();
953
+ /**
954
+ * Parses pbxproj text and wraps it in a model.
955
+ *
956
+ * @throws PbxprojParseError when the text is malformed.
957
+ * @throws XcodeModelError when the document has no objects dictionary.
958
+ */
959
+ static parse(text: string): XcodeProject;
960
+ /**
961
+ * Wraps an already parsed document in a model. The document is used in
962
+ * place, not copied; model mutations write into it.
963
+ */
964
+ static fromDocument(document: PbxprojObject): XcodeProject;
965
+ /**
966
+ * Serializes the current document state to pbxproj text in Xcode's
967
+ * canonical layout.
968
+ */
969
+ build(): string;
970
+ /**
971
+ * The raw properties dictionary of an object.
972
+ *
973
+ * @throws XcodeModelError when no object with the id exists; views use
974
+ * this accessor, so a view of a deleted object fails loudly instead of
975
+ * resurrecting the entry.
976
+ */
977
+ propertiesOf(id: string): PbxprojObject;
978
+ /**
979
+ * The raw properties dictionary of an object, or `undefined` when the id
980
+ * is absent, dangling, or not a dictionary.
981
+ */
982
+ propertiesOfOptional(id: string | undefined): PbxprojObject | undefined;
983
+ /**
984
+ * The view of an object by id, or `undefined` when the id is absent or
985
+ * its entry is not a dictionary. Repeated lookups return the same view
986
+ * instance.
987
+ */
988
+ get(id: string | undefined): XcodeObject | undefined;
989
+ /**
990
+ * Iterates `[id, view]` over every well-formed object in the document,
991
+ * in document order. Entries that are not dictionaries are skipped.
992
+ */
993
+ objects(): IterableIterator<[string, XcodeObject]>;
994
+ /**
995
+ * Generates a deterministic 24-character id from a seed, avoiding every
996
+ * id the document currently contains. The id is not reserved; adding an
997
+ * object with it (see {@link add}) is what claims it.
998
+ */
999
+ generateId(seed: string): string;
1000
+ /**
1001
+ * Adds an object to the document and returns its view.
1002
+ *
1003
+ * @param isa The object's kind; written as the `isa` property.
1004
+ * @param properties The object's remaining properties. The dictionary is
1005
+ * stored as passed (not copied), with `isa` written first so the
1006
+ * serialized entry leads with it.
1007
+ * @param seed Seed for the deterministic id; defaults to the isa, which
1008
+ * is only sensible for singleton objects.
1009
+ * @returns The view of the created object.
1010
+ */
1011
+ add(isa: string, properties: PbxprojObject, seed?: string): XcodeObject;
1012
+ /**
1013
+ * The view of the document's root `PBXProject` object.
1014
+ *
1015
+ * @throws XcodeModelError when `rootObject` is missing or dangling,
1016
+ * since without it no project-level operation is meaningful.
1017
+ */
1018
+ get rootProject(): RootProject;
1019
+ /**
1020
+ * The views of the project's targets of every kind (native, aggregate,
1021
+ * and legacy), in project order.
1022
+ */
1023
+ targets(): Target[];
1024
+ /**
1025
+ * The views of the project's native targets, in project order. Targets
1026
+ * of other kinds (aggregate and legacy targets) are not included.
1027
+ */
1028
+ nativeTargets(): NativeTarget[];
1029
+ /**
1030
+ * Finds a native target by name.
1031
+ */
1032
+ findTarget(name: string): NativeTarget | undefined;
1033
+ /**
1034
+ * Finds the main application target for a platform. It prefers the
1035
+ * application target whose own configurations carry the platform's
1036
+ * deployment-target key, and falls back to the first application target
1037
+ * in project order. Returns `undefined` when the project has no
1038
+ * application target.
1039
+ */
1040
+ findMainAppTarget(platform?: ApplePlatform): NativeTarget | undefined;
1041
+ /**
1042
+ * Creates a native target with its build configurations, product file
1043
+ * reference in the Products group, and the standard Sources, Frameworks,
1044
+ * and Resources build phases, and registers it on the project.
1045
+ *
1046
+ * @throws XcodeModelError for product types the model cannot create a
1047
+ * product reference for; see {@link AddNativeTargetOptions.productType}.
1048
+ */
1049
+ addNativeTarget(options: AddNativeTargetOptions): NativeTarget;
1050
+ /**
1051
+ * Finds the remote Swift package reference for a repository URL.
1052
+ */
1053
+ findSwiftPackage(repositoryUrl: string): XcodeObject | undefined;
1054
+ /**
1055
+ * Adds a remote Swift package reference and registers it on the project.
1056
+ * When the project already references the repository, the existing
1057
+ * reference is returned unchanged, requirement included; adjust an
1058
+ * existing requirement through the reference's properties. Link products
1059
+ * to targets with {@link NativeTarget.addSwiftPackageProduct}.
1060
+ *
1061
+ * @param options.repositoryURL The package's git URL.
1062
+ * @param options.requirement The version requirement dictionary as Xcode
1063
+ * stores it, for example
1064
+ * `{ kind: "upToNextMajorVersion", minimumVersion: "5.0.0" }`.
1065
+ * @returns The view of the package reference for the repository.
1066
+ */
1067
+ addSwiftPackage(options: {
1068
+ repositoryURL: string;
1069
+ requirement: Record<string, string>;
1070
+ }): XcodeObject;
1071
+ /**
1072
+ * Finds the local Swift package reference for a directory path.
1073
+ */
1074
+ findLocalSwiftPackage(relativePath: string): XcodeObject | undefined;
1075
+ /**
1076
+ * Adds a local (path-based) Swift package reference and registers it on
1077
+ * the project, returning the existing reference when the path is already
1078
+ * registered. Products link to targets the same way as remote packages,
1079
+ * through {@link NativeTarget.addSwiftPackageProduct}.
1080
+ *
1081
+ * @param relativePath The package directory, relative to the project.
1082
+ * @returns The view of the package reference for the path.
1083
+ */
1084
+ addLocalSwiftPackage(relativePath: string): XcodeObject;
1085
+ /**
1086
+ * The views of every `PBXBuildFile` that points at the referenced object
1087
+ * through `fileRef` or `productRef`. Useful for relocating a product
1088
+ * between copy phases.
1089
+ */
1090
+ buildFilesReferencing(reference: XcodeObject): XcodeObject[];
1091
+ /**
1092
+ * Validates the document's object graph and returns every problem
1093
+ * found. An empty array means the graph is structurally sound. The
1094
+ * checks cover the root object, object kinds, known references, and
1095
+ * reachability.
1096
+ */
1097
+ validate(): ProjectIssue[];
1098
+ /**
1099
+ * Removes every object unreachable from the root object and returns the
1100
+ * removed ids. Reachability is conservative. Any real reference keeps
1101
+ * an object alive, even through properties outside the known schema.
1102
+ */
1103
+ pruneOrphans(): string[];
1104
+ /**
1105
+ * The views of every object that references the id anywhere in its
1106
+ * properties. A reference is a string property naming the id, an id
1107
+ * list containing it, or a nested dictionary carrying it as a key or
1108
+ * string value.
1109
+ *
1110
+ * The scan is linear over the document; removal flows call it once per
1111
+ * removed object, which keeps teardown proportional to what is actually
1112
+ * removed.
1113
+ */
1114
+ referrersOf(id: string): XcodeObject[];
1115
+ /**
1116
+ * Removes an object from the document and strips every reference to it
1117
+ * from the remaining objects. String properties naming the id are
1118
+ * deleted, id lists drop it, and nested dictionaries keyed by object id
1119
+ * (such as `TargetAttributes`) drop its entry.
1120
+ *
1121
+ * Removing an id the document does not contain is a no-op. This is the
1122
+ * low-level removal; {@link removeTarget} composes it into a full
1123
+ * teardown.
1124
+ */
1125
+ removeObject(id: string): void;
1126
+ /**
1127
+ * Removes a target and everything that exists only for its sake. That
1128
+ * covers its build phases and their build files, its configuration list
1129
+ * and configurations, its product reference and the build files
1130
+ * embedding it, dependency objects and container proxies in both
1131
+ * directions (other targets' dependencies on it, and its own
1132
+ * dependencies on others), its membership exception sets, and
1133
+ * synchronized folders no remaining target links.
1134
+ *
1135
+ * On-disk sources are untouched; the removal is document-only, like
1136
+ * deleting a target in Xcode and keeping its folder.
1137
+ *
1138
+ * @throws XcodeModelError when the target belongs to another project,
1139
+ * since removing by another document's ids would tear down unrelated
1140
+ * objects that happen to share them.
1141
+ */
1142
+ removeTarget(target: Target): void;
1143
+ /**
1144
+ * Finds a file reference by its project-relative path, resolving each
1145
+ * reference's location through the group tree from the main group
1146
+ * (nested group `path` components join with `/`).
1147
+ *
1148
+ * Members of file-system-synchronized folders are not listed in the
1149
+ * document and therefore cannot be found; check
1150
+ * {@link NativeTarget.syncGroupPaths} for folder-level containment
1151
+ * instead.
1152
+ */
1153
+ findFileReference(projectRelativePath: string): XcodeObject | undefined;
1154
+ /**
1155
+ * Creates the typed view for an object, dispatching on its isa. Objects
1156
+ * outside the typed vocabulary get the generic base view.
1157
+ */
1158
+ private createView;
1159
+ }
1160
+ //#endregion
1161
+ //#region src/model/object.d.ts
1162
+ /**
1163
+ * A typed handle on one object of the document.
1164
+ *
1165
+ * Two lookups of the same id return the same view instance (the project
1166
+ * keeps an identity map), so views compare with `===`.
1167
+ *
1168
+ * The type parameter describes the properties of a well-formed object of
1169
+ * this kind. Subclasses fix it to their kind's interface, which gives
1170
+ * `properties` autocompletion. Treat the shape as a description rather
1171
+ * than a guarantee. A malformed document can hold anything, so the model
1172
+ * itself always reads through the narrowing accessors.
1173
+ */
1174
+ declare class XcodeObject<Properties extends PbxprojObject = PbxprojObject> {
1175
+ /** The project this object belongs to. */
1176
+ readonly project: XcodeProject;
1177
+ /** The object's 24-character identifier (its key in `objects`). */
1178
+ readonly id: string;
1179
+ /**
1180
+ * Views are created by the project's identity map; use
1181
+ * {@link XcodeProject.get} or a typed query instead of constructing
1182
+ * views directly.
1183
+ */
1184
+ constructor(project: XcodeProject, id: string);
1185
+ /**
1186
+ * The object's raw dictionary inside the document. Mutations through the
1187
+ * model write here, and direct writes are equally valid; the model adds
1188
+ * no caching over these properties.
1189
+ *
1190
+ * The typed shape is asserted, not checked. It describes what a
1191
+ * well-formed object of this kind carries (see `properties.ts`).
1192
+ */
1193
+ get properties(): Properties;
1194
+ /**
1195
+ * The object's `isa` kind name, or the empty string when the field is
1196
+ * missing or malformed.
1197
+ */
1198
+ get isa(): string;
1199
+ /**
1200
+ * Reads a property expected to be a string. Returns `undefined` when the
1201
+ * property is absent or holds another type.
1202
+ */
1203
+ getString(key: string): string | undefined;
1204
+ /**
1205
+ * Writes one property of the object.
1206
+ *
1207
+ * The write goes through the untyped document dictionary. TypeScript
1208
+ * does not allow writes through a generic index, and the typed shape on
1209
+ * `properties` is descriptive anyway.
1210
+ */
1211
+ set(key: string, value: PbxprojValue): void;
1212
+ /**
1213
+ * The views of the objects referenced by an id-list property, resolved in
1214
+ * list order. Dangling ids and non-string entries of malformed documents
1215
+ * are skipped.
1216
+ */
1217
+ protected referencedViews(key: string): XcodeObject[];
1218
+ /**
1219
+ * Removes the object from the document and strips every reference to it:
1220
+ * string properties naming the id are deleted, id lists drop it, and
1221
+ * nested dictionaries keyed by object id (such as the root project's
1222
+ * `TargetAttributes`) drop its entry.
1223
+ *
1224
+ * This is the low-level removal; it does not cascade to objects that only
1225
+ * made sense alongside this one. Higher-level operations like
1226
+ * {@link XcodeProject.removeTarget} compose it into full teardowns.
1227
+ */
1228
+ removeFromProject(): void;
1229
+ }
1230
+ //#endregion
138
1231
  //#region src/parse.d.ts
139
1232
  /**
140
1233
  * Parses a `project.pbxproj` document into JavaScript values.
@@ -152,4 +1245,31 @@ declare class PbxprojBuildError extends Error {
152
1245
  */
153
1246
  declare function parsePbxproj(text: string): PbxprojValue;
154
1247
  //#endregion
155
- export { type PbxprojArray, PbxprojBuildError, type PbxprojErrorPosition, type PbxprojObject, PbxprojParseError, type PbxprojValue, buildPbxproj, parsePbxproj };
1248
+ //#region src/uuid.d.ts
1249
+ /**
1250
+ * Deterministic object identifiers for generated pbxproj objects.
1251
+ *
1252
+ * Xcode identifies every object with 24 hexadecimal characters. Generated
1253
+ * ids here are deterministic: the same seed always produces the same id, so
1254
+ * programmatic edits are reproducible and diffs stay minimal across runs.
1255
+ * The format is `XX` + the first 20 characters of `md5(seed)` + `XX`, which
1256
+ * is a valid identifier that remains recognizable as generated.
1257
+ *
1258
+ * @module
1259
+ */
1260
+ /**
1261
+ * Generates a deterministic 24-character object id from a seed string.
1262
+ *
1263
+ * When the id already exists in `existing`, the seed is retried with a
1264
+ * space appended until it is free, so ids stay deterministic (the same
1265
+ * seeds in the same order produce the same ids) while never colliding
1266
+ * within a document.
1267
+ *
1268
+ * @param seed Any text that identifies the object being created, for
1269
+ * example `PBXNativeTarget DemoWidget`.
1270
+ * @param existing Ids already present in the document.
1271
+ * @returns An id not contained in `existing`; the caller records it.
1272
+ */
1273
+ declare function generateObjectId(seed: string, existing: ReadonlySet<string>): string;
1274
+ //#endregion
1275
+ export { type AddNativeTargetOptions, AggregateTarget, type ApplePlatform, type BuildConfigurationProperties, type BuildFileProperties, BuildPhase, type BuildPhaseProperties, BuildRule, type BuildRuleProperties, type BuildSettings, type ConfigurationListProperties, type ContainerItemProxyProperties, CopyFilesDestination, type ExceptionSetProperties, type FileReferenceProperties, Group, type GroupProperties, Isa, LegacyTarget, type LegacyTargetProperties, NativeTarget, type NativeTargetProperties, type PbxprojArray, PbxprojBuildError, type PbxprojErrorPosition, type PbxprojObject, PbxprojParseError, type PbxprojValue, ProductType, type ProjectIssue, type ProjectIssueKind, ReferenceProxy, type ReferenceProxyProperties, RootProject, type RootProjectProperties, type SwiftPackageProductDependencyProperties, type SwiftPackageReferenceProperties, SyncRootGroup, type SyncRootGroupProperties, Target, type TargetDependencyProperties, type TargetProperties, VersionGroup, type VersionGroupProperties, XcodeModelError, XcodeObject, XcodeProject, buildPbxproj, generateObjectId, parsePbxproj };