@plasius/gpu-demo-viewer 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/CHANGELOG.md CHANGED
@@ -18,6 +18,20 @@ The format is based on Keep a Changelog and this project adheres to SemVer.
18
18
  - **Security**
19
19
  - (placeholder)
20
20
 
21
+ ## [0.4.1] - 2026-10-23
22
+
23
+ - **Added**
24
+ - Approved unsigned legal templates and security/contribution policies in the npm artifact, with fail-closed compliance checks, pinned template hashes and regression tests.
25
+
26
+ - **Changed**
27
+ - (placeholder)
28
+
29
+ - **Fixed**
30
+ - (placeholder)
31
+
32
+ - **Security**
33
+ - (placeholder)
34
+
21
35
  ## [0.4.0] - 2026-10-21
22
36
 
23
37
  - **Added**
@@ -368,3 +382,4 @@ The format is based on Keep a Changelog and this project adheres to SemVer.
368
382
  [0.2.3]: https://github.com/Plasius-LTD/gpu-demo-viewer/releases/tag/v0.2.3
369
383
  [0.3.0]: https://github.com/Plasius-LTD/gpu-demo-viewer/releases/tag/v0.3.0
370
384
  [0.4.0]: https://github.com/Plasius-LTD/gpu-demo-viewer/releases/tag/v0.4.0
385
+ [0.4.1]: https://github.com/Plasius-LTD/gpu-demo-viewer/releases/tag/v0.4.1
@@ -0,0 +1,32 @@
1
+ # Contributing to @plasius/gpu-demo-viewer
2
+
3
+ This workspace utility exists to accelerate validation across the Plasius
4
+ `gpu-*` packages.
5
+
6
+ ## Local Development
7
+
8
+ ### Prerequisites
9
+
10
+ - Node.js 24 (`nvm use`)
11
+ - npm
12
+
13
+ ### Validate
14
+
15
+ ```bash
16
+ npm run lint
17
+ npm test
18
+ ```
19
+
20
+ ### Demo
21
+
22
+ ```bash
23
+ npm run demo
24
+ ```
25
+
26
+ Then open `http://localhost:8000/gpu-demo-viewer/`.
27
+
28
+ ## Expectations
29
+
30
+ - Keep the viewer aligned with the real package demos; do not let the manifest drift.
31
+ - Add or update tests when browser target paths or shared showcase assets change.
32
+ - Update `README.md` and `CHANGELOG.md` whenever demo behavior or structure changes.
package/README.md CHANGED
@@ -56,6 +56,31 @@ See [the design and validation contract](docs/consented-diagnostics.md) and
56
56
  The npm package includes the viewer source, manifest and build-time acquisition
57
57
  helper and typed composite layout definitions. Model binaries are downloaded separately; they are not bundled in npm.
58
58
 
59
+ ## Package compliance documents
60
+
61
+ The npm artifact includes `LICENSE`, `SECURITY.md`, `CONTRIBUTING.md` and the
62
+ unsigned [CLA guide](legal/CLA.md), [Individual CLA](legal/INDIVIDUAL_CLA.md)
63
+ and [Corporate CLA](legal/CORPORATE_CLA.md) templates from the approved schema
64
+ baseline. Only package-name references are adapted. These documents describe
65
+ contribution and reporting policies; model-specific credits and licences remain
66
+ with their existing catalogue records.
67
+
68
+ Run `npm ci`, `npm run build`, `npm test`, `npm run test:coverage` and
69
+ `npm run pack:check` to validate the contract. The pack check requires non-empty
70
+ regular compliance files and a real `legal/` directory, then verifies their
71
+ presence in the actual npm dry-run manifest. SHA-256 checks pin the exact bytes
72
+ of all three templates to schema commit `d8f8eb430c77b8a98da496a3d8382d73d6297394`
73
+ after package-name substitution. Future legal changes require explicit review
74
+ of the approved baseline, pinned digests and regression expectations together.
75
+ CI and the approved CD path run this check. It fails on missing documents,
76
+ omitted package entries, symlinks, altered template terms or unexpected legal
77
+ files in the artifact. The package allowlist names each legal template individually.
78
+
79
+ Signed agreements and contributor acceptance records belong in the approved
80
+ access-controlled system outside source control. Never add them to this
81
+ repository, package or public build artifacts. See [ADR 0008](docs/adrs/adr-0008-public-compliance-artifact-contract.md)
82
+ for the packaging decision and release checks.
83
+
59
84
  ## Run the model workshop
