From e9606b5f6d596d3394881aa3b8e5619f53f4a018 Mon Sep 17 00:00:00 2001 From: "claude@clouddev1" Date: Wed, 17 Jun 2026 21:25:45 +0000 Subject: [PATCH] feat(dist): crates.io + binstall + Windows install.ps1 + license files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Distribution prep on the road to public availability (plan steps 2–3a). - Cargo.toml: publish-ready (drop publish=false; homepage/keywords/ categories/exclude) + [package.metadata.binstall] with per-target overrides (linux-gnu->musl, windows-msvc->gnu/gnullvm). dry-run clean. - scripts/install.ps1: Windows `irm | iex` one-liner — written but untested here (no PowerShell; validate on Windows). README Windows block. - README.md (new); LICENSE-MIT + LICENSE-APACHE (dual, (c) Lazy Evaluation Ltd); CONTRIBUTING.md (inbound=outbound dual-license note). - ADR-0055 Amendment 1 (install.ps1), ADR-0056 (crates.io/binstall), README index + plan updates. The actual `cargo publish` remains a gated maintainer step (token, irreversible) at a new tagged release; real cargo-binstall validation pending. --- CONTRIBUTING.md | 20 ++ Cargo.toml | 41 +++- LICENSE-APACHE | 202 ++++++++++++++++++ LICENSE-MIT | 21 ++ README.md | 98 +++++++++ docs/adr/0055-curl-sh-install-script.md | 15 +- docs/adr/0056-crates-io-and-cargo-binstall.md | 88 ++++++++ docs/adr/README.md | 3 +- docs/plans/20260616-public-availability.md | 33 ++- scripts/install.ps1 | 94 ++++++++ 10 files changed, 603 insertions(+), 12 deletions(-) create mode 100644 CONTRIBUTING.md create mode 100644 LICENSE-APACHE create mode 100644 LICENSE-MIT create mode 100644 README.md create mode 100644 docs/adr/0056-crates-io-and-cargo-binstall.md create mode 100644 scripts/install.ps1 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..a94ee0c --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,20 @@ +# Contributing to rdbms-playground + +Contributions are welcome — bug reports, ideas, and pull requests. The +project lives on Gitea at +; please file issues and +open pull requests there. It's approaching its first public release, so +the most useful contributions right now are bug reports and rough edges +you hit while learning. + +## License of contributions + +Unless you explicitly state otherwise, any contribution you intentionally +submit for inclusion in this project — as defined in the Apache-2.0 +license — shall be **dual-licensed under `MIT OR Apache-2.0`** (the +project's licenses), without any additional terms or conditions. + +This is the standard Rust "inbound = outbound" arrangement: your +contribution is offered under the same licenses the project distributes +under, so — via Apache-2.0 §5 — it carries the Apache-2.0 §3 patent grant +to all users. No separate CLA is required. diff --git a/Cargo.toml b/Cargo.toml index 32408ec..92aa8f6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,8 +5,17 @@ edition = "2024" description = "A cross-platform TUI playground for learning relational databases." license = "MIT OR Apache-2.0" repository = "https://git.lazyeval.net/oli/rdbms-playground" +homepage = "https://relplay.org" readme = "README.md" -publish = false +keywords = ["database", "sql", "tui", "learning", "playground"] +categories = ["command-line-utilities", "database"] +# Keep the published crate to the code that builds the binary — the website, +# decision records, and CI plumbing are repo-only (ADR-0056). +exclude = ["/website", "/docs", "/.gitea", "/.codegraph"] +# `publish = false` removed (ADR-0056): the crate is intended for +# crates.io. The actual `cargo publish` is a deliberate, irreversible +# maintainer step (needs the crates.io token) — do it at a tagged release +# whose assets the binstall metadata below points at. [dependencies] anyhow = "1.0.102" @@ -85,3 +94,33 @@ nursery = { level = "warn", priority = -1 } module_name_repetitions = "allow" missing_errors_doc = "allow" missing_panics_doc = "allow" + +# cargo-binstall (ADR-0056): let `cargo binstall rdbms-playground` fetch the +# prebuilt release binary instead of compiling from source. Our release assets +# are BARE binaries (no archive) named `rdbms-playground-v-` +# (`.exe` on Windows) with `.sha256` sidecars (ADR-ci-003), so `pkg-fmt = "bin"`. +# `{ version }` excludes the leading `v`, so the template spells `v{ version }`. +# +# Target mapping: macOS host triples match our asset triples directly. But we +# ship the fully-static *-linux-MUSL build (glibc hosts are *-linux-gnu) and +# *-windows-GNU/GNULLVM (most Windows hosts are *-msvc), so those common host +# triples need explicit overrides pointing at the asset we actually publish. +# +# NOTE: unverified against a real `cargo binstall` run (binstall isn't a dep and +# nothing is on crates.io yet) — validate at the first publish + matching release. +[package.metadata.binstall] +pkg-url = "{ repo }/releases/download/v{ version }/{ name }-v{ version }-{ target }{ archive-suffix }" +pkg-fmt = "bin" +bin-dir = "{ bin }{ binary-ext }" + +[package.metadata.binstall.overrides.x86_64-unknown-linux-gnu] +pkg-url = "{ repo }/releases/download/v{ version }/{ name }-v{ version }-x86_64-unknown-linux-musl" + +[package.metadata.binstall.overrides.aarch64-unknown-linux-gnu] +pkg-url = "{ repo }/releases/download/v{ version }/{ name }-v{ version }-aarch64-unknown-linux-musl" + +[package.metadata.binstall.overrides.x86_64-pc-windows-msvc] +pkg-url = "{ repo }/releases/download/v{ version }/{ name }-v{ version }-x86_64-pc-windows-gnu.exe" + +[package.metadata.binstall.overrides.aarch64-pc-windows-msvc] +pkg-url = "{ repo }/releases/download/v{ version }/{ name }-v{ version }-aarch64-pc-windows-gnullvm.exe" diff --git a/LICENSE-APACHE b/LICENSE-APACHE new file mode 100644 index 0000000..a57cdc8 --- /dev/null +++ b/LICENSE-APACHE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2026 Lazy Evaluation Ltd + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/LICENSE-MIT b/LICENSE-MIT new file mode 100644 index 0000000..cf46631 --- /dev/null +++ b/LICENSE-MIT @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 Lazy Evaluation Ltd + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..37c7550 --- /dev/null +++ b/README.md @@ -0,0 +1,98 @@ +# rdbms-playground + +A cross-platform terminal app for **learning relational database +concepts** — tables, columns, primary and foreign keys, relationships, +indexes, queries, and query plans — in a safe sandbox. + +It's a teaching tool, not a database administration tool. It meets +beginners with guided, keyword-based commands (**simple mode**) and grows +with them to raw SQL (**advanced mode**), so the same playground works +from "what is a primary key?" through to writing real queries and reading +their execution plans. + +Website & documentation: **** + +## Install + +### One line (Linux / macOS) + +```sh +curl -fsSL https://git.lazyeval.net/oli/rdbms-playground/raw/branch/main/scripts/install.sh | sh +``` + +Detects your OS and CPU, downloads the matching release binary, verifies +its SHA-256 checksum, and installs it to `~/.local/bin`. Set +`RDBMS_INSTALL_DIR` to install elsewhere, or `RDBMS_VERSION=vX.Y.Z` to +pin a version. (Prefer to read before you run? The script lives at +`scripts/install.sh`.) + +### One line (Windows, PowerShell) + +```powershell +irm https://git.lazyeval.net/oli/rdbms-playground/raw/branch/main/scripts/install.ps1 | iex +``` + +Downloads the matching `.exe`, verifies its checksum, installs to +`%LOCALAPPDATA%\Programs\rdbms-playground`, and adds it to your user +PATH. Or use a package manager (Scoop / winget) once those land. + +### With `cargo binstall` + +If you have [`cargo-binstall`](https://github.com/cargo-bins/cargo-binstall) +(install it first — it is not part of `cargo` itself): + +```sh +cargo binstall rdbms-playground +``` + +### From source + +```sh +cargo install rdbms-playground # from crates.io +# or, from a clone: +cargo build --release # binary at target/release/rdbms-playground +``` + +### Prebuilt binaries + +Every release publishes static Linux, standalone Windows, and macOS +binaries (x86_64 and aarch64) with `.sha256` checksums on the +[releases page](https://git.lazyeval.net/oli/rdbms-playground/releases). +Windows users can also use the binary directly (package-manager support +is planned). + +## A quick taste + +``` +create table Customers with pk id(serial) +add column Customers: name (text) +add column Customers: email (text) +insert into Customers values ('Ann', 'ann@example.io') +show data Customers +``` + +Press **F1** while typing for a contextual hint about the command you're +building, or type `help` for the full command list. Switch to raw SQL +with `mode advanced` (or prefix a single line with `:`). + +## Project status + +Approaching its first public release. See the website for current +features; installation via package managers (Homebrew, Scoop, winget) is +on the roadmap. + +## License + +Dual-licensed under either of + +- MIT license ([LICENSE-MIT](LICENSE-MIT)) +- Apache License 2.0 ([LICENSE-APACHE](LICENSE-APACHE)) + +at your option. + +## Contribution + +Unless you explicitly state otherwise, any contribution intentionally +submitted for inclusion in the work by you, as defined in the Apache-2.0 +license, shall be dual-licensed as above, without any additional terms or +conditions. See [CONTRIBUTING.md](CONTRIBUTING.md). diff --git a/docs/adr/0055-curl-sh-install-script.md b/docs/adr/0055-curl-sh-install-script.md index 436e3c7..bc447a1 100644 --- a/docs/adr/0055-curl-sh-install-script.md +++ b/docs/adr/0055-curl-sh-install-script.md @@ -52,11 +52,22 @@ Ship **`scripts/install.sh`**, run as but adds a moving part; the **Gitea repo raw URL** is simplest and the binaries live there anyway (user decision). The website may later *reference* the same command. -- **`install.ps1` (Windows):** deferred — Windows users go via Scoop / - winget (D3, §3). - **Uploading `install.sh` as a release asset** for a stable link: optional; the branch raw URL is fine for now. +## Amendment 1 — `install.ps1` (Windows) added (2026-06-17) + +Windows was originally deferred to Scoop/winget; the user opted for **both** +a PowerShell one-liner now *and* package managers later. Added +**`scripts/install.ps1`** (`irm | iex`): maps the host CPU to our +`*-windows-gnu`/`-gnullvm` `.exe`, resolves the latest release (or +`-Version`/`RDBMS_VERSION`), downloads + **SHA-256-verifies**, installs to +`%LOCALAPPDATA%\Programs\rdbms-playground` (`-InstallDir`/`RDBMS_INSTALL_DIR` +override), and adds that dir to the **user PATH**. **Caveat:** unlike +`install.sh` (verified end-to-end), this was **written but not tested from +this environment** (no PowerShell available) — validate on a real Windows +host. Scoop/winget (D3) remain the idiomatic package-manager routes. + ## Consequences - A first-time user runs one line and gets a checksum-verified binary on diff --git a/docs/adr/0056-crates-io-and-cargo-binstall.md b/docs/adr/0056-crates-io-and-cargo-binstall.md new file mode 100644 index 0000000..a10d8ed --- /dev/null +++ b/docs/adr/0056-crates-io-and-cargo-binstall.md @@ -0,0 +1,88 @@ +# ADR-0056: crates.io publish-readiness + `cargo binstall` metadata (D3) + +## Status + +Accepted — **prepared 2026-06-17** (plan: +`docs/plans/20260616-public-availability.md`, step 3a). The crate is made +**ready to publish** and carries `cargo-binstall` metadata. The actual +`cargo publish` is a gated maintainer step (see Ordering). First D3 +package-manager mechanism; builds on ADR-0054 (versioned releases), +ADR-0055 (installer), ADR-ci-003 (release assets). Tracked by plan + ADR +(no Gitea issue — user decision). + +## Context + +`cargo binstall rdbms-playground` (and `cargo install`) need the crate on +**crates.io** (user decision, 2026-06-17). The manifest had +`publish = false`, a `readme = "README.md"` pointing at a **missing** +file, and no `keywords`/`categories`. Our release assets are **bare +binaries** (not archives) named `rdbms-playground-v-` +(`.exe` on Windows) with `.sha256` sidecars (ADR-ci-003); critically the +**release target triples differ from users' host triples** — we ship the +static `*-linux-musl` build (hosts are `*-linux-gnu`) and +`*-windows-gnu`/`-gnullvm` (hosts are `*-msvc`); only macOS matches. + +## Decision + +**Publish-readiness (this change):** +- Drop `publish = false`; add `homepage = "https://relplay.org"`, + `keywords`, `categories = ["command-line-utilities", "database"]`, and + an `exclude` (`/website`, `/docs`, `/.gitea`, `/.codegraph`) so the + published crate is code-only (585 files/8.3 MiB → 353/913 KiB + compressed). +- Author **`README.md`** (the `readme` target + crates.io front page; + engine-neutral and "simple/advanced mode" wording per ADR-0002 / the + website copy rules), with install instructions (curl|sh, binstall, + source, prebuilt). +- Add **`LICENSE-MIT`** and **`LICENSE-APACHE`** (the latter the verbatim + canonical text, added by the maintainer; both © Lazy Evaluation Ltd — + the publication entity), and a **`CONTRIBUTING.md`** stating the + "inbound = outbound" dual-license arrangement (so Apache-2.0 §5 makes + the §3 patent grant explicit on the self-hosted forge). Dual license + kept (not MIT-only) — user decision after reviewing the patent-grant + rationale. + +**`cargo binstall` metadata** (`[package.metadata.binstall]`, syntax +verified against cargo-binstall SUPPORT.md): +- `pkg-fmt = "bin"` (bare binary), `bin-dir = "{ bin }{ binary-ext }"`, + and a base `pkg-url` using `v{ version }` (the `{ version }` placeholder + excludes the leading `v`). +- **Per-target `overrides`** mapping the common host triples to the asset + we actually publish: `x86_64`/`aarch64-unknown-linux-gnu` → the `-musl` + asset; `x86_64`/`aarch64-pc-windows-msvc` → the `-gnu`/`-gnullvm` + `.exe`. macOS needs no override (host triple == asset triple). The docs + do **not** promise automatic musl/gnu or msvc/gnu fallback, hence + explicit overrides. + +**Ordering / gating (important):** +- `cargo publish` is **irreversible** (needs the crates.io token; a + version can't be un-published, only yanked) — a deliberate **maintainer + step**, not done here. +- binstall's `pkg-url` resolves to a **tagged release's** assets, so + publish **at a new tagged version whose release already exists**, and + publish **after** that release is built. **Do not publish `0.1.0`** — it + would diverge from the already-released `0.1.0` binaries (which predate + `--version`, ADR-0054). The clean path: bump → tag → release builds → + `cargo publish`. + +## Verification + +- `cargo publish --dry-run --allow-dirty` packages + verify-builds cleanly + (353 files, 913 KiB compressed; no metadata errors). +- `cargo metadata` confirms the `binstall` block + all four `overrides` + parse. +- **Unverified:** an actual `cargo binstall` run — cargo-binstall isn't a + dependency and nothing is on crates.io yet. **Validate at the first + publish + matching release** (especially the windows-msvc→gnu and + linux-gnu→musl overrides). + +## Consequences + +- The crate can be published at the next tagged release with `cargo + publish` (+ the token); `cargo install rdbms-playground` and `cargo + binstall rdbms-playground` then work. +- Remaining D3: Scoop, Homebrew (`lazyeval` tap), winget (komac/manual) — + each a manifest + a per-release bump, tracked in the plan. +- Remaining follow-up: run the real `cargo binstall` validation at the + first publish + matching release (the license files, © holder, and + CONTRIBUTING are now in place). diff --git a/docs/adr/README.md b/docs/adr/README.md index 6539a94..213c4de 100644 --- a/docs/adr/README.md +++ b/docs/adr/README.md @@ -67,4 +67,5 @@ This directory contains the project's ADRs, recorded per - [ADR-0052 — Mode-tagged history for cross-mode recall](0052-mode-tagged-history-cross-mode-recall.md) — **Accepted + implemented 2026-06-13 (issue #30)**, closes Gitea **#30** — the feature (advanced history reusable in simple mode) **and** the bug in its comment (the `:` one-shot prefix lost across sessions). **Amends ADR-0034** (status field gains a `:adv` tag; **journaling moves from the worker to the dispatch layer**), **ADR-0015 §5/§6** (history.log leaves the worker transaction — `commit-db-last` now scopes yaml/csv/db only), and **ADR-0040** (a success-path journal-write failure is best-effort, not fatal); references ADR-0003. **Root cause:** history carried no mode, and the in-memory ring stored the raw `:select 1` while the worker journalled the *stripped* `select 1`, so the `:` was lost on disk. **Fix:** record the submission mode per entry as a **`:adv` suffix on the status token** (`ok`/`ok:adv`/`err`/`err:adv`) — `source` stays last + canonical so replay is unaffected; the in-memory ring (still `Vec`) stores advanced entries in their `: `-prefixed simple-mode runnable form (a leading `:` unambiguously marks advanced since simple DSL never starts with `:`); recall **strips the `:` in advanced mode** (runs as bare SQL) and keeps it in simple mode (runs via the one-shot escape); hydration reconstructs the `: `-prefix from the tag, so cross-session = in-session. **The architectural turn (user's call):** the first draft kept journaling in the worker + threaded the mode down (~30-site plumbing); on review the user asked why the journal is written deep in the worker when the *failure* path already journals at the top of the chain — it shouldn't (history.log is a journal, not state). So **success journaling moved up** to `spawn_dsl_dispatch` / `run_replay` / the app-command sites (next to the failure path), the worker's `finalize_persistence` now writes only yaml/csv, and the journal write became **best-effort** (the command is already committed — consistent with the failure path; a rare disk-full leaves a committed command unjournalled, state intact). **App commands** journal simple (dispatched outside the spawn) and `submit` excludes them from the ring's advanced flag, so `undo`/`mode advanced` recall bare. Forks user-chosen: status-tag format (vs 4th field / `:`-in-source); unified scope; **dispatch-layer best-effort journaling** (vs worker-coupled-fatal). Two `/runda` passes (the second drove the relocation + app-command exclusion). Tests: the 15 worker-level journaling tests retired (worker no longer journals — yaml/csv/operation checks kept), re-covered at the new layer (history.rs status-tag + `:`-reconstruct; app.rs recall matrix; the #30 cross-session regression in `iteration6`; replay tests cover `run_replay` journaling). **2471 pass / 0 fail / 0 skip (1 ignored), clippy clean.** replay re-journaling mode-fidelity (a replayed advanced line re-journals simple — not a regression). **Follow-up done 2026-06-14:** the vestigial worker `source` plumbing was fully unwound (compiler-guided, no behaviour change) — `_source` removed from `finalize_persistence`/`do_rebuild_from_text`, the three `*_request` wrappers inlined+deleted, the dead `source` param dropped from the ~30 forwarding worker handlers, and the `source` field removed from the `DescribeTable`/`QueryData`/`RunSelect` requests + their `DatabaseHandle` methods (~164 mostly-test call sites); the only worker `source` left is the snapshot/undo label (see ADR-0052 *Consequences*) - [ADR-0053 — Contextual `hint` command and keybinding](0053-contextual-hint-command-and-keybinding.md) — **Accepted, implemented 2026-06-15** (Phases A–D; closes **A1** + requirements **H2**). Settles the `hint` slot ADR-0003 left "ADR pending"; closes the last open piece of **A1** and tracks requirements **H2**. **Two surfaces:** an **F1 keybinding** that renders a deep hint for the *live* partial input without submitting (the primary path — a submitted `hint` command can't see the buffer it would help with, since Enter empties it), and a submitted **`hint` command** that expands on the *most recent error*. **No topic argument** (contextual only — `help ` already owns explicit reference). Introduces a **tier-3 teaching layer**, deeper than the existing tier-1 (colour / error headline) and tier-2 (ambient one-liner; and the error `hint:`, which is shown **by default** since `Verbosity::Verbose` is the default — `messages short` is the opt-*out*); without it `hint` would just duplicate what's already on screen. Tier-3 content lives in the catalogue under `hint.cmd.` (per command form) and `hint.err.` (per error/diagnostic class), each a structured `what`/`example`/`concept` block rendered via a new `note_hint*` family with `OutputStyleClass::Hint`. **Keyed per-form via a new `hint_ids: &[&str]` field on `CommandNode` mirroring `usage_ids`** (revised in Phase B): a per-*node* key proved too coarse — `add`/`drop`/`show`/`create` are each one node spanning many forms, and a live-input hint for `add 1:n relationship` must be specific to relationships; `hint_key_for_input_in_mode` reuses `usage_key_for_input_in_mode`'s form-word disambiguation, and covers the advanced-SQL forms whose `usage_ids` are empty. Not keyed off `help_id` (it is `None` on the advanced-SQL nodes purely to dedup the `help` list; that parallel gap is issue **#36**). **Clause-concept hints** (`on delete` actions, constraint slots, `with pk`, cardinality) are a recorded **deferred extension** (`hint.concept.`, issue **#37**) — per-form is the right tier-3 granularity, with position-awareness owned by tier-2 + the live `Next:` line. Runtime `translate_error` classes resolve via stored `last_error_hint_key` (`hint` command / empty-F1). (The second route — pre-submit `diagnostic.*` read live from the walker on the F1 path — is **deferred**, issue **#38**: `Diagnostic` carries no class key.) Adds `AppCommand::Hint`, a `HINT` grammar node + REGISTRY entry, the `hint_ids` field, and `last_error_hint_key`; F1 is a read-only overlay (buffer + completion memo untouched). **Content is the bulk of the work** (the mechanism is ~a day): v1 scope = ~37 command forms + 9 runtime error classes (comprehensive for those, ~57 blocks), authored **exemplars-first** (voice approved in this ADR's `/runda` review, then mass-authored in batches), enforced by a **comprehensiveness coverage test**, with graceful fall-back to tier-2 if a key is ever missing. The **pre-submit-diagnostic route + ~33 `diagnostic.*` blocks were deferred** (issue **#38**) — `Diagnostic` carries no class key, so the route needs a broad change for marginal value (tier-2 already surfaces diagnostics; many duplicate runtime classes). Forks user-chosen: two-surface model; **F1** (vs `?` / a chord); no-arg; comprehensive-for-commands-and-errors scope; exemplars-first; diagnostics deferred. OOS: per-topic `hint ` (rejected — overlaps `help`); always-on tier-3 (rejected — keeps ambient terse); non-`en-US` locales + success-command teaching (deferred); clause-concept hints (issue #37); the diagnostic route (issue #38); the `help`-side advanced-SQL gap (issue #36) - [ADR-0054 — Release versioning policy + version surfaces (`--version` / `version`)](0054-release-versioning-and-version-surfaces.md) — **Accepted + implemented 2026-06-16** (plan: `docs/plans/20260616-public-availability.md`, step 1 on the road to public availability; no prior issue/`requirements.md` item — an untracked gap). Fixes the **tag↔crate-version decoupling**: `Cargo.toml` built `0.1.0` while `release.yaml` named assets from the git tag, so a binary could report a version different from the asset it shipped in. **Decision:** `Cargo.toml` `version` is the **single source of truth** (read via `env!("CARGO_PKG_VERSION")`, no tag-injection); two surfaces report it through one `cli::version_text()` → catalog `cli.version_line` — a **`--version` / `-V`** CLI flag (mirrors `--help`, prints+exits in `main.rs`) and an in-app **`version`** command (REGISTRY node `app::VERSION`, `AppCommand::Version`, emits via `note_system`); and a **release-CI version guard** (`release.yaml` `test` job parses `cargo metadata` and **fails the release** unless the `v*` tag equals `v`). Release ritual: bump `Cargo.toml` → commit → tag → push. New keys `cli.version_line` + `help.app.version` + `parse.usage.version` + `hint.cmd.version.{what,example}` (the new REGISTRY command pulls in the comprehensiveness coverage gate). Rejected: tag-as-source (makes Cargo.toml lie). Deferred: git-hash/build-date enrichment (behind the same `version_text()` seam); UI placement beyond the command. Tested test-first: CLI parse (`--version`/`-V`/default-off), `version_text()` carries `CARGO_PKG_VERSION`, the in-app command parses + emits. Also corrected a stale `release.yaml` header comment ("macOS is deferred" → built by the dispatched `release-macos.yaml`). -- [ADR-0055 — `curl | sh` install script (`scripts/install.sh`)](0055-curl-sh-install-script.md) — **Accepted + implemented 2026-06-17** (plan: `docs/plans/20260616-public-availability.md`, step 2; tracked by plan + ADR, no Gitea issue — user decision). A one-line installer (`curl -fsSL /scripts/install.sh | sh`) so beginners don't hand-pick an asset + `chmod +x`. **POSIX `sh`** (shellcheck-clean), detects `uname` OS/arch → target triple (**Linux → the fully-static `*-musl`** build, macOS → `*-apple-darwin`; `amd64`/`arm64` aliased; **Windows rejected** → Scoop/winget/releases page), resolves the version from the **`releases/latest`** API (or `RDBMS_VERSION` to pin), downloads the asset **and its `.sha256` and verifies it** (mismatch aborts), installs to `~/.local/bin` (`RDBMS_INSTALL_DIR` override) with a PATH hint. Testing seams: `RDBMS_OS`/`RDBMS_ARCH` + `--print-target`. macOS note: `curl` downloads aren't Gatekeeper-quarantined so the ad-hoc binary runs as-is (Developer-ID + notarization is the postponed signing task). **Verified end-to-end against the live public `v0.1.0`** (all platform mappings, pinned + latest, checksum incl. tamper-rejection, install + run). Rejected: website-domain hosting (extra moving part; Gitea raw is simplest); deferred: `install.ps1`, uploading the script as a release asset, and a **shellcheck CI gate** (shellcheck isn't in the flake — touches ADR-ci-002). +- [ADR-0055 — `curl | sh` install script (`scripts/install.sh`)](0055-curl-sh-install-script.md) — **Accepted + implemented 2026-06-17** (plan: `docs/plans/20260616-public-availability.md`, step 2; tracked by plan + ADR, no Gitea issue — user decision). A one-line installer (`curl -fsSL /scripts/install.sh | sh`) so beginners don't hand-pick an asset + `chmod +x`. **POSIX `sh`** (shellcheck-clean), detects `uname` OS/arch → target triple (**Linux → the fully-static `*-musl`** build, macOS → `*-apple-darwin`; `amd64`/`arm64` aliased; **Windows rejected** → Scoop/winget/releases page), resolves the version from the **`releases/latest`** API (or `RDBMS_VERSION` to pin), downloads the asset **and its `.sha256` and verifies it** (mismatch aborts), installs to `~/.local/bin` (`RDBMS_INSTALL_DIR` override) with a PATH hint. Testing seams: `RDBMS_OS`/`RDBMS_ARCH` + `--print-target`. macOS note: `curl` downloads aren't Gatekeeper-quarantined so the ad-hoc binary runs as-is (Developer-ID + notarization is the postponed signing task). **Verified end-to-end against the live public `v0.1.0`** (all platform mappings, pinned + latest, checksum incl. tamper-rejection, install + run). Rejected: website-domain hosting (extra moving part; Gitea raw is simplest); deferred: uploading the script as a release asset, and a **shellcheck CI gate** (shellcheck isn't in the flake — touches ADR-ci-002). **Amendment 1 (2026-06-17):** added a Windows **`scripts/install.ps1`** (`irm | iex`; maps host CPU → our `*-windows-gnu`/`-gnullvm` `.exe`, SHA-256-verifies, installs to `%LOCALAPPDATA%\Programs\…` + user PATH) — user chose both a one-liner *and* Scoop/winget; **written but untested from this env** (no PowerShell — validate on Windows). +- [ADR-0056 — crates.io publish-readiness + `cargo binstall` metadata (D3)](0056-crates-io-and-cargo-binstall.md) — **Prepared 2026-06-17** (plan step 3a; tracked by plan + ADR). Makes the crate **ready to publish** to crates.io (user decision) and adds `cargo-binstall` metadata; the actual `cargo publish` is a **gated, irreversible maintainer step**. Manifest: drops `publish = false`; adds `homepage` (relplay.org), `keywords`, `categories`, and an `exclude` (`/website`,`/docs`,`/.gitea`,`/.codegraph`) trimming the crate from 585 files/8.3 MiB → **353/913 KiB compressed** (code-only). Authors **`README.md`** (engine-neutral, simple/advanced-mode wording; install via curl|sh/binstall/source/prebuilt) and **`LICENSE-MIT`** (© Lazy Evaluation Ltd — *confirm holder*); the canonical **`LICENSE-APACHE`** is deferred to the maintainer (don't ship retyped legal text) — the SPDX `license` field already satisfies crates.io. **binstall** (syntax verified vs cargo-binstall SUPPORT.md): `pkg-fmt = "bin"` (bare binaries), `pkg-url` spelled `v{ version }` (the placeholder omits the `v`), plus per-target **`overrides`** mapping the common host triples to the assets we ship — `*-linux-gnu` → the static `*-linux-musl` build, `*-pc-windows-msvc` → `*-gnu`/`-gnullvm` `.exe` (macOS matches directly; the docs promise no automatic fallback). **Ordering:** publish at a **new tagged version whose release exists**, after the release — **not `0.1.0`** (diverges from the already-released 0.1.0 binaries that predate `--version`). Verified: `cargo publish --dry-run` packages + verify-builds; `cargo metadata` confirms the binstall block + 4 overrides. **Unverified:** a real `cargo binstall` run (not a dep; nothing on crates.io yet) — validate at first publish. Rejected: cargo-dist (GitHub-centric). Maintainer follow-ups: confirm © holder, add canonical `LICENSE-APACHE`, real binstall validation. diff --git a/docs/plans/20260616-public-availability.md b/docs/plans/20260616-public-availability.md index 704d0c7..b5b9c25 100644 --- a/docs/plans/20260616-public-availability.md +++ b/docs/plans/20260616-public-availability.md @@ -39,9 +39,13 @@ end-to-end against the live public `v0.1.0` release: platform mappings (Linux/macOS × x86_64/aarch64; Windows + unknown arch error cleanly), pinned (`RDBMS_VERSION`) and latest (`releases/latest`) paths, SHA-256 verification (incl. a tamper-rejection check), install to -`~/.local/bin`, PATH hint. **`install.ps1` (Windows) deferred** — Windows -users go via Scoop/winget (§3). The website copy that references the -`curl` command is the **website branch's** job (separate agent), later. +`~/.local/bin`, PATH hint. **`install.ps1` (Windows) added 2026-06-17** +(user chose both a one-liner *and* Scoop/winget; ADR-0055 Amendment 1): +`irm | iex`, maps host CPU → our `*-windows-gnu`/`-gnullvm` `.exe`, +SHA-256-verifies, installs to `%LOCALAPPDATA%\Programs\…` + user PATH — +**written but untested from this env** (no PowerShell; validate on +Windows). The website copy that references these commands is the +**website branch's** job (separate agent), later. A **shellcheck CI gate** for `scripts/` is a recommended follow-up (not added — shellcheck isn't in the flake yet; touches ADR-ci-002). @@ -78,7 +82,18 @@ Original decided shape (for reference): Common thread: a manifest pointing at our checksummed assets + a per-release step to bump it. Ordered cheapest → most gatekept. -### 3a. `cargo binstall` +### 3a. `cargo binstall` + crates.io — PREPARED 2026-06-17 (ADR-0056) + +**Done (prep):** crate made publish-ready (dropped `publish = false`; +added `homepage`/`keywords`/`categories`/`exclude`; authored `README.md` ++ `LICENSE-MIT`); `[package.metadata.binstall]` added with per-target +overrides (linux-gnu→musl, windows-msvc→gnu/gnullvm; macOS direct); +`cargo publish --dry-run` clean (913 KiB compressed). Dual license kept; +`LICENSE-MIT` + `LICENSE-APACHE` (© Lazy Evaluation Ltd) + `CONTRIBUTING.md` +(inbound=outbound) all in place. **Gated / remaining:** the actual `cargo +publish` (token, irreversible) at a **new tagged release** (not 0.1.0); a +real `cargo binstall` validation. + - **Bootstrapping matters (user-flagged):** `binstall` is **not** a built-in cargo subcommand — users must install **`cargo-binstall`** first (its own `curl|sh`/PowerShell installer, or @@ -167,10 +182,12 @@ per-release step to bump it. Ordered cheapest → most gatekept. command + CI tag-match guard + tests. 2. ✅ **`scripts/install.sh`** (ADR-0055) — built + verified against the live public release. -3. **← next:** package managers, cheapest first: `cargo binstall` - (+ crates.io publish) + Scoop → Homebrew (`lazyeval` tap) → winget - (komac / manual). Two `lazyeval` repos (tap + bucket) + CI push creds - to set up. +3. Package managers, cheapest first: + - ✅ **`cargo binstall` + crates.io** — *prepared* (ADR-0056); + publish gated on a new tagged release + the token. + - **← next:** Scoop (`lazyeval` bucket) → Homebrew (`lazyeval` tap) → + winget (komac / manual). Two `lazyeval` repos (tap + bucket) + CI + push creds to set up. 4. **Cut a release at a new version** — bump `Cargo.toml` (0.1.0 → 0.1.1/0.2.0; the ADR-0054 guard checks the tag), tag, push; the four Linux/Windows targets build immediately. (macOS leg awaits signing.) diff --git a/scripts/install.ps1 b/scripts/install.ps1 new file mode 100644 index 0000000..b2ffe2c --- /dev/null +++ b/scripts/install.ps1 @@ -0,0 +1,94 @@ +<# +.SYNOPSIS + Download and install a prebuilt rdbms-playground binary (Windows). + +.DESCRIPTION + The Windows counterpart of scripts/install.sh. Detects the CPU + architecture, downloads the matching release .exe from the Gitea + releases, verifies its SHA-256 checksum, installs it to + %LOCALAPPDATA%\Programs\rdbms-playground, and adds that directory to + your user PATH. + + Quick start: + irm https://git.lazyeval.net/oli/rdbms-playground/raw/branch/main/scripts/install.ps1 | iex + + We ship gnu / gnullvm Windows builds (x86_64 / aarch64); this maps the + host architecture to the right asset. + +.PARAMETER Version + Install a specific tag (e.g. v0.2.0) instead of the latest release. + Defaults to $env:RDBMS_VERSION, else the latest release. + +.PARAMETER InstallDir + Install directory. Defaults to $env:RDBMS_INSTALL_DIR, else + %LOCALAPPDATA%\Programs\rdbms-playground. + +.NOTES + Written but NOT tested on Windows from this environment (no PowerShell + here) — validate on a real Windows host. The verified sibling is + install.sh (Linux/macOS). +#> +[CmdletBinding()] +param( + [string]$Version = $env:RDBMS_VERSION, + [string]$InstallDir = $(if ($env:RDBMS_INSTALL_DIR) { $env:RDBMS_INSTALL_DIR } else { "$env:LOCALAPPDATA\Programs\rdbms-playground" }) +) + +Set-StrictMode -Version Latest +$ErrorActionPreference = 'Stop' + +$Repo = 'https://git.lazyeval.net/oli/rdbms-playground' +$Api = 'https://git.lazyeval.net/api/v1/repos/oli/rdbms-playground' +$Bin = 'rdbms-playground' + +# Map the host CPU to the target triple we publish for Windows. +$osArch = [System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture +switch ($osArch) { + 'X64' { $target = 'x86_64-pc-windows-gnu' } + 'Arm64' { $target = 'aarch64-pc-windows-gnullvm' } + default { throw "install: unsupported CPU architecture: $osArch" } +} + +# Resolve the release tag (explicit -Version, else the latest release). +if (-not $Version) { + $Version = (Invoke-RestMethod -Uri "$Api/releases/latest").tag_name + if (-not $Version) { throw 'install: could not determine the latest release tag' } +} + +$asset = "$Bin-$Version-$target.exe" +$url = "$Repo/releases/download/$Version/$asset" + +$tmp = Join-Path $env:TEMP ([System.Guid]::NewGuid().ToString()) +New-Item -ItemType Directory -Path $tmp -Force | Out-Null +try { + $exe = Join-Path $tmp "$Bin.exe" + $shaFile = "$exe.sha256" + + Write-Host "downloading $asset ..." + Invoke-WebRequest -Uri $url -OutFile $exe + Invoke-WebRequest -Uri "$url.sha256" -OutFile $shaFile + + # The sidecar is " "; compare just the hash. + $expected = ((Get-Content -Raw $shaFile) -split '\s+')[0].ToLower() + $actual = (Get-FileHash -Algorithm SHA256 -Path $exe).Hash.ToLower() + if ($expected -ne $actual) { + throw "install: checksum mismatch (expected $expected, got $actual) — refusing to install" + } + + New-Item -ItemType Directory -Path $InstallDir -Force | Out-Null + $dest = Join-Path $InstallDir "$Bin.exe" + Move-Item -Path $exe -Destination $dest -Force + Write-Host "installed $Bin $Version -> $dest" + + # Add the install dir to the user PATH (persistent) if it's not there. + $userPath = [Environment]::GetEnvironmentVariable('Path', 'User') + if (-not $userPath) { $userPath = '' } + if (($userPath -split ';') -notcontains $InstallDir) { + $newPath = if ($userPath) { "$userPath;$InstallDir" } else { $InstallDir } + [Environment]::SetEnvironmentVariable('Path', $newPath, 'User') + Write-Host "added $InstallDir to your user PATH — restart your shell to pick it up" + } +} +finally { + Remove-Item -Path $tmp -Recurse -Force -ErrorAction SilentlyContinue +}