From 9b8f6422fd3897c23c33314dcb3ee7004cc498a3 Mon Sep 17 00:00:00 2001 From: Andre Sutherland Date: Sun, 22 Nov 2026 15:34:26 +0000 Subject: [PATCH 1/3] chore: correct the pre-commit hook's shebang The first line was ##!/bin/bash, a comment, so git fell back to sh. Co-Authored-By: Claude Opus 5.5 --- .githooks/pre-commit | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.githooks/pre-commit b/.githooks/pre-commit index 426a90e..0086e71 100755 --- a/.githooks/pre-commit +++ b/.githooks/pre-commit @@ -1,4 +1,4 @@ -##!/bin/bash +#!/bin/bash if ! scripts/lint.sh; then echo -e "\033[1m\033[31mFailed linting, please fix the reported issues\033[0m\n" From 21a787b0f2b460ff9fb666c10320eab1e64744b9 Mon Sep 17 00:00:00 2001 From: Andre Sutherland Date: Sun, 22 Nov 2026 15:34:29 +0000 Subject: [PATCH 2/3] docs: correct the contributing guide's prerequisites, scope and tag push staticcheck is needed for the pre-commit hook and Node and Yarn for the commit-msg hook, commits take no scope, and a release pushes its one tag rather than every local tag. Co-Authored-By: Claude Opus 5.5 --- CONTRIBUTING.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 55dccf1..f1848b1 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -4,9 +4,10 @@ ### Prerequisites -- [Go](https://golang.org/dl/) >=1.22.2 -- [Node.js](https://nodejs.org/en/download/) >=18.17.0 (For pre-commit hooks) -- [Yarn](https://yarnpkg.com/getting-started/install) >=1.22.21 (For pre-commit hooks) +- [Go](https://golang.org/dl/) >=1.22.2 (`go.mod`; CI uses 1.24) +- [staticcheck](https://staticcheck.dev/docs/getting-started/) (For the pre-commit hook, which runs `scripts/lint.sh`) +- [Node.js](https://nodejs.org/en/download/) >=18.17.0 (For the commit-msg hook) +- [Yarn](https://yarnpkg.com/getting-started/install) >=1.22.21 (For the commit-msg hook) Dependencies are managed with Go modules (go.mod) and will be installed automatically when you first run tests. @@ -66,7 +67,7 @@ See [here](https://go.dev/wiki/Modules#publishing-a-release). ```bash git tag -a v0.2.0 -m "chore: Release v0.2.0" -git push --tags +git push origin v0.2.0 ``` Be sure to add a release for the tag with notes following this template: @@ -91,7 +92,7 @@ GOPROXY=proxy.golang.org go list -m github.com/newstack-cloud/ls-builder@v0.2.0 ## Commit scope -**blueprint** +Scopes are optional, and commits here don't use them. Example commit: From 1db7381103163499e11bb856bd0398a97e0a0fb8 Mon Sep 17 00:00:00 2001 From: Andre Sutherland Date: Sun, 22 Nov 2026 15:34:30 +0000 Subject: [PATCH 3/3] docs: add AGENTS.md for coding agents Adds AGENTS.md, and a CLAUDE.md that imports it. Co-Authored-By: Claude Opus 5.5 --- AGENTS.md | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ CLAUDE.md | 1 + 2 files changed, 68 insertions(+) create mode 100644 AGENTS.md create mode 100644 CLAUDE.md diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..e1ca6e7 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,67 @@ +# ls-builder + +A Go library for building Language Server Protocol servers: LSP 3.17 types and request +dispatch, and stdio, TCP and WebSocket transports. bluelink's `tools/blueprint-ls` is built on +it, and as a public module on pkg.go.dev it may have users outside NewStack. + +## Workspace + +This repo is one of NewStack's. NewStack's maintainers develop it alongside the others in a +shared workspace, using the NewStack Claude Code plugin for how work is planned, reviewed, +committed and coordinated across repos. The plugin isn't public, and nothing here depends on it: +this file and the repo's own docs cover what a contribution needs. + +## Layout + +| Path | Holds | +|---|---| +| `lsp_3_17/` | LSP 3.17 messages and structures; `Handler`, which dispatches client messages to the functions a server sets; `Dispatcher`, which sends server-to-client requests and notifications; `TraceService` | +| `server/` | The server: connections, transports (stdio, TCP, WebSocket), the jsonrpc2 logger adapter | +| `common/` | `LSPContext` and the handler types both use | + +Each directory's `README.md` describes it. + +## Checks + +- **Tools:** Go (`go.mod`; CI uses 1.24) with cgo for `-race`, `staticcheck` on `PATH` (CI + installs `@latest`), and Node with Yarn 1: run `yarn` in each checkout or worktree before + committing, since the commit-msg hook runs commitlint through `npm exec`. +- **Lint:** `scripts/lint.sh` (`staticcheck` and `go vet` per package). +- **Tests:** `bash scripts/run-tests.sh` runs every package with `-race` and coverage. Tests + need no services; the transport tests listen on free local ports. `--update-snapshots` does + nothing. `lsp_3_17/example_test.go` checks its log output, and the root `README.md` example + is copied from it by hand. +- **JSON shapes:** `encoding/json` matches field names case-insensitively when decoding, so a + wrong tag can still decode. Check a new or changed type by marshalling it against the spec. +- **Gates:** with `git config core.hooksPath .githooks`, pre-commit runs `scripts/lint.sh` over + the working tree on every commit, and commit-msg runs commitlint. CI (`ci.yml`) runs lint, + tests and SonarCloud on pull requests and pushes to `main`. + +## Compatibility + +- **Go API:** blueprint-ls and any outside users build against tagged releases. Breaking + changes have shipped as patch releases so far (v0.2.1, v0.2.2, v0.2.4, per `CHANGELOG.md`); + a breaking change says in its pull request what blueprint-ls needs. +- **Protocol:** types aim to match the LSP 3.17 specification's field names and JSON shapes, + which clients such as VS Code send and expect; new or changed types use the spec's names. + Known deviations: `ServerCapabilities.NotebookDocumentSync` marshals as `notebookSync`, + `TextDocumentClientCapabilities.Diagnostics` decodes `diagnostics` rather than `diagnostic`, + and `DocumentRangeFormattingParams.Range` marshals as `Range`. `window/showDocument` isn't + implemented. +- **Persisted state:** none. + +## Conventions + +- Commits: conventional commits, checked by commitlint (`commitlint.config.js`). Scopes are + allowed but unused. +- Releases are manual: a `CHANGELOG.md` entry on `main`, then a `vX.Y.Z` tag and GitHub + release, as [CONTRIBUTING.md](CONTRIBUTING.md) sets out. There is no release automation. + +## Safety + +- Don't create or push tags, create releases, or edit `CHANGELOG.md` for a release unless + asked. + +## Known mistakes + + diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..43c994c --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1 @@ +@AGENTS.md