@intellectual-frontiers/libraries 0.4.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE CHANGED
@@ -1,21 +1,75 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 Intellectual Frontiers
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ Required Notice: Copyright Intellectual Frontiers LLC (https://github.com/intellectual-frontiers/.github)
2
+
3
+ # PolyForm Noncommercial License 1.0.0
4
+
5
+ <https://polyformproject.org/licenses/noncommercial/1.0.0>
6
+
7
+ ## Acceptance
8
+
9
+ In order to get any license under these terms, you must agree to them as both strict obligations and conditions to all your licenses.
10
+
11
+ ## Copyright License
12
+
13
+ The licensor grants you a copyright license for the software to do everything you might do with the software that would otherwise infringe the licensor's copyright in it for any permitted purpose. However, you may only distribute the software according to [Distribution License](#distribution-license) and make changes or new works based on the software according to [Changes and New Works License](#changes-and-new-works-license).
14
+
15
+ ## Distribution License
16
+
17
+ The licensor grants you an additional copyright license to distribute copies of the software. Your license to distribute covers distributing the software with changes and new works permitted by [Changes and New Works License](#changes-and-new-works-license).
18
+
19
+ ## Notices
20
+
21
+ You must ensure that anyone who gets a copy of any part of the software from you also gets a copy of these terms or the URL for them above, as well as copies of any plain-text lines beginning with `Required Notice:` that the licensor provided with the software. For example:
22
+
23
+ > Required Notice: Copyright Yoyodyne, Inc. (http://example.com)
24
+
25
+ ## Changes and New Works License
26
+
27
+ The licensor grants you an additional copyright license to make changes and new works based on the software for any permitted purpose.
28
+
29
+ ## Patent License
30
+
31
+ The licensor grants you a patent license for the software that covers patent claims the licensor can license, or becomes able to license, that you would infringe by using the software.
32
+
33
+ ## Noncommercial Purposes
34
+
35
+ Any noncommercial purpose is a permitted purpose.
36
+
37
+ ## Personal Uses
38
+
39
+ Personal use for research, experiment, and testing for the benefit of public knowledge, personal study, private entertainment, hobby projects, amateur pursuits, or religious observance, without any anticipated commercial application, is use for a permitted purpose.
40
+
41
+ ## Noncommercial Organizations
42
+
43
+ Use by any charitable organization, educational institution, public research organization, public safety or health organization, environmental protection organization, or government institution is use for a permitted purpose regardless of the source of funding or obligations resulting from the funding.
44
+
45
+ ## Fair Use
46
+
47
+ You may have "fair use" rights for the software under the law. These terms do not limit them.
48
+
49
+ ## No Other Rights
50
+
51
+ These terms do not allow you to sublicense or transfer any of your licenses to anyone else, or prevent the licensor from granting licenses to anyone else. These terms do not imply any other licenses.
52
+
53
+ ## Patent Defense
54
+
55
+ If you make any written claim that the software infringes or contributes to infringement of any patent, your patent license for the software granted under these terms ends immediately. If your company makes such a claim, your patent license ends immediately for work on behalf of your company.
56
+
57
+ ## Violations
58
+
59
+ The first time you are notified in writing that you have violated any of these terms, or done anything with the software not covered by your licenses, your licenses can nonetheless continue if you come into full compliance with these terms, and take practical steps to correct past violations, within 32 days of receiving notice. Otherwise, all your licenses end immediately.
60
+
61
+ ## No Liability
62
+
63
+ ***As far as the law allows, the software comes as is, without any warranty or condition, and the licensor will not be liable to you for any damages arising out of these terms or the use or nature of the software, under any kind of legal claim.***
64
+
65
+ ## Definitions
66
+
67
+ The **licensor** is the individual or entity offering these terms, and the **software** is the software the licensor makes available under these terms.
68
+
69
+ **You** refers to the individual or entity agreeing to these terms.
70
+
71
+ **Your company** is any legal entity, sole proprietorship, or other kind of organization that you work for, plus all organizations that have control over, are under the control of, or are under common control with that organization. **Control** means ownership of substantially all the assets of an entity, or the power to direct its management and policies by vote, contract, or otherwise. Control can be direct or indirect.
72
+
73
+ **Your licenses** are all the licenses granted to you for the software under these terms.
74
+
75
+ **Use** means anything you do with the software requiring one of your licenses.
package/dist/dev.d.ts CHANGED
@@ -60,6 +60,8 @@ export declare function pool<T, R>(items: readonly T[], width: number, job: (ite
60
60
  export declare function prepare(repo: string, libs: readonly Lib[]): Promise<Result<readonly string[], string>>;
61
61
  /** TypeScript on the libraries, several at a time. */
62
62
  export declare function typeCheck(repo: string, libs: readonly Lib[], width: number): Promise<Outcome>;
63
+ /** The license of the repository and of each library, as the check of `license.ts` finds it: a library with no `LICENSE` fails here, and the sentence says the command that writes it. */
64
+ export declare function licenseStage(repo: string): Promise<Outcome>;
63
65
  /** The sum of counts. */
64
66
  export declare const addCounts: (a: Counts, b: Counts) => Counts;
65
67
  /**
package/dist/dev.js CHANGED
@@ -7,7 +7,7 @@
7
7
  * bun run dev:check --files a.ts,b/c.ts the libraries these files affect (paths from the repository's root)
8
8
  * bun run dev:check --all every library
9
9
  * bun run dev:check --list say what is affected and run nothing
10
- * other flags: --base REF (origin/main by default), --no-types, --no-tests, --bail (stop at the first failing test), --repo DIR
10
+ * other flags: --base REF (origin/main by default), --no-types, --no-tests, --no-license, --bail (stop at the first failing test), --repo DIR
11
11
  *
12
12
  * @remarks
13
13
  * Nothing is installed per library. The repository's root installs the packages every library shares (`bun install`, once), the libraries are linked under `commons/node_modules` (a link for each folder whose package
@@ -40,6 +40,7 @@ import { flag, formatUsageError, helpText, many, parseArgs, value } from "@intel
40
40
  import { label, paint } from "@intellectual-frontiers/terminal/palette";
41
41
  import { affectedBy, changedSince, everyLibrary } from "./affected.js";
42
42
  import { linkAll } from "./link.js";
43
+ import { judge as judgeLicense, sentence as licenseSentence } from "./license.js";
43
44
  /** The counts in the end of what `bun test` printed, or undefined where it printed none. */
44
45
  export function bunCounts(text) {
45
46
  const n = (word) => Number(new RegExp(`^\\s*(\\d+) ${word}\\s*$`, "m").exec(text)?.[1] ?? 0);
@@ -200,6 +201,14 @@ export async function typeCheck(repo, libs, width) {
200
201
  output: bad.flatMap((b) => head(b.lines, 25).map((x) => `${b.name}: ${x}`)),
201
202
  };
202
203
  }
204
+ /** The license of the repository and of each library, as the check of `license.ts` finds it: a library with no `LICENSE` fails here, and the sentence says the command that writes it. */
205
+ export async function licenseStage(repo) {
206
+ const t0 = performance.now();
207
+ const { findings } = await judgeLicense(repo);
208
+ if (findings.length === 0)
209
+ return { kind: "passed", detail: `every LICENSE is the official text in ${seconds(t0)}` };
210
+ return { kind: "failed", detail: plural(findings.length, "finding", "findings"), output: findings.map(licenseSentence) };
211
+ }
203
212
  /** The sum of counts. */
204
213
  export const addCounts = (a, b) => ({ pass: a.pass + b.pass, skip: a.skip + b.skip, fail: a.fail + b.fail, files: a.files + b.files });
205
214
  /**
@@ -271,6 +280,7 @@ const OPTIONS = {
271
280
  list: flag({ help: "Say what is affected and run nothing." }),
272
281
  types: flag({ help: "Type-check the libraries (on by default).", negatable: true, default: true }),
273
282
  tests: flag({ help: "Run their tests (on by default).", negatable: true, default: true }),
283
+ license: flag({ help: "Check the license files of the repository (on by default).", negatable: true, default: true }),
274
284
  bail: flag({ help: "Stop the tests at the first one that fails." }),
275
285
  repo: value({ help: "The repository (the working folder, or the one above it that has commons/, by default).", valueName: "DIR" }),
276
286
  };
@@ -339,6 +349,8 @@ export async function main(argv) {
339
349
  ]);
340
350
  stages.push({ name: "types", outcome: types }, { name: "tests", outcome: tests });
341
351
  }
352
+ if (!o.list && o.license)
353
+ stages.push({ name: "license", outcome: await licenseStage(repo) });
342
354
  for (const l of summaryLines(look, { why, libs: names }, stages, notes, seconds(t0)))
343
355
  stdio.stdout.writeSync(`${l}\n`);
344
356
  return stages.some((s) => s.outcome.kind === "failed") ? 1 : 0;
package/dist/family.js CHANGED
@@ -27,6 +27,7 @@ export const RESERVED = [
27
27
  { match: { kind: "exact", name: "signing" }, host: "signing", reason: "held for the signing library of the fleet libraries (intellectual-frontiers/.github#11)" },
28
28
  { match: { kind: "exact", name: "gitops" }, host: "gitops", reason: "held for the gitops library of the fleet libraries (intellectual-frontiers/.github#11)" },
29
29
  { match: { kind: "exact", name: "estate" }, host: "estate", reason: "held for the estate library of the fleet libraries (intellectual-frontiers/.github#11)" },
30
+ { match: { kind: "exact", name: "toolchain" }, host: "toolchain", reason: "held for the toolchain library of the fleet libraries (intellectual-frontiers/.github#11)" },
30
31
  ];
31
32
  /** Whether a library name is one a match holds. */
32
33
  export function matches(match, name) {
@@ -42,6 +42,8 @@ export const MIZAN = {
42
42
  ["dcterms", "http://purl.org/dc/terms/"],
43
43
  ["pm", "https://www.intellectualfrontiers.com/ontology/packaging#"],
44
44
  ["schema", "https://schema.org/"],
45
+ ["dcat", "http://www.w3.org/ns/dcat#"],
46
+ ["purl", "https://github.com/package-url/purl-spec#"],
45
47
  ],
46
48
  files,
47
49
  ontology: mizanOntology,
@@ -64,6 +66,8 @@ export const MIZAN = {
64
66
  dcterms: "http://purl.org/dc/terms/",
65
67
  pm: "https://www.intellectualfrontiers.com/ontology/packaging#",
66
68
  schema: "https://schema.org/",
69
+ dcat: "http://www.w3.org/ns/dcat#",
70
+ purl: "https://github.com/package-url/purl-spec#",
67
71
  },
68
72
  viewTitle: "Mizan: the shared ontology",
69
73
  license: CC0,
@@ -1,6 +1,6 @@
1
1
  /**
2
- * Bun at the version commons pins (`BUN_VERSION` and its SHA-256 per platform in `commons/generated/pins.auto.env`, commons
3
- * 0005-typescript-runtime FR-026), fetched from Bun's release with retries, kept only where its SHA-256 is the pinned one, unpacked by the
2
+ * Bun at the version commons pins (its version, address, SHA-256, format and folder per platform in `commons/generated/pins.auto.env`, commons
3
+ * 0005-typescript-runtime FR-026, 0002-packaging FR-019), fetched from that address with retries, kept only where its SHA-256 is the pinned one, unpacked by the
4
4
  * kernel's own zip reader and put in a folder; nothing but IFC TypeScript itself, so it runs on Node 26 (or Bun) on Linux, macOS
5
5
  * and Windows with no shell, no Python and no unzip. CI's `.github/actions/bun` runs it.
6
6
  *
@@ -17,7 +17,7 @@ import { chmod, ensureDir, readFile, readTextFile, writeFile, writeTextFile } fr
17
17
  import { downloadVerified, Retries } from "@intellectual-frontiers/net/net";
18
18
  import { dirname, fromFileUrl, join, resolve } from "@intellectual-frontiers/system/path";
19
19
  import { args, build, env, exit } from "@intellectual-frontiers/system/proc";
20
- import { bunTarget, readEnvFile } from "./pins.js";
20
+ import { describePinProblem, pinDownload, pinSuffix, readEnvFile } from "./pins.js";
21
21
  /** Stop with a message and status 1. */
22
22
  function stop(message) {
23
23
  console.error(`install-bun: ${message}`);
@@ -29,26 +29,31 @@ if (given === undefined)
29
29
  stop("give the folder to put Bun in");
30
30
  const dest = resolve(given);
31
31
  const pins = readEnvFile(await readTextFile(join(ROOT, "commons", "generated", "pins.auto.env")));
32
- const platform = bunTarget(build.os, build.arch);
33
- if (platform === undefined)
32
+ const suffix = pinSuffix(build.os, build.arch);
33
+ if (suffix === undefined)
34
34
  stop(`Bun has no build for ${build.os} on ${build.arch}`);
35
- const version = pins.get("BUN_VERSION");
36
- const sum = sha256Of(pins.get(`BUN_SHA256_${platform.key}`) ?? "");
37
- if (version === undefined || sum === undefined)
38
- stop(`commons pins no Bun for ${platform.key}`);
35
+ const pin = pinDownload(pins, "BUN", suffix);
36
+ if (pin.kind === "err")
37
+ stop(describePinProblem(pin.error));
38
+ const download = pin.value;
39
+ if (download.format !== "zip")
40
+ stop(`commons pins Bun as ${download.format}, and this installer unpacks a zip`);
41
+ const sum = sha256Of(download.sha256);
42
+ if (sum === undefined)
43
+ stop(`commons pins no SHA-256 of Bun for ${suffix}`);
39
44
  const retries = new Retries({ tries: 5, base: 2, cap: 30 }, (line) => console.error(line));
40
- const url = `https://github.com/oven-sh/bun/releases/download/bun-v${version}/bun-${platform.target}.zip`;
41
- const zip = await downloadVerified(retries, url, sum, join(dest, "cache"));
45
+ const zip = await downloadVerified(retries, download.url, sum, join(dest, "cache"));
42
46
  if (zip.kind === "err")
43
47
  stop(zip.error);
44
48
  const files = await unzip(await readFile(zip.value));
45
49
  if (files.kind === "err")
46
50
  stop(formatArchiveError(files.error));
47
51
  const exe = build.os === "windows" ? "bun.exe" : "bun";
48
- const bytes = files.value.get(`bun-${platform.target}/${exe}`);
52
+ const inside = download.binPath === "" ? exe : `${download.binPath}/${exe}`;
53
+ const bytes = files.value.get(inside);
49
54
  if (bytes === undefined)
50
- stop(`the zip holds no bun-${platform.target}/${exe}`);
51
- const bin = join(dest, `bun-${version}`);
55
+ stop(`the zip holds no ${inside}`);
56
+ const bin = join(dest, `bun-${download.version}`);
52
57
  await ensureDir(bin);
53
58
  await writeFile(join(bin, exe), bytes);
54
59
  await chmod(join(bin, exe), 0o755);
@@ -1,4 +1,5 @@
1
1
  import { type Result } from "@intellectual-frontiers/core";
2
+ import { type SpdxId } from "./license/standard.js";
2
3
  import { type Table } from "@intellectual-frontiers/kanon";
3
4
  import { type LevelKey } from "@intellectual-frontiers/mizan/levels";
4
5
  import { type LibraryFamily } from "./family.js";
@@ -10,6 +11,7 @@ export declare const LIBRARIES_SPEC = "0027-commons-libraries";
10
11
  export declare const FIRST_GENERATED = 101;
11
12
  /** The marker that opens the generated section, and the one that closes it. */
12
13
  export declare const BEGIN = "<!-- libraries:begin -->";
14
+ /** The marker that ends the generated section of the libraries in a document. */
13
15
  export declare const END = "<!-- libraries:end -->";
14
16
  /** A library's manifest. */
15
17
  export type Library = {
@@ -33,11 +35,14 @@ export type Library = {
33
35
  readonly kanon?: Table;
34
36
  /** Its host and its role where it is of a family (a host, a dialect of it or a plugin of it; 0033-kanon FR-021, 0027-commons-libraries FR-023). */
35
37
  readonly family?: LibraryFamily;
38
+ /** The license its `LICENSE` and its packed `package.json` carry, where it is not the default of the repository (`license/standard.ts`; commons 0035-licensing FR-003). */
39
+ readonly license?: SpdxId;
36
40
  };
37
41
  /** The lowest conformance level that requires a library to declare `kanon`; none yet (0033-kanon FR-014, OQ-1): a level asks for it by naming itself here. */
38
42
  export declare const KANON_REQUIRED_FROM: LevelKey | undefined;
39
43
  /** The registries a library may be published to: the kinds only, never a host or a credential (0027-commons-libraries FR-018). */
40
44
  export declare const REGISTRIES: readonly ["github", "npm"];
45
+ /** A registry a library is distributed to: github or npm. */
41
46
  export type Registry = (typeof REGISTRIES)[number];
42
47
  /** Where a manifest that declares no distribution is published. */
43
48
  export declare const DEFAULT_DISTRIBUTION: readonly Registry[];
package/dist/libraries.js CHANGED
@@ -81,6 +81,7 @@ var __disposeResources = (this && this.__disposeResources) || (function (Suppres
81
81
  */
82
82
  import process from "node:process";
83
83
  import { array, describe, formatDecodeError, literal, object, unknownValue, string, err, ok, } from "@intellectual-frontiers/core";
84
+ import { parseSpdxId } from "./license/standard.js";
84
85
  import { exportedLiteral } from "@intellectual-frontiers/formats/ts-literal";
85
86
  import { decodeTable } from "@intellectual-frontiers/kanon";
86
87
  import { existsSync, readDirSync, readTextFileSync, writeTextFileSync } from "@intellectual-frontiers/system/fs";
@@ -96,6 +97,7 @@ export const LIBRARIES_SPEC = "0027-commons-libraries";
96
97
  export const FIRST_GENERATED = 101;
97
98
  /** The marker that opens the generated section, and the one that closes it. */
98
99
  export const BEGIN = "<!-- libraries:begin -->";
100
+ /** The marker that ends the generated section of the libraries in a document. */
99
101
  export const END = "<!-- libraries:end -->";
100
102
  /** Where the generated section begins and ends: the markers on lines of their own (a requirement may name them in its text). */
101
103
  function bounds(spec) {
@@ -123,8 +125,8 @@ const nameDecoder = (input, path = "$") => {
123
125
  ? r
124
126
  : err({ kind: "decode", path, expected: "a name of lower-case letters, digits and hyphens", found: describe(input) });
125
127
  };
126
- const body = object({ name: nameDecoder, verify: nonEmpty, version: nonEmpty, exports: array(nonEmpty) }, { level: literal(...LEVELS), specKit: nonEmpty, summary: nonEmpty, distribution: array(literal(...REGISTRIES)), kanon: unknownValue, family: object({ host: nonEmpty, role: literal(...ROLES) }) });
127
- const FIELDS = ["name", "level", "specKit", "verify", "version", "exports", "summary", "distribution", "kanon", "family"];
128
+ const body = object({ name: nameDecoder, verify: nonEmpty, version: nonEmpty, exports: array(nonEmpty) }, { level: literal(...LEVELS), specKit: nonEmpty, summary: nonEmpty, distribution: array(literal(...REGISTRIES)), kanon: unknownValue, family: object({ host: nonEmpty, role: literal(...ROLES) }), license: nonEmpty });
129
+ const FIELDS = ["name", "level", "specKit", "verify", "version", "exports", "summary", "distribution", "kanon", "family", "license"];
128
130
  /** The manifest read from the text of its file: `export const library = { ... }` and no other export, read as data and never run (0027-commons-libraries FR-012). */
129
131
  export function decodeLibrarySource(source) {
130
132
  const exports = source.split("\n").filter((l) => /^export\s/.test(l));
@@ -163,6 +165,13 @@ export function decodeLibrarySource(source) {
163
165
  return f;
164
166
  family = f.value;
165
167
  }
168
+ let license;
169
+ if (v.license !== undefined) {
170
+ const l = parseSpdxId(v.license);
171
+ if (l.kind === "err")
172
+ return err(`library.license: ${l.error}`);
173
+ license = l.value;
174
+ }
166
175
  return ok({
167
176
  name: v.name,
168
177
  level: v.level ?? DEFAULT_LIBRARY_LEVEL,
@@ -174,6 +183,7 @@ export function decodeLibrarySource(source) {
174
183
  distribution,
175
184
  ...(kanon === undefined ? {} : { kanon }),
176
185
  ...(family === undefined ? {} : { family }),
186
+ ...(license === undefined ? {} : { license }),
177
187
  });
178
188
  }
179
189
  /** The manifests of `commons/*`, in the order of the folders' names: every folder that holds a `library.ts`. */
@@ -0,0 +1,46 @@
1
+ /**
2
+ * The license of this repository as data: the one license every library and every part of the repository is under, the one place its identifier is written, and the standard its text is taken from
3
+ * (commons 0035-licensing FR-001 to FR-004, 0018-standards-first FR-006 and FR-007). The text is the official PolyForm Noncommercial License 1.0.0, copied byte for byte into
4
+ * `PolyForm-Noncommercial-1.0.0.md` beside this file from the tag `1.0.0` of the official repository, and held to the SHA-256 recorded here.
5
+ *
6
+ * @remarks
7
+ * Read as data by `../license.ts` (which writes and checks every `LICENSE`), by the packer (the `license` of a package) and by the decoder of the manifest (its optional `license`). The identifier is a closed union:
8
+ * a license is added to {@link SPDX_IDS} together with its text, never as a free string.
9
+ *
10
+ * Spec: 0001-libraries FR-019
11
+ *
12
+ * @module
13
+ */
14
+ import { type Result } from "@intellectual-frontiers/core";
15
+ /** The SPDX identifiers of the licenses this repository can carry: each has its official text in this folder. */
16
+ export declare const SPDX_IDS: readonly ["PolyForm-Noncommercial-1.0.0"];
17
+ /** An SPDX license identifier of {@link SPDX_IDS}. */
18
+ export type SpdxId = (typeof SPDX_IDS)[number];
19
+ /** The license of every library and of the repository, unless a manifest's `license` says another of {@link SPDX_IDS}. */
20
+ export declare const DEFAULT_LICENSE: SpdxId;
21
+ /** An SPDX identifier from text, or why the text is none of the licenses this repository can carry. */
22
+ export declare function parseSpdxId(text: string): Result<SpdxId, string>;
23
+ /** A standard imported as data (0018-standards-first FR-006): its issuer, name, version, location, license and the SHA-256 of what was imported. */
24
+ export type Standard = {
25
+ readonly id: string;
26
+ readonly issuer: string;
27
+ readonly name: string;
28
+ readonly version: string;
29
+ /** Where the imported text is, at the tag that is pinned. */
30
+ readonly location: string;
31
+ /** What the text may be copied under (an SPDX identifier where there is one). */
32
+ readonly license: string;
33
+ readonly redistributable: boolean;
34
+ /** The SHA-256 of the file in this folder, line ends as they are (they are `\n`). */
35
+ readonly sha256: string;
36
+ /** The file of this folder that holds the text. */
37
+ readonly file: string;
38
+ };
39
+ /** The official text of each license, as a standard of 0018-standards-first. */
40
+ export declare const LICENSE_STANDARDS: Readonly<Record<SpdxId, Standard>>;
41
+ /** The licensor named in the `Required Notice:` line of every `LICENSE` and in `NOTICE`. */
42
+ export declare const LICENSOR = "Intellectual Frontiers LLC";
43
+ /** The repository the `Required Notice:` line names. */
44
+ export declare const REPOSITORY_URL = "https://github.com/intellectual-frontiers/.github";
45
+ /** Where a commercial license is asked for. */
46
+ export declare const COMMERCIAL_ISSUES_URL = "https://github.com/intellectual-frontiers/.github/issues";
@@ -0,0 +1,43 @@
1
+ /**
2
+ * The license of this repository as data: the one license every library and every part of the repository is under, the one place its identifier is written, and the standard its text is taken from
3
+ * (commons 0035-licensing FR-001 to FR-004, 0018-standards-first FR-006 and FR-007). The text is the official PolyForm Noncommercial License 1.0.0, copied byte for byte into
4
+ * `PolyForm-Noncommercial-1.0.0.md` beside this file from the tag `1.0.0` of the official repository, and held to the SHA-256 recorded here.
5
+ *
6
+ * @remarks
7
+ * Read as data by `../license.ts` (which writes and checks every `LICENSE`), by the packer (the `license` of a package) and by the decoder of the manifest (its optional `license`). The identifier is a closed union:
8
+ * a license is added to {@link SPDX_IDS} together with its text, never as a free string.
9
+ *
10
+ * Spec: 0001-libraries FR-019
11
+ *
12
+ * @module
13
+ */
14
+ import { err, ok } from "@intellectual-frontiers/core";
15
+ /** The SPDX identifiers of the licenses this repository can carry: each has its official text in this folder. */
16
+ export const SPDX_IDS = ["PolyForm-Noncommercial-1.0.0"];
17
+ /** The license of every library and of the repository, unless a manifest's `license` says another of {@link SPDX_IDS}. */
18
+ export const DEFAULT_LICENSE = "PolyForm-Noncommercial-1.0.0";
19
+ /** An SPDX identifier from text, or why the text is none of the licenses this repository can carry. */
20
+ export function parseSpdxId(text) {
21
+ const found = SPDX_IDS.find((id) => id === text);
22
+ return found === undefined ? err(`${JSON.stringify(text)} is not a license of this repository (${SPDX_IDS.join(", ")})`) : ok(found);
23
+ }
24
+ /** The official text of each license, as a standard of 0018-standards-first. */
25
+ export const LICENSE_STANDARDS = {
26
+ "PolyForm-Noncommercial-1.0.0": {
27
+ id: "polyform-noncommercial-1.0.0",
28
+ issuer: "The PolyForm Project",
29
+ name: "PolyForm Noncommercial License 1.0.0",
30
+ version: "1.0.0",
31
+ location: "https://raw.githubusercontent.com/polyformproject/polyform-licenses/1.0.0/PolyForm-Noncommercial-1.0.0.md",
32
+ license: "The terms of LICENSE.md of polyformproject/polyform-licenses at tag 1.0.0: a PolyForm license is copied as it is, and a change removes the name PolyForm",
33
+ redistributable: true,
34
+ sha256: "c0ea4a896d2c8c394b29f9427589996db826cd501c512279ff0ed3ef48fabbe5",
35
+ file: "PolyForm-Noncommercial-1.0.0.md",
36
+ },
37
+ };
38
+ /** The licensor named in the `Required Notice:` line of every `LICENSE` and in `NOTICE`. */
39
+ export const LICENSOR = "Intellectual Frontiers LLC";
40
+ /** The repository the `Required Notice:` line names. */
41
+ export const REPOSITORY_URL = "https://github.com/intellectual-frontiers/.github";
42
+ /** Where a commercial license is asked for. */
43
+ export const COMMERCIAL_ISSUES_URL = "https://github.com/intellectual-frontiers/.github/issues";
@@ -0,0 +1,25 @@
1
+ /**
2
+ * What is really vendored in this repository: the files that are not ours and the license each is under, as data (commons 0035-licensing FR-008). `../license.ts` makes `THIRD_PARTY_NOTICES.md` from it, and its check names an
3
+ * item whose path is gone. Where a license was not checked against its source the item says `unverified: <what to check>` and never a guess.
4
+ *
5
+ * @remarks
6
+ * Packages installed from a registry (TypeScript, fast-check, `@types/node` and the others in `bun.lock`) are not vendored: nothing of them is in this repository, and a package's license is its own. Mermaid is
7
+ * copied into a built site and not into this repository, so its item has no path.
8
+ *
9
+ * Spec: 0001-libraries FR-019
10
+ *
11
+ * @module
12
+ */
13
+ /** One third-party item: what it is, where it came from, whose it is and the license it is under. */
14
+ export type ThirdPartyItem = {
15
+ /** The path in the repository, or `undefined` for an item that is copied only into a built output. */
16
+ readonly path: string | undefined;
17
+ readonly what: string;
18
+ readonly source: string;
19
+ readonly owner: string;
20
+ readonly license: string;
21
+ /** What was checked, or `unverified: <what to check>`. */
22
+ readonly checked: string;
23
+ };
24
+ /** The items, in the order the notices list them. */
25
+ export declare const THIRD_PARTY: readonly ThirdPartyItem[];
@@ -0,0 +1,71 @@
1
+ /**
2
+ * What is really vendored in this repository: the files that are not ours and the license each is under, as data (commons 0035-licensing FR-008). `../license.ts` makes `THIRD_PARTY_NOTICES.md` from it, and its check names an
3
+ * item whose path is gone. Where a license was not checked against its source the item says `unverified: <what to check>` and never a guess.
4
+ *
5
+ * @remarks
6
+ * Packages installed from a registry (TypeScript, fast-check, `@types/node` and the others in `bun.lock`) are not vendored: nothing of them is in this repository, and a package's license is its own. Mermaid is
7
+ * copied into a built site and not into this repository, so its item has no path.
8
+ *
9
+ * Spec: 0001-libraries FR-019
10
+ *
11
+ * @module
12
+ */
13
+ /** The items, in the order the notices list them. */
14
+ export const THIRD_PARTY = [
15
+ {
16
+ path: "commons/libraries/src/workflows/schema/github-workflow.schema.json",
17
+ what: "The JSON Schema of GitHub Actions workflows, the copy fetched on 2026-11-19, which the tests validate the generated workflows against",
18
+ source: "https://json.schemastore.org/github-workflow.json (the SchemaStore project, https://github.com/SchemaStore/schemastore)",
19
+ owner: "The SchemaStore authors",
20
+ license: "Apache-2.0",
21
+ checked: "The license is that of the SchemaStore repository (its LICENSE is the Apache License 2.0, read on 2026-11-20). unverified: whether the Apache-2.0 text must travel with this one file, which is named here by its address; ask counsel",
22
+ },
23
+ {
24
+ path: "commons/data/sql/extensions/osquery/schema/osquery-5.24.1.auto.json",
25
+ what: "The tables of osquery 5.24.1 (names, columns, types, descriptions), trimmed to the fields the importer reads",
26
+ source: "https://github.com/osquery/osquery-site, commit 055097f8d8fb45c0c33a83c9ed7c56a7df3d7b5f, path src/data/osquery_schema_versions/5.24.1.json",
27
+ owner: "The osquery authors",
28
+ license: "CC-BY-4.0, as the file's own `source.license` records for the osquery-site documentation data; the osquery project is Apache-2.0 OR GPL-2.0-only",
29
+ checked: "Taken from the record in the file itself. unverified: the license file of osquery-site at that commit (the address of a LICENSE file at the root returned 404), so check where the CC-BY-4.0 statement comes from and the attribution it asks for",
30
+ },
31
+ {
32
+ path: "commons/ontology/src/standards/nist-sp-800-53/controls.auto.ts",
33
+ what: "The titles and groups of twelve controls of NIST SP 800-53 Rev. 5.2.0, imported from the OSCAL catalog and held to its SHA-256",
34
+ source: "https://github.com/usnistgov/oscal-content, commit f0de6d8d8c059d374f15e0ae07508d82e370fc1d (import manifest commons/libraries/src/imports/nist-sp-800-53.import.ts)",
35
+ owner: "The National Institute of Standards and Technology",
36
+ license: "Public domain (a work of the United States Government, 17 U.S.C. 105)",
37
+ checked: "Taken from the import manifest, which records it with the SHA-256 of the source.",
38
+ },
39
+ {
40
+ path: "commons/ontology/src/supply-chain/packaging/schema.auto.ts",
41
+ what: "The slice of schema.org 30.1 that the packaging ontology specializes, imported and held to its SHA-256",
42
+ source: "https://schema.org/version/30.1/schemaorg-current-https.ttl (import manifest commons/libraries/src/imports/schema-org.import.ts)",
43
+ owner: "The Schema.org Community Group and contributors",
44
+ license: "CC-BY-SA-3.0",
45
+ checked: "Taken from the import manifest. unverified: whether the ShareAlike term of CC-BY-SA-3.0 reaches this generated module and what it asks of the files that use it; ask counsel",
46
+ },
47
+ {
48
+ path: "commons/ontology/src/supply-chain/packaging/managers.ts",
49
+ what: "The table of package managers, seeded from the tables of upt (the families file, `families.ts`, is seeded from the same)",
50
+ source: "https://github.com/sigoden/upt, kept as a fixture in tests/fixtures/upt/",
51
+ owner: "The authors of upt",
52
+ license: "MIT OR Apache-2.0, at the user's option",
53
+ checked: "Taken from the files' own headers and from tests/fixtures/upt/README.md. unverified: the license files of the pinned upt commit, which are not kept in this repository",
54
+ },
55
+ {
56
+ path: "commons/ontology/src/supply-chain/packaging/families.ts",
57
+ what: "The families of package managers, seeded from the tables of upt",
58
+ source: "https://github.com/sigoden/upt, kept as a fixture in tests/fixtures/upt/",
59
+ owner: "The authors of upt",
60
+ license: "MIT OR Apache-2.0, at the user's option",
61
+ checked: "Taken from the file's own header and from tests/fixtures/upt/README.md. unverified: the license files of the pinned upt commit, which are not kept in this repository",
62
+ },
63
+ {
64
+ path: undefined,
65
+ what: "Mermaid 11.17.2, the script the generated documentation site serves on a page with a diagram; it is copied into the built site from the package `mermaid` and is not in this repository",
66
+ source: "https://www.npmjs.com/package/mermaid",
67
+ owner: "Knut Sveidqvist and contributors",
68
+ license: "MIT",
69
+ checked: "The LICENSE of the installed package 11.17.2 was read on 2026-11-20: The MIT License (MIT), Copyright (c) 2014 - 2022 Knut Sveidqvist.",
70
+ },
71
+ ];
@@ -0,0 +1,61 @@
1
+ import { type Result } from "@intellectual-frontiers/core";
2
+ import { type Library } from "./libraries.js";
3
+ import { type SpdxId } from "./license/standard.js";
4
+ import { type ThirdPartyItem } from "./license/third-party.js";
5
+ /** The command that writes what the check finds wrong. */
6
+ export declare const COMMAND = "bun commons/libraries/src/license.ts";
7
+ /** The license of a library: its manifest's `license`, else the default of the repository. */
8
+ export declare function licenseOf(library: Pick<Library, "license"> | undefined): SpdxId;
9
+ /** The line every `LICENSE` begins with, as the license asks of its licensor (its section Notices). */
10
+ export declare const REQUIRED_NOTICE = "Required Notice: Copyright Intellectual Frontiers LLC (https://github.com/intellectual-frontiers/.github)";
11
+ /** The text of a `LICENSE`: the required notice, a blank line and the official text exactly as it is. */
12
+ export declare function licenseFileText(official: string): string;
13
+ /** What is wrong, one case for each sentence. */
14
+ export type Finding = {
15
+ readonly kind: "text-missing";
16
+ readonly id: SpdxId;
17
+ readonly file: string;
18
+ } | {
19
+ readonly kind: "text-changed";
20
+ readonly id: SpdxId;
21
+ readonly want: string;
22
+ readonly have: string;
23
+ } | {
24
+ readonly kind: "manifest";
25
+ readonly dir: string;
26
+ readonly problem: string;
27
+ } | {
28
+ readonly kind: "missing";
29
+ readonly path: string;
30
+ readonly why: string;
31
+ } | {
32
+ readonly kind: "stale";
33
+ readonly path: string;
34
+ } | {
35
+ readonly kind: "lacks";
36
+ readonly path: string;
37
+ readonly what: string;
38
+ } | {
39
+ readonly kind: "vendored-gone";
40
+ readonly path: string;
41
+ };
42
+ /** The one sentence of a finding. */
43
+ export declare function sentence(f: Finding): string;
44
+ /** A file this module writes: its path from the repository and its whole text. */
45
+ export type Made = {
46
+ readonly path: string;
47
+ readonly text: string;
48
+ };
49
+ /** The official text of a license, held to the SHA-256 of its standard. */
50
+ export declare function officialText(id: SpdxId, folder?: string): Promise<Result<string, Finding>>;
51
+ /** `THIRD_PARTY_NOTICES.md` made from the items. */
52
+ export declare function thirdPartyNotices(items: readonly ThirdPartyItem[]): string;
53
+ /** The result of looking at a repository: what it should hold and what is wrong. */
54
+ export type Judged = {
55
+ readonly made: readonly Made[];
56
+ readonly findings: readonly Finding[];
57
+ };
58
+ /** The files this module makes for a repository and what is wrong with the rest, read from the files and the manifests; nothing is written. */
59
+ export declare function judge(repo: string, folder?: string): Promise<Judged>;
60
+ /** The command line: 0, or 1 where a finding exists (with `--check`) or a file could not be made. Without `--check` the files are written. */
61
+ export declare function main(argv: readonly string[]): Promise<number>;