Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
111 changes: 111 additions & 0 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
# Project details
F# 9
C# 13
.NET 8 and 9
Nullability checks enabled

## Libraries we use

If you need any source code you can find it in the following repositories:
[FParsec](https://github.com/stephan-tolksdorf/fparsec) `master` branch
[XParsec](https://github.com/roboz0r/XParsec/) `main` branch
[FSharp.Control.Reactive](https://github.com/fsprojects/FSharp.Control.Reactive) `master` branch
[FSharp.Data.TypeProviders](https://github.com/fsprojects/FSharp.Data.TypeProviders) `main` branch
[FSharp.SystemTextJson](https://github.com/Tarmil/FSharp.SystemTextJson.git) `master` branch
[Oxpecker](https://github.com/Lanayx/Oxpecker.git) `main` branch

# How to work with tests

If you work with tests, then do not build the whole solution as it is large and the build happens very slow.
Always try running tests with `--no-build` switch first to speedup execution.
Instead run the tests individually or the whole test project.
`CollectionAssert` cannot work with F# lists, only with F# array syntax

# Code Style and Standards

We prefer the latest F# 9 features over the old syntax

Prefer `voption` over `option`

Prefer `task` CE over `async` CE

This is how you define a non-default F# class constructor:
```fsharp
type DerivedClass =
inherit BaseClass

new (``arguments here``) as ``created object``
=
// create any objects used in the base class constructor
let fieldValue = ""
{
inherit
BaseClass (``arguments here``)
}
then
``created object``.otherField <- fieldValue

[<DefaultValue>]
val mutable otherField : FieldType
```

Always prefer F# class initializers over property assignment! **You absolutely must use F# class initializers instead of property assignment**!

Having a class declaration:
``` F#
type MyClass (someConstructorParam : string) =
member ReadOnlyProperty = someConstructorParam

member val MutableProperty1 = "" with get, set
member val MutableProperty2 = "" with get, set
```

The following excerpt of class creation is wrong:
``` F#
let myClass = MyClass("some value")
myClass.MutableProperty1 <- "new value"
myClass.MutableProperty2 <- "new value"
```

The following excerpt (uses initializer syntax) of class creation is right:
``` F#
let myClass =
MyClass(
// constructor parameters go first without names
"some value",
// then mutable properties go next with names
MutableProperty1 = "new value",
MutableProperty2 =
// operations must be placed into parentheses
(5 |> string)
)
```

## Coding instructions

During the implementation, if you need some types or members defined in the other project but that project is not referenced, then:
1. stop implementing the solution;
2. respond with summary about what is needed and which project it is defined in;
3. ask if you can add the reference before continuing coding.
Never ever duplicate the code unless you got explicit confirmation that you are allowed to do so.

## Documentation and Naming

* Document public APIs with XML comments
* Use descriptive function names that indicate transformation direction

# Build and test steps

We use `dotnet test` CLI to test the project.
If the build fails with errors or non-zero exit code, fix it based on the error messages given and repeat the build step.
If build or tests step fails, fix the errors and repeat from build. After that, report all relevant build errors, error messages and specific details about failing tests and their test test failure details.

## Fixing tests

* If any of the tests fail: Check if the test, test expectation (either inline in the test or a reference file configured for the test) or implementation needs updating, and fix it

## Acceptance criteria

* Builds without errors.
* Runs tests without errors. If some tests needed adjustments, those test expectations/baseline adjustments were done.
* If the acceptance criteria was not met, collect the error messages (build failures or failing tests) and report them.
37 changes: 37 additions & 0 deletions .github/workflows/copilot-setup-steps.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: "Copilot Setup Steps"

# Automatically run the setup steps when they are changed to allow for easy validation, and
# allow manual testing through the repository's "Actions" tab
on:
workflow_dispatch:
push:
paths:
- .github/workflows/copilot-setup-steps.yml
pull_request:
paths:
- .github/workflows/copilot-setup-steps.yml

jobs:
# The job MUST be called `copilot-setup-steps` or it will not be picked up by Copilot.
copilot-setup-steps:
runs-on: windows-2025

# Set the permissions to the lowest permissions possible needed for your steps.
# Copilot will be given its own token for its operations.
permissions:
# If you want to clone the repository as part of your setup steps, for example to install dependencies, you'll need the `contents: read` permission. If you don't clone the repository in your setup steps, Copilot will do this for you automatically after the steps complete.
contents: read

# You can define any steps you want, and they will run before the agent starts.
# If you do not check out your code, Copilot will do this for you.
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup necessary dotnet SDKs
uses: actions/setup-dotnet@v4
with:
global-json-file: global.json
dotnet-version: |
9.x
8.x
File renamed without changes.
File renamed without changes.
12 changes: 12 additions & 0 deletions .mcp.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"servers": {
"Microsoft Docs": {
"type": "http",
"url": "https://learn.microsoft.com/api/mcp"
},
"GitHub": {
"type": "http",
"url": "https://api.githubcopilot.com/mcp/"
}
}
}
8 changes: 5 additions & 3 deletions FSharp.Data.GraphQL.slnx
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@
<File Path="docs/tools/templates/template.cshtml" />
</Folder>
<Folder Name="/GitHub/">
<File Path=".github/workflows/publish_ci.yml" />
<File Path=".github/workflows/publish_release.yml" />
<File Path=".github/workflows/pull_request.yml" />
<File Path=".github/workflows/copilot-setup-steps.yml" />
<File Path=".github/workflows/publish-ci.yml" />
<File Path=".github/workflows/publish-release.yml" />
<File Path=".github/workflows/pull-request.yml" />
</Folder>
<Folder Name="/project/">
<File Path="README.md" />
Expand Down Expand Up @@ -101,6 +102,7 @@
</Folder>
<Folder Name="/Solution Items/">
<File Path=".editorconfig" />
<File Path=".mcp.json" />
<File Path="Directory.Build.props" />
<File Path="Directory.Build.targets" />
<File Path="global.json" />
Expand Down
Loading