60
85
 
61
86
  Use Node.js 24 or later, npm, and a WebGPU-capable browser on localhost or HTTPS.
package/SECURITY.md ADDED
@@ -0,0 +1,17 @@
1
+ # Security Policy
2
+
3
+ ## Supported Versions
4
+
5
+ We currently support the latest major version of this project. Older versions may not receive security updates.
6
+
7
+ ## Reporting a Vulnerability
8
+
9
+ If you discover a security vulnerability, please report it privately by emailing us at [security@plasius.co.uk](mailto:security@plasius.co.uk). Please do not create a public issue for security-related matters.
10
+
11
+ ## Response Timeline
12
+
13
+ We aim to acknowledge your report within 2 business days and to provide a more detailed response (including next steps and, if applicable, a timeline for a fix) within 7 business days.
14
+
15
+ ## Disclosure Policy
16
+
17
+ We request that you give us the opportunity to address the vulnerability before publicly disclosing it. We will coordinate with you on public disclosure once a fix is available and deployed.
@@ -0,0 +1,60 @@
1
+ # ADR 0008: Public compliance artifact contract
2
+
3
+ Status: Accepted 2026-10-23
4
+
5
+ ## Context
6
+
7
+ Project Task gpu-demo-viewer#35 under operational task site#847 requires the
8
+ schema-template legal baseline and package-level guarantees. The previous
9
+ verifier allowed publication without security/contribution policies or legal
10
+ templates. This is repository-operational compliance maintenance; it changes no
11
+ product Feature, remotely controlled behaviour or entitlement. Flags and
12
+ capabilities are N/A for this packaging-only task.
13
+
14
+ ## Decision
15
+
16
+ Reuse the three unsigned templates from @plasius/schema main
17
+ `d8f8eb430c77b8a98da496a3d8382d73d6297394`, substituting only the package name.
18
+ Preserve Apache-2.0 package licensing and existing model-specific licences.
19
+ Include SECURITY.md and CONTRIBUTING.md and explicitly list each legal template
20
+ in package.json. Do not include a broad legal directory glob. Signed agreements
21
+ and acceptance records stay outside source control in the approved restricted
22
+ system; they are never package inputs.
23
+
24
+ The Node-built-in verifier checks metadata for non-empty regular compliance
25
+ files and a real legal directory. It pins SHA-256 digests of all three adapted
26
+ templates to exact approved bytes before invoking a bounded npm dry-run. Future
27
+ legal changes require reviewed baseline/digest and test updates together;
28
+ non-empty truncation, rewording or added terms must fail. It then
29
+ requires all six documents in the manifest and rejects any unapproved legal
30
+ entry. It does not read private contributor records. Its root argument permits
31
+ isolated test fixtures without mutating the working checkout. CI and CD invoke
32
+ the same pack check; no new runtime dependency or public runtime API is needed.
33
+
34
+ ## Alternatives
35
+
36
+ Repository-only documents would not satisfy the requested artifact baseline.
37
+ Including all of legal/ would make accidental document additions package inputs.
38
+ Checking source presence alone would miss package allowlist regressions. A new
39
+ shared package is unnecessary for these local filesystem checks.
40
+
41
+ ## Tests and NFR implications
42
+
43
+ Requirements-derived regressions remove, empty, symlink or omit each required
44
+ document and exercise actual npm dry-runs. Tampering regressions truncate,
45
+ reword and append to every template, and independently pin their approved hashes.
46
+ Positive fixtures prove the complete contract passes, while synthetic unlisted records stay excluded or fail packing.
47
+ Tests never create actual agreements or personal information. Source/helper
48
+ coverage, frozen install, audit, build and package checks establish reproducible
49
+ and maintainable validation. Viewer runtime, browser/GPU behaviour, accessibility,
50
+ SEO and performance are unchanged; no browser qualification or Azure secretref
51
+ change applies. Existing NFR.md remains the runtime baseline.
52
+
53
+ ## Release and rollback
54
+
55
+ Deliver through PR, successful CI, protected main and the existing cd.yml
56
+ production/OIDC prepare-publish route. Verify a fresh package version and compare
57
+ all required document bytes with the released source and sealed tarball. Do not
58
+ manually promote changelog sections or publish locally. Correct packaging defects
59
+ through an ordinary forward release; never roll back by publishing private
60
+ records or restoring fail-open validation. No site consumer deployment is needed.
@@ -10,3 +10,5 @@
10
10
  - [ADR 0005: Build-time model acquisition subpath](adr-0005-build-time-model-acquisition-subpath.md)
