Skip to content

Commit 6166503

Browse files
committed
Update AGENTS.md
1 parent f9b6763 commit 6166503

2 files changed

Lines changed: 52 additions & 50 deletions

File tree

AGENTS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
./CLAUDE.md

CLAUDE.md

Lines changed: 51 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,70 @@
1-
# OpenAttributeGraph Project Guide
1+
# OpenAttributeGraph Guide
22

3-
## Project Overview
4-
OpenAttributeGraph is a Swift package that provides attribute graph functionality, serving as a foundation for OpenSwiftUI project. It interfaces with DarwinPrivateFrameworks for compatibility testing.
3+
OpenAttributeGraph is the Swift package implementation of AttributeGraph-compatible primitives used by OpenSwiftUI. For Darwin compatibility, its Swift-facing implementation is mirrored into `DarwinPrivateFrameworks/AG`, where the private-framework package owns Swift interface generation and xcframework updates.
54

6-
## Development Workflow
5+
## Everyday Workflow
76

8-
### 1. Make Changes and Commit
9-
- Implement your feature or fix
10-
- Format changed Swift files: `Scripts/format-swift.sh`
11-
- Test locally
12-
- Commit changes with descriptive messages
7+
1. Make the code change.
8+
2. Format changed Swift files:
139

14-
### 2. (Optional) Compatibility Testing
15-
If changes affect the interface with DarwinPrivateFrameworks:
16-
```bash
17-
# Generate AG template
18-
Scripts/gen_ag_template.sh
19-
`
20-
# Update code in ../DarwinPrivateFramework from .ag_template
10+
```sh
11+
Scripts/format-swift.sh
12+
```
2113

22-
# Set useLocalDeps to true in Package.swift
23-
xed -l -c 's/let useLocalDeps = envEnable("OPENATTRIBUTEGRAPH_USE_LOCAL_DEPS")/let useLocalDeps = true/' Package.swift
14+
3. Build and test locally:
2415

25-
# Build and test with both compatibility modes:
26-
OPENATTRIBUTEGRAPH_COMPATIBILITY_TEST=0 swift build
27-
OPENATTRIBUTEGRAPH_COMPATIBILITY_TEST=1 swift build
16+
```sh
17+
swift build
18+
swift test
19+
```
20+
21+
4. Commit with a descriptive message.
22+
23+
## DarwinPrivateFrameworks Sync
24+
25+
Run this when changes affect the AttributeGraph Swift API, shim behavior, or Swift files that must be reflected in `DarwinPrivateFrameworks`.
26+
27+
`DarwinPrivateFrameworks` should exist next to this checkout at `../DarwinPrivateFrameworks`. See `../DarwinPrivateFrameworks/CLAUDE.md` and `../DarwinPrivateFrameworks/AG/README.md` for the framework-side build and update details.
28+
29+
Sync only the Swift implementation files:
30+
31+
- Source: `Sources/OpenAttributeGraph/**/*.swift`
32+
- Destination: `../DarwinPrivateFrameworks/AG/DeviceSwiftShims/**/*.swift`
33+
34+
Preserve the relative file layout when syncing. Do not use `.ag_template` as the handoff artifact; `Scripts/gen_ag_template.sh` is legacy for this workflow. Swift interface generation is handled inside DarwinPrivateFrameworks by its AG update scripts.
35+
36+
After syncing the Swift files, update DarwinPrivateFrameworks from that repo:
37+
38+
```sh
39+
cd ../DarwinPrivateFrameworks
40+
swift package update-xcframeworks --allow-writing-to-package-directory
2841
```
2942

30-
### 3. Create DarwinPrivateFramework PR
31-
After testing, discard local changes from step 2:
32-
```bash
33-
# Discard any local testing changes
34-
git checkout -- Package.swift
43+
Then verify this package against the local DarwinPrivateFrameworks checkout:
3544

36-
# Create PR for DarwinPrivateFramework
37-
Scripts/bump_ag_pr.sh <branch-name>
45+
```sh
46+
cd ../OpenAttributeGraph
47+
OPENATTRIBUTEGRAPH_USE_LOCAL_DEPS=1 OPENATTRIBUTEGRAPH_COMPATIBILITY_TEST=1 swift build
3848
```
3949

40-
### 4. Update Dependencies
41-
After the DarwinPrivateFramework PR is merged:
42-
```bash
43-
# Update package dependencies
44-
swift package update DarwinPrivateFramework
50+
Create and merge the DarwinPrivateFrameworks PR before updating this package's resolved dependency:
4551

46-
# Commit the updated Package.resolved
52+
```sh
53+
swift package update DarwinPrivateFrameworks
4754
git add Package.resolved
4855
git commit -m "Update DarwinPrivateFrameworks dependency"
4956
```
5057

51-
### 5. Create Project PR
52-
```bash
53-
# Create PR for the current branch
54-
gh pr create --base main --head <current-branch>
55-
```
58+
## Key Commands
5659

57-
## Key Scripts
58-
- `Scripts/format-swift.sh` - Formats changed Swift files (run before committing)
59-
- `Scripts/gen_ag_template.sh` - Generates AG template for compatibility testing
60-
- `Scripts/bump_ag_pr.sh` - Creates PR for DarwinPrivateFramework updates
60+
- `Scripts/format-swift.sh` - Format changed Swift files.
61+
- `swift build` - Build the normal OpenAttributeGraph implementation.
62+
- `swift test` - Run the normal local test suite.
63+
- `OPENATTRIBUTEGRAPH_USE_LOCAL_DEPS=1 OPENATTRIBUTEGRAPH_COMPATIBILITY_TEST=1 swift build` - Build against sibling `../DarwinPrivateFrameworks`.
64+
- `swift package update DarwinPrivateFrameworks` - Refresh the resolved DarwinPrivateFrameworks dependency after its PR lands.
6165

62-
## Environment Variables
63-
- `OPENATTRIBUTEGRAPH_COMPATIBILITY_TEST=0` - Test without compatibility mode
64-
- `OPENATTRIBUTEGRAPH_COMPATIBILITY_TEST=1` - Test with compatibility mode
66+
## Notes
6567

66-
## Important Notes
67-
- Always test compatibility when changing interfaces
68-
- Ensure DarwinPrivateFramework PR is merged before creating main project PR
69-
- Keep Package.resolved updated after dependency changes
68+
- Keep OpenAttributeGraph implementation changes and DarwinPrivateFrameworks sync changes in separate PRs when both repos need updates.
69+
- Do not manually edit generated Swift interface files in this repo; DarwinPrivateFrameworks owns that generation.
70+
- Prefer environment variables over temporary `Package.swift` edits for local dependency testing.

0 commit comments

Comments
 (0)