From d5849509ce738d68fad55a1ebe126a94dc6da3d3 Mon Sep 17 00:00:00 2001 From: Yura Lazarev Date: Sun, 14 Jun 2026 18:29:08 +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/. --- .github/workflows/ci.yml | 5 ++--- .gitignore | 3 --- AGENTS.md | 45 ++++++++++++++++++++++++++++++++++++++++ CLAUDE.md | 1 + bower.json | 35 ------------------------------- flake.lock | 6 +++--- package.json | 13 ------------ 7 files changed, 51 insertions(+), 57 deletions(-) create mode 100644 AGENTS.md create mode 100644 CLAUDE.md delete mode 100644 bower.json delete mode 100644 package.json 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 7ebd961..db67e9a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,4 @@ /.* !/.gitignore !/.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 3c238c4..0000000 --- a/bower.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name": "purescript-enums", - "homepage": "https://github.com/purescript/purescript-enums", - "license": "BSD-3-Clause", - "repository": { - "type": "git", - "url": "https://github.com/purescript/purescript-enums.git" - }, - "ignore": [ - "**/.*", - "bower_components", - "node_modules", - "output", - "test", - "bower.json", - "gulpfile.js", - "package.json" - ], - "dependencies": { - "purescript-control": "^6.0.0", - "purescript-either": "^6.0.0", - "purescript-gen": "^4.0.0", - "purescript-maybe": "^6.0.0", - "purescript-newtype": "^5.0.0", - "purescript-nonempty": "^7.0.0", - "purescript-partial": "^4.0.0", - "purescript-prelude": "^6.0.0", - "purescript-tuples": "^7.0.0", - "purescript-unfoldable": "^6.0.0" - }, - "devDependencies": { - "purescript-assert": "^6.0.0", - "purescript-console": "^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 c8e10e0..0000000 --- a/package.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "private": true, - "scripts": { - "clean": "rimraf output && rimraf .pulp-cache", - "build": "pulp build -- --censor-lib --strict", - "test": "pulp test" - }, - "devDependencies": { - "pulp": "16.0.0-0", - "purescript-psa": "^0.8.2", - "rimraf": "^3.0.2" - } -}