11
11
  - [ADR 0006: Composite study consumer](adr-0006-composite-study-consumer.md)
12
12
  - [ADR 0007: Consented curated showcase diagnostics](adr-0007-consented-curated-showcase-diagnostics.md)
13
+
14
+ - [ADR 0008: Public compliance artifact contract](adr-0008-public-compliance-artifact-contract.md)
package/legal/CLA.md ADDED
@@ -0,0 +1,25 @@
1
+ # Contributor License Agreements (CLA)
2
+
3
+ To protect the intellectual property of this project and ensure clarity of rights, all contributors must sign a Contributor License Agreement (CLA) before their first contribution.
4
+
5
+ ## Which CLA should I sign?
6
+
7
+ - **Individual CLA**: If you are contributing personally and not on behalf of an employer, sign the [Individual CLA](INDIVIDUAL_CLA.md).
8
+ - **Corporate CLA**: If you are contributing as part of your work for a company, the company should sign the [Corporate CLA](CORPORATE_CLA.md).
9
+
10
+ ## How to sign
11
+
12
+ 1. Download the appropriate CLA file (Individual or Corporate).
13
+ 2. Fill in the required details, sign, and date it.
14
+ 3. Email a PDF copy of the signed document to **[contributors@plasius.co.uk](mailto:contributors@plasius.co.uk)** with subject: `CLA – Individual` or `CLA – Corporate`.
15
+
16
+ ## Registry
17
+
18
+ Signed agreements and acceptance records are stored in an access-controlled
19
+ system outside source control. They must never be committed to a repository,
20
+ included in a package, or copied into issues, pull requests, build logs, or
21
+ other public artifacts.
22
+
23
+ ## Questions?
24
+
25
+ If you have any questions about which CLA to sign or how the process works, please email **[contributors@plasius.co.uk](mailto:contributors@plasius.co.uk)**.
@@ -0,0 +1,57 @@
1
+ # Corporate Contributor License Agreement (CLA)
2
+
3
+ ## Purpose
4
+
5
+ This Corporate Contributor License Agreement ("Agreement") is intended to protect the intellectual property rights of the contributors and the project, ensure clear licensing terms for contributions, and maintain trust within the community. By signing this Agreement, the corporation agrees to the terms that facilitate the use, distribution, and modification of contributions under the project's licensing framework.
6
+
7
+ ## Agreement
8
+
9
+ 1. **Representation of Authority**
10
+ The undersigned individual represents and warrants that they have the full legal authority to enter into this Agreement on behalf of the corporation named below ("Corporation") and to grant the rights contained herein.
11
+
12
+ 2. **Grant of Copyright License**
13
+ The Corporation hereby grants to the project maintainers and users a perpetual, worldwide, non-exclusive, royalty-free, irrevocable copyright license to use, reproduce, prepare derivative works of, publicly display, publicly perform, sublicense, and distribute the contributions submitted to the project.
14
+
15
+ 3. **Grant of Patent License**
16
+ The Corporation hereby grants to the project maintainers and users a perpetual, worldwide, non-exclusive, royalty-free, irrevocable license under any patent claims that are necessarily infringed by the contributions to make, use, sell, offer for sale, import, and otherwise dispose of the contributions or derivative works thereof.
17
+
18
+ 4. **Warranties and Representations**
19
+ The Corporation represents and warrants that:
20
+
21
+ - The contributions are the original work of the Corporation or that the Corporation has sufficient rights to grant the licenses herein.
22
+ - The submission of the contributions does not violate any agreements or rights of third parties.
23
+
24
+ 5. **No Revocation**
25
+ This license is granted on a perpetual basis and cannot be revoked, provided that the terms of this Agreement are met.
26
+
27
+ 6. **Governing Law**
28
+ This Agreement shall be governed by and construed in accordance with the laws of the United Kingdom, without regard to its conflict of laws principles.
29
+
30
+ 7. **Execution**
31
+
32
+ This Agreement is effective upon signature by the authorized representative of the Corporation. Please sign and date this document, then email a scanned PDF copy to [contributors@plasius.co.uk](mailto:contributors@plasius.co.uk).
33
+
34
+ ---
35
+
36
+ ### **@plasius/gpu-demo-viewer**
37
+
38
+ **Corporation Legal Name:** \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
39
+
40
+ **Authorized Representative:** \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
41
+
42
+ **Title:** \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
43
+
44
+ **Email:** \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
45
+
46
+ **Date:** \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
47
+
48
+ **Signature:** \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
49
+
50
+ ---
51
+
52
+ ## How to Sign
53
+
54
+ - Download this file as a template.
55
+ - Fill in the Corporation’s legal name, authorized representative, title, email, date, and provide a signature.
56
+ - Sign and date the document.
57
+ - Send a scanned copy of the signed Agreement to [contributors@plasius.co.uk](mailto:contributors@plasius.co.uk).
@@ -0,0 +1,91 @@
1
+ # Individual Contributor License Agreement (CLA)
2
+
3
+ **Project:** @plasius/gpu-demo-viewer (Plasius LTD)
4
+ **Version:** 1.0 — 2025‑09‑12
5
+ **Contact:** [contributors@plasius.co.uk](mailto:contributors@plasius.co.uk)
6
+
7
+ ---
8
+
9
+ ## 1. Definitions
10
+
11
+ - **"You"** (or **"Contributor"**) means the individual signing this CLA and submitting Contributions to the Project.
12
+ - **"Contribution"** means any original work of authorship, including code, documentation, data, designs, or feedback that You submit to the Project in any form (e.g., pull request, issue comment, email, file upload).
13
+ - **"Project"** means the @plasius/gpu-demo-viewer repositories and related materials owned or managed by **Plasius LTD**.
14
+
15
+ ## 2. Copyright License Grant
16
+
17
+ You hereby grant to Plasius LTD a **perpetual, worldwide, non‑exclusive, transferable, sublicensable, royalty‑free, irrevocable** copyright license to:
18
+
19
+ - use, reproduce, publicly display, publicly perform, modify, create derivative works of, and
20
+ - distribute Contributions in source and object form,
21
+ - and to **sublicense** these rights under any terms Plasius LTD chooses, including proprietary or open‑source licenses.
22
+
23
+ ## 3. Patent License Grant
24
+
25
+ You hereby grant to Plasius LTD and its sublicensees a **perpetual, worldwide, non‑exclusive, transferable, royalty‑free, irrevocable** patent license to **make, have made, use, offer to sell, sell, import, and otherwise transfer** the Contribution and derivative works thereof, where such license applies only to patent claims that You **own or control** and that would be infringed by Your Contribution or its combination with the Project.
26
+
27
+ ## 4. Moral Rights & Attribution
28
+
29
+ To the maximum extent permitted by applicable law, You **waive** and agree not to assert any moral rights (e.g., rights of attribution or integrity) in or to the Contribution against Plasius LTD. Plasius LTD may, but is not required to, credit You.
30
+
31
+ ## 5. Representations & Warranties
32
+
33
+ You represent that:
34
+
35
+ 1. **Originality / Rights:** Each Contribution is Your original creation, or You have sufficient rights to submit it and grant the licenses above.
36
+ 2. **No Confidential Info:** Contributions **do not** include confidential information or trade secrets of any third party.
37
+ 3. **No Infringement:** To the best of Your knowledge, Contributions do not infringe any third‑party IP rights.
38
+ 4. **Employment / Contractor Status:** If Your employer or a third party might claim rights in Your Contribution, You have obtained **written permission** to make the Contribution and grant these licenses (attach or reference below), or Your Contribution is made **outside the scope** of your employment and without using your employer’s confidential information or resources.
39
+ 5. **Compliance:** You will follow the Project’s policies (e.g., Code of Conduct, Security Policy) and applicable laws.
40
+
41
+ ## 6. Third‑Party Code
42
+
43
+ If Your Contribution includes code, data, or other material from a third party, You will **identify the material and its license** in the pull request or submission, and ensure it is **compatible** with the Project’s licensing model. You will not submit material subject to terms that require the Project to disclose proprietary source code (e.g., certain copyleft obligations) unless the Project has **pre‑approved** such inclusion in writing.
44
+
45
+ ## 7. Scope & Duration
46
+
47
+ - This CLA covers **all past and future** Contributions You submit to the Project, unless and until You provide written notice to **revoke** it.
48
+ - Revocation is **not retroactive**: rights granted for prior Contributions remain in effect.
49
+
50
+ ## 8. Disclaimer
51
+
52
+ THE CONTRIBUTION IS PROVIDED “AS IS” WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON‑INFRINGEMENT.
53
+
54
+ ## 9. Governing Law & Jurisdiction
55
+
56
+ This CLA is governed by the **laws of England and Wales**, and the courts of England and Wales shall have **exclusive jurisdiction** over any dispute arising out of or relating to it.
57
+
58
+ ## 10. Entire Agreement
59
+
60
+ This CLA is the entire agreement between You and Plasius LTD regarding Contributions. It supersedes any prior discussions relating to Contributions. If any provision is held unenforceable, the remaining provisions remain in full force.
61
+
62
+ ---
63
+
64
+ ## 11. Contributor Information & Signature
65
+
66
+ By signing below, You agree to the terms of this CLA for Your Contributions to the Project.
67
+
68
+ **Full Name:** \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
69
+
70
+ **Email:** \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
71
+
72
+ **GitHub Handle:** \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
73
+
74
+ **Address (optional):** \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
75
+
76
+ **Employer (if applicable):** \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
77
+
78
+ **If employed:** ☐ I confirm Contributions are made outside the scope of employment **or** ☐ I have attached my employer’s written permission.
79
+
80
+ **Signature:** \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
81
+
82
+ **Date (YYYY‑MM‑DD):** \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
83
+
84
+ _Electronic signatures are accepted. You may type your name in the Signature field and email a PDF copy._
85
+
86
+ **Submission:** Please email the signed CLA to **[contributors@plasius.co.uk](mailto:contributors@plasius.co.uk)** with subject line: `CLA – Individual – <GitHubHandle>`.
87
+
88
+ **(Optional) Attachments / Notes:**
89
+
90
+ - Employer permission letter (if required)
91
+ - Third‑party license disclosures (if any)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plasius/gpu-demo-viewer",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "type": "module",
5
5
  "description": "Root validation viewer for Plasius gpu-* demos.",
