Skip to content

Publishing: LICENSE files, the terms notice, and the client version - #1013

Merged
Lorenzobattistela merged 5 commits into
mainfrom
publish-license-notice
Sep 23, 2026
Merged

Lorenzobattistela merged 5 commits into
mainfrom
publish-license-notice

Conversation

@Lorenzobattistela

@Lorenzobattistela Lorenzobattistela commented Sep 23, 2026 •

Copy link
Copy Markdown
Collaborator

All changes are in bend --publish (cli_publish, pkg_files in bend2/main.ts). How packages are read, fetched and hashed doesn't change.

What changed

  • LICENSE files. For every directory that holds a published file, a file named exactly LICENSE (case-sensitive; checked with readdirSync, so it works on a case-insensitive disk too) is published at the matching path. It's just one more entry in files, so the hash formula is the same.
  • No LICENSE, warning. If no file is named exactly LICENSE, the CLI warns that the package is MIT-0 and says to put the license in a file named LICENSE beside the entry file. There are no special cases for LICENSE.md, COPYING and so on.
  • license directories are refused. A directory named license in any case (for example License/x.bend) is refused in pkg_files, before the proof of work is mined.
  • Notice on every publish. It goes to stderr before login and mining, with no prompt:
    Publishing to BendHub: public and permanent, under https://bend-lang.com/bender/terms#s18
    License: MIT (LICENSE)
    
    The license comes from the shallowest LICENSE (ties go to the first path in string order). Its SPDX id follows the hub's rule in hubdb.ts, copied exactly: SPDX_RE, only the first 5 lines, at least one letter in the id, runs of whitespace collapsed. If there's no id, the notice says see <path>. The CLI doesn't recognize license titles the way the hub does, so a title-only LICENSE shows see <path>. With no LICENSE, it shows MIT-0, the default (no LICENSE file): …#s18.4.
  • User-Agent: bend/<VERSION>. In CLI mode only, ua_fetch wraps fetch so every request to BEND_HUB or ORIGIN carries it: publish, publish-check, link, register, name lookups, package reads, the Bender login and the version check. Name lookups happen in bend.ts, which isn't edited; the wrapper covers them. Requests to other hosts (a program's own) are left alone.
  • Guide. A paragraph under the import/publish section: put a LICENSE next to the entry file, ideally with an SPDX line; without one the package is MIT-0; you are responsible for what you publish, so pick the right license; adding a LICENSE changes the hash, so publish it as a new version.

Tests (gates/ping.ts)

The gate's Caddy stand-in now serves the store's files under /0x<hash>/, as the real Caddy does, and records every request's method, path and User-Agent. Its new checks, run with the installed executable against the local hub.ts:

  • A LICENSE beside the entry and one beside an imported sub/two.bend are both published. The printed hash equals the hash of all four files, and the hub serves sub/LICENSE.
  • The notice shows the SPDX id (License: MIT (LICENSE)). Each case from the table is also published, and the notice must match the hub's license.id from /package/<hash>.json: a \r\n ending, (MIT OR Apache-2.0) collapsed to one space, # and // markers (no id), MIT <see below> (no id), () (no id), and the SPDX line on the 6th line (no id). With a looser regex in main.ts, the three rows it treats differently fail.
  • With only a LICENSE.md, it isn't published (the hash covers only the .bend files), and the notice shows MIT-0 plus the warning.
  • License/two.bend is refused before mining: exit 1, no "mining" line, no POST reaches the hub.
  • The publish POST, a package manifest read, a /name/ lookup and /check all carry bend/<ver>. With the ua_fetch() call removed, this check fails.

SITE_REPO=~/work/hoc-credits bun gates/ping.ts gives PASS: 32 / 32 (the site checkout is on site-fixes, which has #36). gates/repo.ts gives PASS: 46 / 46 (main.ts is at 9694 of its 10000 ttok cap). tsc finds no errors in main.ts or ping.ts.

Release order

⚠️ The live hub refuses LICENSE files until bend-lang.com PR #36 is deployed. Don't release a CLI with this change until then. The LICENSE check in ping.ts also needs a site checkout that includes #36.

🤖 Generated with Claude Code

Lorenzobattistela and others added 5 commits September 23, 2026 15:49
…directory named license, says on every publish that the hub is public and permanent under its terms and which license the package carries (MIT-0 without a LICENSE, with a warning), and every request to the hub and bend-lang.com carries User-Agent: bend/<version>

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…PDX_RE, the first 5 lines, a letter in the id, spaces collapsed), and the ping gate checks each case against the hub's /package/<hash>.json

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@Lorenzobattistela
Lorenzobattistela merged commit 9e687f3 into main Sep 23, 2026
@Lorenzobattistela
Lorenzobattistela deleted the publish-license-notice branch September 23, 2026 21:35
@Lorenzobattistela Lorenzobattistela mentioned this pull request Sep 23, 2026
Phylliida pushed a commit to Phylliida/bend that referenced this pull request Sep 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant