-
Notifications
You must be signed in to change notification settings - Fork 152
Add custom Copilot instructions #2785
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
juan-arias
wants to merge
3
commits into
dev
Choose a base branch
from
jarias/custom-copilot-instructions
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,92 @@ | ||
| # Copilot Instructions for MSAL iOS/macOS | ||
|
|
||
| This repository contains the Microsoft Authentication Library (MSAL) for iOS and macOS. It is an Objective-C and Swift SDK that enables applications to authenticate users with Microsoft Entra ID (formerly Azure AD), Microsoft accounts, and Azure AD B2C. | ||
|
|
||
| ## High Level Details | ||
|
|
||
| - **Type**: iOS/macOS SDK (Framework) | ||
| - **Languages**: Objective-C (Core), Swift (Native Auth, Tests) | ||
| - **Platforms**: iOS 16+, macOS 11+, visionOS | ||
| - **Build System**: Xcode (xcodebuild) wrapped by Python scripts | ||
| - **Dependencies**: `IdentityCore` (Git Submodule), `xcpretty` (optional, for unit test logs) | ||
|
|
||
| ## Code Style | ||
|
|
||
| **CRITICAL**: Always adhere to the code style guidelines defined in `.clinerules/04-Code-style-guidelines.md`. | ||
| - Use 4-space indentation. | ||
| - Opening braces MUST be on a NEW line. | ||
| - Do NOT group imports. | ||
| - Check return values, not error variables. | ||
|
|
||
| ## Build and Validation Instructions | ||
|
|
||
| The repository uses a Python script `build.py` to manage build and test operations. | ||
|
|
||
| ### Prerequisites | ||
| 1. **Submodules**: Ensure submodules are initialized. | ||
| ```bash | ||
| git submodule update --init --recursive | ||
| ``` | ||
| 2. **Xcode**: Requires Xcode 15+ (CI uses Xcode 16.2). | ||
| 3. **Tools**: `xcpretty` (optional but recommended for readable logs), `swiftlint` (for native auth). | ||
|
|
||
| ### Build Commands | ||
|
|
||
| **Build all targets:** | ||
| ```bash | ||
| ./build.py | ||
| ``` | ||
|
|
||
| **Build specific target (e.g., iOS Framework):** | ||
| ```bash | ||
| ./build.py --targets iosFramework | ||
| ``` | ||
| *Available targets*: `iosFramework`, `macFramework`, `visionOSFramework`, `iosTestApp`, `sampleIosApp`, `sampleIosAppSwift`. | ||
|
|
||
| ### Test Commands | ||
|
|
||
| **Run Unit Tests (iOS):** | ||
| ```bash | ||
| ./build.py --targets iosFramework | ||
| ``` | ||
|
|
||
| **Run Unit Tests (macOS):** | ||
| ```bash | ||
| ./build.py s macFramework | ||
| ``` | ||
|
|
||
| ## Project Layout and Architecture | ||
|
|
||
| ### Key Directories | ||
| - `MSAL/src/public`: **Public API headers**. All public-facing classes must be here. | ||
| - `MSAL/src/public/ios`: iOS-specific headers. | ||
| - `MSAL/src/public`: iOS & macOS public headers. | ||
| - `MSAL/src/public/configuration`: Configuration classes. | ||
| - `MSAL/src/native_auth`: Native authentication implementation (Swift). | ||
| - `MSAL/IdentityCore`: **Shared Common Code**. This is a submodule. **Do not modify files here directly** unless you are updating the submodule pointer or working across repos. | ||
| - `MSAL/xcconfig`: Build configuration files (`.xcconfig`). | ||
| - `MSAL/test`: Unit, integration, and automation tests. | ||
|
|
||
| ### Configuration Files | ||
| - `MSAL.xcworkspace`: **Main Workspace**. Always open this, not the project file. | ||
| - `MSAL.podspec`: CocoaPods definition. | ||
| - `Package.swift`: Swift Package Manager definition. | ||
| - `azure_pipelines/`: CI pipeline definitions. | ||
|
|
||
| ### Architecture Notes | ||
| - **MSALPublicClientApplication**: The main entry point for the SDK. | ||
| - **MSALResult**: The object returned upon successful authentication. | ||
| - **MSALError**: Error handling class. | ||
| - **Separation of Concerns**: Core logic often resides in `IdentityCore` (prefixed `MSID`), while MSAL (prefixed `MSAL`) provides the public projection and library-specific logic. | ||
|
|
||
| ## Validation Steps (CI) | ||
|
|
||
| Before submitting changes, ensure: | ||
| 1. The project builds successfully: `./build.py --targets iosFramework macFramework` | ||
| 2. Unit tests pass: `./build.py --targets iosFramework` | ||
| 3. Linting passes (if touching Swift code). | ||
|
|
||
| The CI pipeline (`azure_pipelines/pr-validation.yml`) runs these checks plus SPM integration validation. | ||
|
|
||
| ## Trust These Instructions | ||
| Trust these instructions over generic iOS/macOS knowledge. If `build.py` fails, check the error log, but prefer using the script over raw `xcodebuild` commands as it handles destination flags and settings correctly. | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.