6
6
  "license": "Apache-2.0",
@@ -41,7 +41,12 @@
41
41
  "styles.css",
42
42
  "viewer-manifest.js",
43
43
  "model-library/",
44
- "diagnostics/"
44
+ "diagnostics/",
45
+ "SECURITY.md",
46
+ "CONTRIBUTING.md",
47
+ "legal/CLA.md",
48
+ "legal/INDIVIDUAL_CLA.md",
49
+ "legal/CORPORATE_CLA.md"
45
50
  ],
46
51
  "engines": {
47
52
  "node": ">=24"
@@ -1,9 +1,25 @@
1
1
  const fs = require("node:fs");
2
2
  const os = require("node:os");
3
+ const { createHash } = require("node:crypto");
3
4
  const path = require("node:path");
4
5
  const { spawnSync } = require("node:child_process");
5
6
 
6
- const repoRoot = path.resolve(__dirname, "..");
7
+ const complianceFiles = [
8
+ "LICENSE",
9
+ "SECURITY.md",
10
+ "CONTRIBUTING.md",
11
+ "legal/CLA.md",
12
+ "legal/INDIVIDUAL_CLA.md",
13
+ "legal/CORPORATE_CLA.md"
14
+ ];
15
+
16
+ // Approved schema d8f8eb430c77b8a98da496a3d8382d73d6297394, with only
17
+ // @plasius/schema replaced by @plasius/gpu-demo-viewer. Hash exact bytes.
18
+ const approvedTemplates = {
19
+ "legal/CLA.md": "8e7de8348013f65a551d9a3179d4927cdce4ae15497ba209a0cf2c1098ba489c",
20
+ "legal/INDIVIDUAL_CLA.md": "6ce945a06ee88d3c3103a6094123465440d8e9890a84956f257555cc9994fb39",
21
+ "legal/CORPORATE_CLA.md": "f56606b1a8a563ca1bae67a9335f32ced1ce3827dec500bc28617de604c66608"
22
+ };
7
23
 
8
24
  function assert(condition, message) {
9
25
  if (!condition) {
@@ -11,14 +27,15 @@ function assert(condition, message) {
11
27
  }
12
28
  }
13
29
 
14
- function readJson(relativePath) {
30
+ function readJson(repoRoot, relativePath) {
15
31
  return JSON.parse(fs.readFileSync(path.join(repoRoot, relativePath), "utf8"));
16
32
  }
17
33
 
18
- function packDryRunFiles() {
34
+ function packDryRunFiles(repoRoot) {
19
35
  const result = spawnSync("npm", ["pack", "--dry-run", "--json"], {
20
36
  cwd: repoRoot,
21
37
  encoding: "utf8",
38
+ timeout: 30000,
22
39
  env: {
23
40
  ...process.env,
24
41
  npm_config_cache:
@@ -38,8 +55,8 @@ function packDryRunFiles() {
38
55
  return packInfo.files.map((file) => file.path).sort();
39
56
  }
40
57
 
41
- function main() {
42
- const packageJson = readJson("package.json");
58
+ function verifyPublicPackage(repoRoot = path.resolve(__dirname, "..")) {
59
+ const packageJson = readJson(repoRoot, "package.json");
43
60
 
44
61
  assert(packageJson.name === "@plasius/gpu-demo-viewer", "package name must remain scoped");
45
62
  assert(packageJson.private !== true, "public package must not set private=true");
@@ -51,11 +68,24 @@ function main() {
51
68
  assert(packageJson.repository?.url?.includes("Plasius-LTD/gpu-demo-viewer"), "repository metadata is required");
52
69
  assert(packageJson.exports?.["."] === "./viewer-manifest.js", "viewer manifest must be the package root export");
53
70
 
54
- const files = packDryRunFiles();
71
+ // Inspect metadata before packing; never read contributor acceptance records.
72
+ const legalDirectory = fs.lstatSync(path.join(repoRoot, "legal"));
73
+ assert(legalDirectory.isDirectory(), "legal must be a real directory");
74
+ for (const file of complianceFiles) {
75
+ const stat = fs.lstatSync(path.join(repoRoot, file));
76
+ assert(stat.isFile() && stat.size > 0, `${file} must be a non-empty regular file`);
77
+ }
78
+
79
+ for (const [file, expected] of Object.entries(approvedTemplates)) {
80
+ const digest = createHash("sha256").update(fs.readFileSync(path.join(repoRoot, file))).digest("hex");
81
+ assert(digest === expected, `${file} must match approved schema template`);
82
+ }
83
+
84
+ const files = packDryRunFiles(repoRoot);
55
85
  const fileSet = new Set(files);
56
86
  const requiredFiles = [
57
87
  "CHANGELOG.md",
58
- "LICENSE",
88
+ ...complianceFiles,
59
89
  "README.md",
60
90
  "assets/brigantine.gltf",
61
91
  "docs/adrs/index.md",
@@ -73,6 +103,10 @@ function main() {
73
103
  }
74
104
 
75
105
  for (const file of files) {
106
+ assert(
107
+ !file.startsWith("legal/") || complianceFiles.includes(file),
108
+ `package tarball contains unapproved legal document: ${file}`
109
+ );
76
110
  assert(!file.startsWith("node_modules/"), `package tarball must not include ${file}`);
77
111
  assert(!file.startsWith("tests/"), `package tarball must not include ${file}`);
78
112
  assert(!file.startsWith(".git/"), `package tarball must not include ${file}`);
@@ -82,9 +116,13 @@ function main() {
82
116
  process.stdout.write("Public package contract verified.\n");
83
117
  }
84
118
 
85
- try {
86
- main();
87
- } catch (error) {
88
- process.stderr.write(`${error.message}\n`);
89
- process.exitCode = 1;
119
+ module.exports = { verifyPublicPackage };
120
+
121
+ if (require.main === module) {
122
+ try {
123
+ verifyPublicPackage();
124
+ } catch (error) {
125
+ process.stderr.write(`${error.message}\n`);
126
+ process.exitCode = 1;
127
+ }
90
128
  }