diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index aba8873..4d21e61 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -99,7 +99,7 @@ jobs: echo "IMAGE=${REGISTRY}/$(echo "${GITHUB_REPOSITORY}" | tr '[:upper:]' '[:lower:]')" >> "$GITHUB_ENV" echo "$REGISTRY_TOKEN" | docker login "$REGISTRY" -u "$OWNER" --password-stdin - name: Build - run: docker build -t "${IMAGE}:${VERSION}" -t "${IMAGE}:latest" . + run: docker build --build-arg VERSION="${VERSION}" -t "${IMAGE}:${VERSION}" -t "${IMAGE}:latest" . - name: Push run: | docker push "${IMAGE}:${VERSION}" diff --git a/CHANGELOG.md b/CHANGELOG.md index 1d38172..6751bf3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,20 @@ All notable changes to this project will be documented in this file. +## 1.22.2 - 2026-10-01 + +Changes since 1.22.1: + +### Added + +- MIT license (`LICENSE`), declared in all `package.json` files and the README. +- The Docker image includes the license notices of everything it ships: `scripts/third-party-licenses.mjs` collects the license of every production dependency of the client and server, the Node.js license is added, and the result is served at `/licenses.txt`, linked as "Licenses" in the sidebar footer. +- OCI image labels for title, version, license and source; CI passes the version as the `VERSION` build arg. + +### Fixed + +- The Docker image keeps packages' `LICENSE.md`/`NOTICE.md` files, which the 1.22.1 slimming step deleted along with other Markdown files. + ## 1.22.1 - 2026-10-01 Changes since 1.22.0: diff --git a/Dockerfile b/Dockerfile index 67b4c7e..1fdd5d0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -42,25 +42,57 @@ COPY server/package.json ./server/ # needed, and neither is ffmpeg (only used for video recording). # # Then drop what nothing loads at runtime: source maps, TypeScript sources and -# declarations, docs, TypeORM's browser build and better-sqlite3's C sources -# (the addon is already compiled). +# declarations, docs (but not license files), TypeORM's browser build and +# better-sqlite3's C sources (the addon is already compiled). ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright RUN npm ci --omit=dev -w server \ && npx playwright install --only-shell chromium \ && rm -rf /ms-playwright/ffmpeg-* \ && find node_modules -type f \( \ -name '*.map' -o -name '*.ts' -o -name '*.mts' -o -name '*.cts' \ - -o -iname '*.md' -o -iname '*.markdown' \ + -o \( \( -iname '*.md' -o -iname '*.markdown' \) \ + ! -iname 'licen[cs]e*' ! -iname 'notice*' ! -iname 'copying*' \) \ \) -delete \ && rm -rf node_modules/typeorm/browser \ node_modules/better-sqlite3/deps \ node_modules/better-sqlite3/src +# ── License notices ─────────────────────────────────────────────────────────── +# One file with the project's LICENSE and the license of everything the image +# ships: the production dependencies of both workspaces (the client's are +# bundled into its build, so their license files aren't in the image +# otherwise) and the Node.js binary, whose LICENSE the node image doesn't +# include. +FROM node:24-slim AS licenses + +WORKDIR /app + +COPY package*.json LICENSE ./ +COPY client/package.json ./client/ +COPY server/package.json ./server/ +COPY scripts/third-party-licenses.mjs ./scripts/ +RUN npm ci --omit=dev --ignore-scripts \ + && node scripts/third-party-licenses.mjs > licenses.txt \ + && node -e ' \ + const url = `https://raw.githubusercontent.com/nodejs/node/v${process.versions.node}/LICENSE`; \ + fetch(url).then(async (r) => { \ + if (!r.ok) throw new Error(`${url}: ${r.status}`); \ + const rule = "-".repeat(79); \ + process.stdout.write(`\n${rule}\n\nnode@${process.versions.node}\nLicense: MIT\n\n${(await r.text()).trim()}\n`); \ + }).catch((e) => { console.error(e.message); process.exit(1); });' >> licenses.txt + # ── Runtime ─────────────────────────────────────────────────────────────────── # Plain Debian with just the node binary: npm, yarn, corepack and the C # headers that come with the node image aren't needed to run the app. FROM debian:bookworm-slim AS runtime +# Set by CI from the root package.json version +ARG VERSION=dev +LABEL org.opencontainers.image.title="liqa" \ + org.opencontainers.image.version="${VERSION}" \ + org.opencontainers.image.licenses="MIT" \ + org.opencontainers.image.source="https://git.hq.ars9.space/ars9/liqa" + # Runtime only: in the build stages it would make npm ci skip devDependencies ENV NODE_ENV=production @@ -107,6 +139,11 @@ COPY --from=runtime-deps /app/node_modules ./node_modules COPY --from=server-build /app/server/dist ./dist COPY --from=client-build /app/client/dist ./client +# The project's license, and every shipped component's license notices (also +# served by the app at /licenses.txt) +COPY LICENSE ./ +COPY --from=licenses /app/licenses.txt ./client/licenses.txt + # Serve the built client at / (see server/src/common/client-static.ts) ENV CLIENT_DIR=client diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..65b4543 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 Andrii Arsenin + +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 index e7d7fbe..e933436 100644 --- a/README.md +++ b/README.md @@ -38,3 +38,11 @@ Scenarios, snippets, environments and credentials can be exported as YAML and im - [docs/mcp.md](docs/mcp.md) - MCP tool reference - [docs/development.md](docs/development.md) - setup, configuration, running, testing, linting, Docker - [CHANGELOG.md](CHANGELOG.md) - release notes + +--- + +## License + +[MIT](LICENSE) © 2026 Andrii Arsenin + +Third-party packages keep their own licenses. The Docker image includes all their notices, and the app serves them at `/licenses.txt` (linked as "Licenses" in the sidebar footer). See [docs/development.md](docs/development.md#licenses). diff --git a/client/package.json b/client/package.json index 348c461..9b47b8d 100644 --- a/client/package.json +++ b/client/package.json @@ -1,6 +1,8 @@ { "name": "liqa-client", "private": true, + "license": "MIT", + "author": "Andrii Arsenin", "type": "module", "scripts": { "dev": "vite", diff --git a/client/src/App.module.css b/client/src/App.module.css index cdad06b..4b18c1f 100644 --- a/client/src/App.module.css +++ b/client/src/App.module.css @@ -52,6 +52,16 @@ white-space: nowrap; } +.versionLink { + color: inherit; + text-decoration: none; +} + +.versionLink:hover, +.versionLink:focus-visible { + text-decoration: underline; +} + .navItem { display: flex; align-items: center; diff --git a/client/src/App.tsx b/client/src/App.tsx index 051801c..0cb1543 100644 --- a/client/src/App.tsx +++ b/client/src/App.tsx @@ -140,7 +140,17 @@ export default function App() {
diff --git a/client/src/i18n/locales/en.json b/client/src/i18n/locales/en.json index 4e16472..c67816a 100644 --- a/client/src/i18n/locales/en.json +++ b/client/src/i18n/locales/en.json @@ -22,6 +22,7 @@ "generic": "Something went wrong. Please try again." }, "nav": { + "licenses": "Licenses", "environments": "Environments", "credentials": "Credentials", "snippets": "Snippets", @@ -220,9 +221,7 @@ "export_include_snippets": "Include Snippets", "form_timeout": "Scenario Timeout (seconds)", "form_timeout_placeholder": "Default: 600", - "form_timeout_hint": "Max seconds for the entire scenario run (default: 600)", - "field_name": "Name", - "field_id": "ID" + "form_timeout_hint": "Max seconds for the entire scenario run (default: 600)" }, "theme": { "switch_to_light": "Switch to light theme", diff --git a/docs/development.md b/docs/development.md index 47d9f20..8841268 100644 --- a/docs/development.md +++ b/docs/development.md @@ -218,6 +218,29 @@ docker compose build --no-cache --- +## Licenses + +The project is MIT-licensed ([LICENSE](../LICENSE)); the `license` field in all three `package.json` files says the same. + +The image ships third-party code: the server's production dependencies, the client's production dependencies (bundled into its build), the Node.js binary, Chromium and Debian packages. Their notices are in the image as follows: + +- **npm packages and Node.js**: the `licenses` stage of the Dockerfile runs `scripts/third-party-licenses.mjs`, which writes the project's LICENSE followed by every production dependency of both workspaces with its license files (or, for the few packages that ship none, the declared license, author and source). Node.js's LICENSE for the exact version in the image is fetched from GitHub and appended. The result is `/app/client/licenses.txt`, which the app serves at `/licenses.txt`. The build fails if a package has no license information at all. +- **Server packages' own license files** stay in `node_modules`: the slimming step deletes Markdown files except `LICENSE*`, `NOTICE*` and `COPYING*`. +- **Chromium**: `LICENSE.headless_shell` next to the binary under `/ms-playwright`. +- **Debian packages**: `/usr/share/doc/*/copyright`. + +The image also has the OCI labels `org.opencontainers.image.licenses=MIT`, `source`, `title` and `version` (CI passes the version as the `VERSION` build arg). + +To check the notices locally, or to review a new dependency's license, run from the repository root: + +```bash +node scripts/third-party-licenses.mjs > /tmp/licenses.txt +``` + +Before adding a dependency, check its license is compatible with MIT distribution (permissive licenses such as MIT, ISC, BSD, Apache-2.0 are; copyleft ones such as GPL or AGPL need a closer look). + +--- + ## CI (Gitea Actions) `.gitea/workflows/ci.yml` runs on pushes to `master` and on pull requests: diff --git a/package-lock.json b/package-lock.json index 63d402e..43d3f40 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,13 @@ { "name": "liqa", - "version": "1.22.1", + "version": "1.22.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "liqa", - "version": "1.22.1", + "version": "1.22.2", + "license": "MIT", "workspaces": [ "server", "client" @@ -17,6 +18,7 @@ }, "client": { "name": "liqa-client", + "license": "MIT", "dependencies": { "@monaco-editor/react": "^4.7.0", "@tanstack/react-query": "^5.99.0", @@ -17935,7 +17937,7 @@ }, "server": { "name": "liqa-server", - "license": "ISC", + "license": "MIT", "dependencies": { "@modelcontextprotocol/sdk": "^1.29.0", "@mozilla/readability": "^0.6.0", diff --git a/package.json b/package.json index a68cfd1..b660518 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,9 @@ { "name": "liqa", - "version": "1.22.1", + "version": "1.22.2", "private": true, + "license": "MIT", + "author": "Andrii Arsenin", "engines": { "node": ">=24" }, diff --git a/scripts/third-party-licenses.mjs b/scripts/third-party-licenses.mjs new file mode 100644 index 0000000..e642456 --- /dev/null +++ b/scripts/third-party-licenses.mjs @@ -0,0 +1,118 @@ +#!/usr/bin/env node +// Writes the license notices for everything the app ships to stdout: the +// project's own LICENSE, then every production dependency of the client and +// server workspaces with its license text, as installed in node_modules. +// +// node scripts/third-party-licenses.mjs > licenses.txt +// +// Run it from the repository root after `npm ci` (dev dependencies may be +// installed too; only production dependencies are listed). Exits non-zero +// when a package's license can't be determined. + +import { execFileSync } from "node:child_process"; +import * as fs from "node:fs"; +import * as path from "node:path"; + +const ROOT = process.cwd(); +const LICENSE_FILE = /^(licen[cs]e|copying|notice)(\.|-|$)/i; + +const tree = JSON.parse( + execFileSync("npm", ["ls", "--omit=dev", "--all", "--long", "--json"], { + cwd: ROOT, + encoding: "utf8", + maxBuffer: 256 * 1024 * 1024, + // npm ls exits non-zero on unmet optional peers; the JSON is still complete + stdio: ["ignore", "pipe", "ignore"], + }).toString() || "{}", +); + +const workspaces = new Set( + ( + JSON.parse(fs.readFileSync(path.join(ROOT, "package.json"), "utf8")) + .workspaces ?? [] + ).map((w) => path.resolve(ROOT, w)), +); + +/** name@version → { name, version, license, dir } */ +const packages = new Map(); +const walk = (node) => { + for (const [name, dep] of Object.entries(node.dependencies ?? {})) { + // Unmet optional peers have no path + if (!dep.path) continue; + // Workspace packages are our own code: list only their dependencies + if (!workspaces.has(fs.realpathSync(dep.path))) { + const key = `${name}@${dep.version}`; + if (packages.has(key)) continue; + packages.set(key, { name, version: dep.version, dir: dep.path }); + } + walk(dep); + } +}; +walk(tree); + +const manifestOf = (pkg) => + JSON.parse(fs.readFileSync(path.join(pkg.dir, "package.json"), "utf8")); + +const licenseOf = (pkg) => { + const manifest = manifestOf(pkg); + const field = manifest.license ?? manifest.licenses; + if (typeof field === "string") return field; + if (Array.isArray(field)) return field.map((l) => l.type ?? l).join(" OR "); + if (field?.type) return field.type; + return null; +}; + +const licenseTexts = (pkg) => + fs + .readdirSync(pkg.dir) + .filter( + (f) => + LICENSE_FILE.test(f) && fs.statSync(path.join(pkg.dir, f)).isFile(), + ) + .sort() + .map((f) => fs.readFileSync(path.join(pkg.dir, f), "utf8").trim()); + +// For packages that ship no license file, record who to attribute and where +// the full terms are +const withoutLicenseFile = (pkg, license) => { + const { author, repository, homepage } = manifestOf(pkg); + const authorName = typeof author === "string" ? author : author?.name; + const repo = typeof repository === "string" ? repository : repository?.url; + return [ + `The package ships no license file; its package.json declares ${license}.`, + authorName && `Author: ${authorName}`, + (repo || homepage) && `Source: ${repo || homepage}`, + ] + .filter(Boolean) + .join("\n"); +}; + +const missing = []; +const sections = [...packages.values()] + .sort( + (a, b) => + a.name.localeCompare(b.name) || a.version.localeCompare(b.version), + ) + .map((pkg) => { + const license = licenseOf(pkg); + const texts = licenseTexts(pkg); + if (!license && texts.length === 0) + missing.push(`${pkg.name}@${pkg.version}`); + const body = + texts.length > 0 ? texts.join("\n\n") : withoutLicenseFile(pkg, license); + return `${pkg.name}@${pkg.version}\nLicense: ${license ?? "see below"}\n\n${body}`; + }); + +if (missing.length > 0) { + console.error(`No license information for: ${missing.join(", ")}`); + process.exit(1); +} + +const rule = "-".repeat(79); +process.stdout.write( + [ + fs.readFileSync(path.join(ROOT, "LICENSE"), "utf8").trim(), + `${"=".repeat(79)}\n\nThird-party software\n\nThis application includes the following third-party packages (${sections.length}),\nunder their own licenses:`, + ...sections, + ].join(`\n\n${rule}\n\n`) + "\n", +); diff --git a/server/package.json b/server/package.json index 7498c46..53838ef 100644 --- a/server/package.json +++ b/server/package.json @@ -18,8 +18,8 @@ "test:watch": "jest --watch" }, "keywords": [], - "author": "", - "license": "ISC", + "author": "Andrii Arsenin", + "license": "MIT", "dependencies": { "@modelcontextprotocol/sdk": "^1.29.0", "@mozilla/readability": "^0.6.0",