Skip to content

Commit b28b360

Browse files
authored
Merge pull request #236 from fsprojects/repo-assist/fix-issue-232-add-agents-md-b37faf5aa41bce5a
[Repo Assist] Add AGENTS.md with build, test, and formatting instructions
2 parents 0d5b58c + 0976b93 commit b28b360

File tree

1 file changed

+140
-0
lines changed

1 file changed

+140
-0
lines changed

AGENTS.md

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
# AGENTS.md — Contributor and AI Agent Guide
2+
3+
This file describes how to build, test, format, and contribute to FSharpx.Collections.
4+
5+
## Prerequisites
6+
7+
- [.NET SDK 8.0](https://dotnet.microsoft.com/download) (version specified in `global.json`)
8+
- [Node.js](https://nodejs.org/) (v24+) — required for the Fable/JavaScript tests
9+
- [Yarn](https://yarnpkg.com/) — required for the Fable tests
10+
11+
## Restore tools and dependencies
12+
13+
All local .NET tools (paket, fsdocs, fable, fantomas) and NuGet dependencies are managed via
14+
Paket. Restore them before building or testing:
15+
16+
```sh
17+
dotnet tool restore
18+
dotnet paket restore
19+
```
20+
21+
## Build
22+
23+
The project uses [FAKE](https://fake.build/) via a local build script.
24+
25+
**Linux / macOS:**
26+
27+
```sh
28+
./build.sh
29+
```
30+
31+
**Windows:**
32+
33+
```cmd
34+
build.cmd
35+
```
36+
37+
Both scripts run `dotnet tool restore`, `dotnet paket restore`, and then execute the FAKE build
38+
pipeline (see `build/build.fs`).
39+
40+
To run a specific FAKE target:
41+
42+
```sh
43+
./build.sh <Target> # e.g. ./build.sh Build
44+
build.cmd <Target> # e.g. build.cmd Build
45+
```
46+
47+
Common targets:
48+
49+
| Target | Description |
50+
|-----------------|---------------------------------------------------------------|
51+
| `Build` | Compile the solution (`FSharpx.Collections.sln`) in Release |
52+
| `RunTests` | Run .NET unit tests (Expecto, parallel) |
53+
| `RunTestsFable` | Run Fable/JavaScript tests (requires Node + Yarn) |
54+
| `CheckFormat` | Check formatting with Fantomas (fails if files need changes) |
55+
| `Format` | Format all source files with Fantomas |
56+
| `All` | Full pipeline: Clean → AssemblyInfo → CheckFormat → Build → RunTests → RunTestsFable → CINuGet → GenerateDocs |
57+
| `NuGet` | Pack NuGet packages into `bin/` |
58+
59+
To run only the .NET build and tests (skipping Fable and docs):
60+
61+
```sh
62+
./build.sh RunTests # also runs Build as a prerequisite
63+
```
64+
65+
## Run tests directly (without FAKE)
66+
67+
After building, you can run the .NET tests directly:
68+
69+
```sh
70+
dotnet test tests/FSharpx.Collections.Tests/FSharpx.Collections.Tests.fsproj -c Release
71+
dotnet test tests/FSharpx.Collections.Experimental.Tests/FSharpx.Collections.Experimental.Tests.fsproj -c Release
72+
```
73+
74+
For the Fable/JavaScript tests:
75+
76+
```sh
77+
cd tests/fable
78+
yarn install --frozen-lockfile
79+
yarn test
80+
```
81+
82+
## Code formatting
83+
84+
The project uses [Fantomas](https://fsprojects.github.io/fantomas/) (version pinned in
85+
`.config/dotnet-tools.json`) to enforce consistent formatting.
86+
87+
**Check whether any files need formatting (CI enforces this):**
88+
89+
```sh
90+
./build.sh CheckFormat
91+
```
92+
93+
**Auto-format all source files:**
94+
95+
```sh
96+
./build.sh Format
97+
```
98+
99+
Or run Fantomas directly:
100+
101+
```sh
102+
dotnet fantomas <file-or-directory>
103+
dotnet fantomas --check <file-or-directory>
104+
```
105+
106+
> **Important:** CI runs `CheckFormat` before `Build`. A PR with unformatted code will fail CI.
107+
108+
## CI pipeline
109+
110+
The GitHub Actions workflow (`.github/workflows/dotnet.yml`) runs on every push and pull request,
111+
on both `ubuntu-latest` and `windows-latest`. It:
112+
113+
1. Restores tools and packages.
114+
2. Runs `dotnet run --project build/build.fsproj` (equivalent to `./build.sh All`), which covers
115+
check-format → build → .NET tests → Fable tests → NuGet packaging → docs generation.
116+
117+
All of the above must pass before a PR can be merged.
118+
119+
## Project structure
120+
121+
```
122+
src/
123+
FSharpx.Collections/ Core collections library
124+
FSharpx.Collections.Experimental/ Experimental / less-stable collections
125+
tests/
126+
FSharpx.Collections.Tests/ .NET tests for the core library (Expecto)
127+
FSharpx.Collections.Experimental.Tests/ .NET tests for experimental collections
128+
fable/ Fable/JavaScript tests (mocha)
129+
build/ FAKE build script (build.fs)
130+
docs/ Documentation source (fsdocs)
131+
```
132+
133+
## Contribution guidelines
134+
135+
- Keep PRs small and focused — one concern per PR.
136+
- Add or update tests for any behaviour you change.
137+
- Run `./build.sh CheckFormat` (or `build.cmd CheckFormat`) before opening a PR.
138+
- Run the full test suite (`./build.sh RunTests`) before opening a PR.
139+
- No new NuGet dependencies without prior discussion in an issue.
140+
- No breaking API changes without maintainer approval.

0 commit comments

Comments
 (0)