Skip to content

Commit 691073b

Browse files
committed
Add AGENTS.md
1 parent 488f98a commit 691073b

7 files changed

Lines changed: 78 additions & 3 deletions

File tree

‎.github/copilot-instructions.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# GitHub Copilot Instructions
2+
3+
Single source of truth: read and follow `../AGENTS.md`.
4+
5+
Do not duplicate instructions here. If anything conflicts, `../AGENTS.md` wins.

‎.github/workflows/CI.yml‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,16 @@ on:
44
push:
55
paths-ignore:
66
- 'doc/**'
7-
- 'changelog.md'
8-
- 'readme.md'
7+
- '*.md'
8+
- '*.txt'
99
pull_request:
1010

1111
jobs:
1212
build:
13+
permissions:
14+
id-token: write
15+
actions: write
16+
contents: write
1317
runs-on: ubuntu-22.04
1418
steps:
1519
- name: "Build, Test, Pack and Publish"

‎AGENTS.md‎

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# LibObjectFile — Codex Agent Instructions
2+
3+
LibObjectFile is a .NET library to read, manipulate and write linker and executable object files (e.g ELF, ar, DWARF, PE...).
4+
5+
Paths/commands below are relative to this directory.
6+
7+
## Orientation
8+
9+
- Library: `src/LibObjectFile/`
10+
- Benchmarks: `src/LibObjectFile.Bench/`
11+
- CodeGen: `src/LibObjectFile.CodeGen/` (Native header to C# codegen))
12+
- Tests: `src/LibObjectFile.Tests/` (MSTest)
13+
- Docs to keep in sync with behavior: `readme.md` and the docs under `doc/` (e.g., `doc/**/*.md`)
14+
15+
## Build & Test
16+
17+
```sh
18+
# from the project root (this folder)
19+
cd src
20+
dotnet build -c Release
21+
dotnet test -c Release
22+
```
23+
24+
All tests must pass and docs must be updated before submitting.
25+
26+
## Contribution Rules (Do/Don't)
27+
28+
- Keep diffs focused; avoid drive-by refactors/formatting and unnecessary dependencies.
29+
- Follow existing patterns and naming; prefer clarity over cleverness.
30+
- New/changed behavior requires tests; bug fix = regression test first, then fix.
31+
- All public APIs require XML docs (avoid CS1591) and should document thrown exceptions.
32+
33+
## C# Conventions (Project Defaults)
34+
35+
- Naming: `PascalCase` public/types/namespaces, `camelCase` locals/params, `_camelCase` private fields, `I*` interfaces.
36+
- Style: file-scoped namespaces; `using` outside namespace (`System` first); `var` when the type is obvious.
37+
- Nullability: enabled — respect annotations; use `ArgumentNullException.ThrowIfNull()`; prefer `is null`/`is not null`; don't suppress warnings without a justification comment.
38+
- Exceptions: validate inputs early; throw specific exceptions (e.g., `ArgumentException`/`ArgumentNullException`) with meaningful messages.
39+
- Async: `Async` suffix; no `async void` (except event handlers); use `ConfigureAwait(false)` in library code; consider `ValueTask<T>` on hot paths.
40+
41+
## Performance / AOT / Trimming
42+
43+
- Minimize allocations (`Span<T>`, `stackalloc`, `ArrayPool<T>`, `StringBuilder` in loops).
44+
- Keep code AOT/trimmer-friendly: avoid reflection; prefer source generators; use `[DynamicallyAccessedMembers]` when reflection is unavoidable.
45+
- Use `sealed` for non-inheritable classes; prefer `ReadOnlySpan<char>` for parsing.
46+
47+
## API Design
48+
49+
- Follow .NET guidelines; keep APIs small and hard to misuse.
50+
- Prefer overloads over optional parameters (binary compatibility); consider `Try*` methods alongside throwing versions.
51+
- Mark APIs `[Obsolete("message", error: false)]` before removal once stable (can be skipped while pre-release).
52+
53+
## Git / Pre-Submit
54+
55+
- Commits: commit after each self-contained logical step; imperative subject, < 72 chars; one logical change per commit; reference issues when relevant; don't delete unrelated local files.
56+
- Commit subjects must start with a dotnet-releaser autolabel prefix: `Breaking Change`, `Add`, `Fix`/`Bugfix`, `Enhance`/`Refactor`, `Improve Perf`, `Add`/`Improve`/`Fix`/`Update` followed by `ci`/`doc`/`test`/`example`/`translation`/`accessibility`, or `Update Depend...`/`Bump <dependency>` for dependencies. Put any GitHub issue reference at the end in parentheses, e.g. `Fix parser error (#18)`.
57+
- Checklist: each self-contained step is committed; build+tests pass; docs updated if behavior changed; public APIs have XML docs; changes covered by unit tests.

‎CLAUDE.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Claude Instructions
2+
3+
Single source of truth: read and follow `AGENTS.md`.
4+
5+
Do not duplicate instructions here. If anything conflicts, `AGENTS.md` wins.

‎license.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2019, Alexandre Mutel
1+
Copyright (c) 2019-2026, Alexandre Mutel
22
All rights reserved.
33

44
Redistribution and use in source and binary forms, with or without modification

‎src/LibObjectFile.slnx‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
<File Path="../.gitattributes" />
88
<File Path="../.github/workflows/ci.yml" />
99
<File Path="../.gitignore" />
10+
<File Path="../AGENTS.md" />
1011
<File Path="../license.txt" />
1112
<File Path="../readme.md" />
1213
<File Path="Directory.Build.props" />

‎src/dotnet-releaser.toml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,6 @@ run_tests_for_debug = true
77
[github]
88
user = "xoofx"
99
repo = "LibObjectFile"
10+
[nuget]
11+
user = "xoofx"
12+
trusted_publishing = true

0 commit comments

Comments
 (0)