Skip to content

Commit c5dadfd

Browse files
committed
chore: removed unnecessary git-cliff config (uses shared)
agentic: added rules and conventions for Claude and copilot agentic: added copilot instructions Signed-off-by: Frederic BIDON <fredbi@yahoo.com>
1 parent bbf77d6 commit c5dadfd

File tree

9 files changed

+171
-182
lines changed

9 files changed

+171
-182
lines changed

.claude/.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
plans/
2+
skills/
3+
commands/
4+
agents/
5+
hooks/

.claude/CLAUDE.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Project Overview
6+
7+
Go implementation of [JSON Pointer (RFC 6901)](https://datatracker.ietf.org/doc/html/rfc6901) for navigating
8+
and mutating JSON documents represented as Go values. Unlike most implementations, it works not only with
9+
`map[string]any` and slices, but also with Go structs (resolved via `json` struct tags and reflection).
10+
11+
See [docs/MAINTAINERS.md](../docs/MAINTAINERS.md) for CI/CD, release process, and repo structure details.
12+
13+
### Package layout (single package)
14+
15+
| File | Contents |
16+
|------|----------|
17+
| `pointer.go` | Core types (`Pointer`, `JSONPointable`, `JSONSetable`), `New`, `Get`, `Set`, `Offset`, `Escape`/`Unescape` |
18+
| `errors.go` | Sentinel errors: `ErrPointer`, `ErrInvalidStart`, `ErrUnsupportedValueType` |
19+
20+
### Key API
21+
22+
- `New(string) (Pointer, error)` — parse a JSON pointer string (e.g. `"/foo/0/bar"`)
23+
- `Pointer.Get(document any) (any, reflect.Kind, error)` — retrieve a value
24+
- `Pointer.Set(document, value any) (any, error)` — set a value (document must be pointer/map/slice)
25+
- `Pointer.Offset(jsonString string) (int64, error)` — byte offset of token in raw JSON
26+
- `GetForToken` / `SetForToken` — single-level convenience helpers
27+
- `Escape` / `Unescape` — RFC 6901 token escaping (`~0``~`, `~1``/`)
28+
29+
Custom types can implement `JSONPointable` (for Get) or `JSONSetable` (for Set) to bypass reflection.
30+
31+
### Dependencies
32+
33+
- `github.com/go-openapi/swag/jsonname` — struct tag → JSON field name resolution
34+
- `github.com/go-openapi/testify/v2` — test-only assertions
35+
36+
### Notable historical design decisions
37+
38+
See also .claude/plans/ROADMAP.md.
39+
40+
- Struct fields **must** have a `json` tag to be reachable; untagged fields are ignored
41+
(differs from `encoding/json` which defaults to the Go field name).
42+
- Anonymous embedded struct fields are traversed only if tagged.
43+
- The RFC 6901 `"-"` array suffix (append) is **not** implemented.
44+

.claude/rules/go-conventions.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
paths:
3+
- "**/*.go"
4+
---
5+
6+
# Code conventions (go-openapi)
7+
8+
- All files must have SPDX license headers (Apache-2.0).
9+
- Go version policy: support the 2 latest stable Go minor versions.
10+
- Commits require DCO sign-off (`git commit -s`).

.claude/rules/linting.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
paths:
3+
- "**/*.go"
4+
---
5+
6+
# Linting conventions (go-openapi)
7+
8+
```sh
9+
golangci-lint run
10+
```
11+
12+
Config: `.golangci.yml` — posture is `default: all` with explicit disables.
13+
See `docs/STYLE.md` for the rationale behind each disabled linter.
14+
15+
Key rules:
16+
- Every `//nolint` directive **must** have an inline comment explaining why.
17+
- Prefer disabling a linter over scattering `//nolint` across the codebase.

.claude/rules/testing.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
---
2+
paths:
3+
- "**/*_test.go"
4+
---
5+
6+
# Testing conventions (go-openapi)
7+
8+
## Running tests
9+
10+
**Single module repos:**
11+
12+
```sh
13+
go test ./...
14+
```
15+
16+
**Mono-repos (with `go.work`):**
17+
18+
```sh
19+
# All modules
20+
go test work ./...
21+
22+
# Single module
23+
go test ./conv/...
24+
```
25+
26+
Note: in mono-repos, plain `go test ./...` only tests the root module.
27+
The `work` pattern expands to all modules listed in `go.work`.
28+
29+
CI runs tests on `{ubuntu, macos, windows} x {stable, oldstable}` with `-race` via `gotestsum`.
30+
31+
## Fuzz tests
32+
33+
```sh
34+
# List all fuzz targets
35+
go test -list Fuzz ./...
36+
37+
# Run a specific target (go test -fuzz cannot span multiple packages)
38+
go test -fuzz=Fuzz -run='FuzzTargetName$' -fuzztime=1m30s ./package
39+
```
40+
41+
Fuzz corpus lives in `testdata/fuzz/` within each package. CI runs each fuzz target for 1m30s
42+
with a 5m minimize timeout.
43+
44+
## Test framework
45+
46+
`github.com/go-openapi/testify/v2` — a zero-dep fork of `stretchr/testify`.
47+
Because it's a fork, `testifylint` does not work.

.cliff.toml

Lines changed: 0 additions & 181 deletions
This file was deleted.

.github/copilot

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

.github/copilot-instructions.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Copilot Instructions
2+
3+
## Project Overview
4+
5+
Go implementation of [JSON Pointer (RFC 6901)](https://datatracker.ietf.org/doc/html/rfc6901) for navigating
6+
and mutating JSON documents represented as Go values. Works with `map[string]any`, slices, and Go structs
7+
(resolved via `json` struct tags and reflection).
8+
9+
## Package Layout (single package)
10+
11+
| File | Contents |
12+
|------|----------|
13+
| `pointer.go` | Core types (`Pointer`, `JSONPointable`, `JSONSetable`), `New`, `Get`, `Set`, `Offset`, `Escape`/`Unescape` |
14+
| `errors.go` | Sentinel errors: `ErrPointer`, `ErrInvalidStart`, `ErrUnsupportedValueType` |
15+
16+
## Key API
17+
18+
- `New(string) (Pointer, error)` — parse a JSON pointer string (e.g. `"/foo/0/bar"`)
19+
- `Pointer.Get(document any) (any, reflect.Kind, error)` — retrieve a value
20+
- `Pointer.Set(document, value any) (any, error)` — set a value (document must be pointer/map/slice)
21+
- `Pointer.Offset(jsonString string) (int64, error)` — byte offset of token in raw JSON
22+
- `GetForToken` / `SetForToken` — single-level convenience helpers
23+
- `Escape` / `Unescape` — RFC 6901 token escaping (`~0``~`, `~1``/`)
24+
25+
Custom types can implement `JSONPointable` (for Get) or `JSONSetable` (for Set) to bypass reflection.
26+
27+
## Design Decisions
28+
29+
- Struct fields **must** have a `json` tag to be reachable; untagged fields are ignored.
30+
- Anonymous embedded struct fields are traversed only if tagged.
31+
- The RFC 6901 `"-"` array suffix (append) is **not** implemented.
32+
33+
## Dependencies
34+
35+
- `github.com/go-openapi/swag/jsonname` — struct tag to JSON field name resolution
36+
- `github.com/go-openapi/testify/v2` — test-only assertions (zero-dep fork of `stretchr/testify`)
37+
38+
## Conventions
39+
40+
- All `.go` files must have SPDX license headers (Apache-2.0).
41+
- Commits require DCO sign-off (`git commit -s`).
42+
- Linting: `golangci-lint run` — config in `.golangci.yml` (posture: `default: all` with explicit disables).
43+
- Every `//nolint` directive **must** have an inline comment explaining why.
44+
- Tests: `go test ./...` with `-race`. CI runs on `{ubuntu, macos, windows} x {stable, oldstable}`.
45+
- Test framework: `github.com/go-openapi/testify/v2` (not `stretchr/testify`).
46+
47+
See `.github/copilot/` (symlinked to `.claude/rules/`) for detailed rules on Go conventions, linting, and testing.

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,3 @@
33
.idea
44
.env
55
.mcp.json
6-
.claude/

0 commit comments

Comments
 (0)