From 6853a6539c0ac3b3f5e05d57ae235cd4487533af Mon Sep 17 00:00:00 2001 From: Yura Lazarev Date: Sun, 14 Jun 2026 18:29:40 +0200 Subject: [PATCH] chore: align CI to hardened canon, add AGENTS.md + CLAUDE.md CI: drop accept-flake-config (supply-chain risk; caches already pinned), run luacheck with --std lua51 --no-unused-args (matches the Lua 5.1 target and the curried-FFI idiom), invoke the test step via bash so it no longer needs the execute bit. AGENTS.md is the single instruction file the coding agents read natively; CLAUDE.md is a one-line @AGENTS.md import so Claude Code shares it. Also removes dead JavaScript-era package files. Tooling and docs only, no src/. --- .eslintrc.json | 26 ----------------------- .github/workflows/ci.yml | 5 ++--- .gitignore | 4 ---- AGENTS.md | 45 ++++++++++++++++++++++++++++++++++++++++ CLAUDE.md | 1 + bower.json | 25 ---------------------- flake.lock | 6 +++--- package.json | 14 ------------- 8 files changed, 51 insertions(+), 75 deletions(-) delete mode 100644 .eslintrc.json create mode 100644 AGENTS.md create mode 100644 CLAUDE.md delete mode 100644 bower.json delete mode 100644 package.json diff --git a/.eslintrc.json b/.eslintrc.json deleted file mode 100644 index 1c6afb9..0000000 --- a/.eslintrc.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "parserOptions": { - "ecmaVersion": 6, - "sourceType": "module" - }, - "extends": "eslint:recommended", - "rules": { - "strict": [2, "global"], - "block-scoped-var": 2, - "consistent-return": 2, - "eqeqeq": [2, "smart"], - "guard-for-in": 2, - "no-caller": 2, - "no-extend-native": 2, - "no-loop-func": 2, - "no-new": 2, - "no-param-reassign": 2, - "no-return-assign": 2, - "no-unused-expressions": 2, - "no-use-before-define": 2, - "radix": [2, "always"], - "indent": [2, 2], - "quotes": [2, "double"], - "semi": [2, "always"] - } -} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8c9456b..d624d2e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,7 +14,6 @@ jobs: - uses: cachix/install-nix-action@v27 with: extra_nix_config: | - accept-flake-config = true extra-substituters = https://cache.iog.io https://purescript-lua.cachix.org extra-trusted-public-keys = hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= purescript-lua.cachix.org-1:yLs4ei2HtnuPtzLekOrW3xdfm95+Etw15gwgyIGTayA= @@ -22,7 +21,7 @@ jobs: run: nix develop -c ./scripts/build - name: Test - run: if [ -f scripts/test ]; then nix develop -c ./scripts/test; fi + run: if [ -f scripts/test ]; then nix develop -c bash ./scripts/test; fi - name: Luacheck - run: nix develop -c luacheck --quiet --std min src/ + run: nix develop -c luacheck --quiet --std lua51 --no-unused-args src/ diff --git a/.gitignore b/.gitignore index b846b63..db67e9a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,4 @@ /.* !/.gitignore -!/.eslintrc.json !/.github/ -/bower_components/ -/node_modules/ /output/ -package-lock.json diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..11ae766 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,45 @@ +# AGENTS.md + +A PureScript→Lua FFI fork in the [`purescript-lua`](https://github.com/Unisay/purescript-lua) package set. Generated code targets **Lua 5.1**. + +## Commands + +All commands run inside the nix dev shell: + +- Build: `nix develop -c ./scripts/build` +- Test (only if the fork has `scripts/test`): `nix develop -c bash ./scripts/test` +- Lint: `nix develop -c luacheck --quiet --std lua51 --no-unused-args src/` + +## Lua 5.1 target + +The output runs on Lua 5.1, which is stricter than 5.3: + +- No `table.unpack`, `bit32`, `utf8`, or the `//` operator. `math.pow` and `math.atan2` do exist. +- Array-style tables are 1-indexed: the first element is `t[1]`, not `t[0]`. +- `unit` is `{}`, never `nil`: a `nil` table element silently disappears, which would collapse `Array Unit` into an empty table. +- Lua 5.1 mangles some Lua 5.3 string escapes, so keep FFI string escapes 5.1-safe. + +## FFI files (under `src/`) + +pslua's foreign-file parser needs every exported value wrapped in parentheses: + +```lua +return { + identity = (function(x) return x end), + answer = (42), +} +``` + +A bare `function … end` or an unparenthesised expression fails to parse. + +## Toolchain + +`flake.nix` pins everything through [`purescript-overlay`](https://github.com/thomashoneyman/purescript-overlay): purs 0.15.16 (`purs-bin.purs-0_15_16`), spago 0.21.0 (`spago-bin.spago-0_21_0`), Lua 5.1 (`lua51Packages`). The `pslua` input tracks `github:Unisay/purescript-lua`; keep `flake.lock` reasonably current, since a long-stale pslua pin won't create the `--lua-output-file` directory and CI fails. + +## Releasing + +Tag-driven, with no GitHub Release or changelog entry. The full conventions live in the [package-set repo](https://github.com/Unisay/purescript-lua-package-sets/blob/master/CONTRIBUTING.md): push an annotated tag on `master`, bump this fork's `version` in the package set's `src/packages.dhall`, refresh `latest-compatible-sets.json`, and push a `psc-*` set tag. + +## Decisions + +Cross-cutting decisions are recorded as ADRs in the [package-set repo](https://github.com/Unisay/purescript-lua-package-sets/tree/master/docs/adr). Read them before a decision that affects the set, and add one after making such a decision. 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 diff --git a/bower.json b/bower.json deleted file mode 100644 index 29763ef..0000000 --- a/bower.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "name": "purescript-refs", - "homepage": "https://github.com/purescript/purescript-refs", - "license": "BSD-3-Clause", - "repository": { - "type": "git", - "url": "https://github.com/purescript/purescript-refs.git" - }, - "ignore": [ - "**/.*", - "bower_components", - "node_modules", - "output", - "test", - "bower.json", - "package.json" - ], - "dependencies": { - "purescript-effect": "^4.0.0", - "purescript-prelude": "^6.0.0" - }, - "devDependencies": { - "purescript-assert": "^6.0.0" - } -} diff --git a/flake.lock b/flake.lock index b86363e..4374d41 100644 --- a/flake.lock +++ b/flake.lock @@ -701,11 +701,11 @@ ] }, "locked": { - "lastModified": 1781384923, - "narHash": "sha256-kuIl9DhbuynGMAQzATU2KnL0Pa5OUVIlYCR1xKOtoP0=", + "lastModified": 1781449244, + "narHash": "sha256-evfLWZ+i55b0cSfd/jgU5mXuBg2KDEP5WhEj2iuzIiM=", "owner": "Unisay", "repo": "purescript-lua", - "rev": "6fdc70c6e16c5e1f9fc3a6bdbd2838f2cff0122c", + "rev": "94c13cecd1146494de56196a7badb3b1374d364d", "type": "github" }, "original": { diff --git a/package.json b/package.json deleted file mode 100644 index e6d4187..0000000 --- a/package.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "private": true, - "scripts": { - "clean": "rimraf output && rimraf .pulp-cache", - "test": "pulp test", - "build": "eslint src && pulp build -- --censor-lib --strict" - }, - "devDependencies": { - "eslint": "^7.15.0", - "pulp": "16.0.0-0", - "purescript-psa": "^0.8.2", - "rimraf": "^3.0.2" - } -}