wellkit 0.0.0-stage → 0.2.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/EULA.txt ADDED
@@ -0,0 +1,33 @@
1
+ Wellkit CLI Binary End User Licence Agreement (0.x preview)
2
+ Copyright (c) BarretoTech. All rights reserved.
3
+
4
+ 1. Permission. BarretoTech grants you a non-exclusive, worldwide, royalty-free
5
+ licence to install and use the unmodified Wellkit CLI and its launcher for any
6
+ purpose, including commercial use. You may redistribute unmodified copies if
7
+ you preserve this agreement and all third-party copyright and licence notices.
8
+ No licence to the proprietary source code is granted.
9
+
10
+ 2. Restrictions. You may not redistribute modified versions of the proprietary
11
+ binaries. You may not reverse engineer, decompile or disassemble proprietary
12
+ parts of the software, except to the extent permitted by applicable law or the
13
+ third-party licences described below. No trademark rights are granted.
14
+
15
+ 3. Third-party software. Third-party components remain governed by their own
16
+ licences in notices.zip and the release SBOM. Those licences prevail over any
17
+ conflicting provision here, including rights to source, modification,
18
+ redistribution, relinking and reverse engineering to debug modifications.
19
+ This agreement does not restrict those rights or decide the licence of any
20
+ separately distributed Wellkit component library.
21
+
22
+ 4. Preview and warranty. This is an unsigned 0.x preview. The software is
23
+ provided "AS IS", without warranties of any kind, including merchantability,
24
+ fitness for a particular purpose or non-infringement. You are responsible for
25
+ verifying results and for decisions made using them.
26
+
27
+ 5. Liability. To the maximum extent permitted by applicable law, BarretoTech
28
+ is not liable for losses, damages or other liability arising from the software
29
+ or its use. Nothing here excludes a right or liability that law cannot exclude.
30
+
31
+ 6. Termination. Permission to use the proprietary parts ends if you materially
32
+ breach this agreement. Termination does not limit rights granted independently
33
+ by third-party licences or applicable law.
package/checksums.json ADDED
@@ -0,0 +1,37 @@
1
+ {
2
+ "version": "0.2.1",
3
+ "assets": {
4
+ "wellkit-linux-x64": {
5
+ "sha256": "a6adc14855b92626f812d854c6743d065998d5fd3366bb293073c7179cbb0e85",
6
+ "size": 163605320
7
+ },
8
+ "wellkit-linux-x64-musl": {
9
+ "sha256": "974c1d81b7b484c9196d253b0508876d6dc901773046fa7172bd8047bf505ede",
10
+ "size": 151224488
11
+ },
12
+ "wellkit-linux-arm64": {
13
+ "sha256": "72e7c698a50c53e77c1101ac70575ee3f8b85ab756c77b2c9a40c09a1ff51a23",
14
+ "size": 164417248
15
+ },
16
+ "wellkit-linux-arm64-musl": {
17
+ "sha256": "bc44ae557f65b229519698a47ebaac098cf92eff1be05a6373a0324ea3f4ae74",
18
+ "size": 149309248
19
+ },
20
+ "wellkit-darwin-x64": {
21
+ "sha256": "8e13e8724c572a1d2072076be165467d9a18f59f34458490f039bbc53e169cde",
22
+ "size": 155570664
23
+ },
24
+ "wellkit-darwin-arm64": {
25
+ "sha256": "360aaf6edea23b06c1546357377a50a3245c325f906bcf2213aec9b08d10067e",
26
+ "size": 144767954
27
+ },
28
+ "wellkit-win32-x64.exe": {
29
+ "sha256": "cd9876287ed16513137c1a50ed5b4bacc310dac41d3ec5b600bffcad2af8825e",
30
+ "size": 171355648
31
+ },
32
+ "wellkit-win32-arm64.exe": {
33
+ "sha256": "fd84cd18cea7dbc4dd8a8d943f37250b7085d97b1937aa90103c96043959950d",
34
+ "size": 154374144
35
+ }
36
+ }
37
+ }
package/notices.zip ADDED
Binary file
package/package.json CHANGED
@@ -1,6 +1,23 @@
1
1
  {
2
+ "version": "0.2.1",
3
+ "license": "SEE LICENSE IN EULA.txt",
4
+ "description": "Wellkit CLI launcher — downloads and verifies the unsigned 0.x preview binary",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/BarretoTech/well-components"
8
+ },
9
+ "publishConfig": {
10
+ "access": "public"
11
+ },
2
12
  "name": "wellkit",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
13
+ "type": "module",
14
+ "bin": {
15
+ "wellkit": "wellkit.mjs"
16
+ },
17
+ "files": [
18
+ "wellkit.mjs",
19
+ "checksums.json",
20
+ "EULA.txt",
21
+ "notices.zip"
22
+ ]
23
+ }
package/wellkit.mjs ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import{spawn as G}from"node:child_process";import{createHash as P,randomBytes as J}from"node:crypto";import{closeSync as U,mkdirSync as z,openSync as M,readFileSync as I,realpathSync as D,renameSync as q,rmSync as b,statSync as L,writeSync as X}from"node:fs";import O from"node:http";import A from"node:https";import{homedir as W}from"node:os";import{dirname as Y,isAbsolute as F,join as p}from"node:path";import V from"node:tls";import{fileURLToPath as E}from"node:url";var g=[{id:"linux-x64",compile:"bun-linux-x64",os:"linux",arch:"x64",libc:"glibc"},{id:"linux-x64-musl",compile:"bun-linux-x64-musl",os:"linux",arch:"x64",libc:"musl"},{id:"linux-arm64",compile:"bun-linux-arm64",os:"linux",arch:"arm64",libc:"glibc"},{id:"linux-arm64-musl",compile:"bun-linux-arm64-musl",os:"linux",arch:"arm64",libc:"musl"},{id:"darwin-x64",compile:"bun-darwin-x64",os:"darwin",arch:"x64",libc:null},{id:"darwin-arm64",compile:"bun-darwin-arm64",os:"darwin",arch:"arm64",libc:null},{id:"win32-x64",compile:"bun-windows-x64",os:"win32",arch:"x64",libc:null},{id:"win32-arm64",compile:"bun-windows-arm64",os:"win32",arch:"arm64",libc:null}];function S(e){return e.os==="win32"?"well.exe":"well"}var B="BarretoTech/wellkit",R=`https://github.com/${B}/releases/download`,x="checksums.json",H=(e)=>`wellkit-v${e}`,C=(e)=>`wellkit-${e.id}${S(e)==="well.exe"?".exe":""}`,v=(e,t,r)=>`${e}/${H(t)}/${r}`;function T(e,t){let r=()=>Error("Invalid checksums.json"),s;try{s=JSON.parse(e)}catch{throw r()}let n=s;if(!n||typeof n!=="object"||n.version!==t||!n.assets||typeof n.assets!=="object")throw r();for(let o of Object.values(n.assets))if(!o||!/^[0-9a-f]{64}$/.test(o.sha256)||!Number.isSafeInteger(o.size)||o.size<=0)throw r();return n}class c extends Error{}function j(e,t){let r=e;if(typeof r?.header?.glibcVersionRuntime==="string"&&r.header.glibcVersionRuntime.length)return"glibc";if((Array.isArray(r?.sharedObjects)?r.sharedObjects:[]).some((n)=>typeof n==="string"&&n.includes("musl"))||/musl/i.test(t))return"musl";if(/GNU C Library|GLIBC/i.test(t))return"glibc";return}var K=g.map((e)=>e.id).join(", ");function Z(e,t,r,s){let n=(i)=>new c(`wellkit: ${i} Supported platforms: ${K}.`);if(!["linux","darwin","win32"].includes(e)||!["x64","arm64"].includes(t))throw n(`Unsupported platform ${e}/${t}.`);let o=e==="linux"?j(r,s):void 0;if(e==="linux"&&!o)throw n("Unsupported or undetectable Linux libc; glibc or musl is required.");return g.find((i)=>i.os===e&&i.arch===t&&(i.libc??void 0)===o)}function Q(e,t,r){let s=t.WELLKIT_CACHE_DIR;if(s)return s;if(e==="win32")return p(t.LOCALAPPDATA||p(r,"AppData","Local"),"wellkit","Cache");if(e==="darwin")return p(r,"Library","Caches","wellkit");let n=t.XDG_CACHE_HOME;return p(n&&F(n)?n:p(r,".cache"),"wellkit")}var k=(e)=>["127.0.0.1","localhost","[::1]"].includes(e.hostname);function ee(e,t){let r=t.HTTPS_PROXY||t.https_proxy;if(e.protocol!=="https:"||!r)return;let s=(t.NO_PROXY||t.no_proxy||"").split(",").map((i)=>i.trim().replace(/^\*?\./,"").toLowerCase()).filter(Boolean),n=e.hostname.toLowerCase();if(s.some((i)=>i==="*"||n===i||n.endsWith(`.${i}`)))return;let o;try{o=new URL(r)}catch{throw new c("wellkit: HTTPS_PROXY is not a valid URL.")}if(o.protocol!=="http:")throw new c("wellkit: HTTPS_PROXY must be an http:// URL.");return o}var te=(e)=>Number(e.port)||80;function ne(e,t){let r=new A.Agent;return r.createConnection=(s,n)=>{let o={};if(e.username)o["proxy-authorization"]=`Basic ${Buffer.from(`${decodeURIComponent(e.username)}:${decodeURIComponent(e.password)}`).toString("base64")}`;let i=O.request({host:e.hostname,port:te(e),method:"CONNECT",path:`${s.host}:${s.port}`,headers:o}),a=setTimeout(()=>i.destroy(Error("timed out")),t);i.on("close",()=>clearTimeout(a)),i.on("connect",(u,f)=>{if(u.statusCode!==200){f.destroy(),n(Error(`proxy answered ${u.statusCode}`));return}n(null,V.connect({...s,socket:f}))}),i.on("error",n),i.end()},r}function re(e,{env:t,ca:r,timeout:s=30000}){return new Promise((n,o)=>{let i=ee(e,t),a=(e.protocol==="https:"?A:O).get(e,{headers:{"user-agent":"wellkit-launcher"},...r?{ca:r}:{},...i?{agent:ne(i,s)}:{}},n);a.setTimeout(s,()=>a.destroy(Error("timed out"))),a.on("error",o)})}var oe=5;async function ie(e,t){let r=e;for(let s=0;s<=oe;s++){let n=await t(r),o=n.statusCode??0;if([301,302,303,307,308].includes(o)){n.resume();let i=n.headers.location;if(!i)throw new c(`redirect without a location from ${r.host}`);let a=new URL(i,r);if(a.protocol!=="https:"&&!(k(a)&&a.protocol==="http:"&&k(e)))throw new c(`refusing a redirect to ${a.protocol}//${a.host}`);r=a;continue}if(o!==200)throw n.resume(),new c(`${r.host} answered HTTP ${o}`);return n}throw new c("too many redirects")}var se={platform:process.platform,arch:process.arch,env:process.env,home:W(),dir:Y(E(import.meta.url)),pid:process.pid,report:process.report.getReport.bind(process.report),read:I,rename:q,get:(e)=>re(e,{env:process.env}),log:(e)=>console.error(e),spawn:(e,t,r)=>{let s=G(e,t,r),n=new Promise((o)=>{s.once("error",(i)=>o({error:i})),s.once("exit",(i,a)=>o({status:i,signal:a}))});return Object.assign(n,{kill:(o)=>s.kill(o)})},on:process.on.bind(process),off:process.off.bind(process),kill:process.kill.bind(process)},N=(e,t)=>{try{return L(e).size===t.size&&P("sha256").update(I(e)).digest("hex")===t.sha256}catch{return!1}};async function _(e,t,r,s){let n=C(e),o=s.assets[n];if(!o)throw new c(`wellkit: No checksum for ${n} is embedded in this package; refusing to download or run an unverified binary. Reinstall wellkit.`);let i=p(Q(r.platform,r.env,r.home),t),a=p(i,n);if(N(a,o))return a;b(a,{force:!0}),z(i,{recursive:!0});let u=new URL(v(r.env.WELLKIT_DOWNLOAD_BASE||R,t,n));if(u.protocol!=="https:"&&!(u.protocol==="http:"&&k(u)))throw new c("wellkit: download base must use https, or http on a loopback host.");r.log(`wellkit: downloading ${n} ${t} (first run)...`);let f=p(i,`.${n}.${r.pid}.${J(6).toString("hex")}.tmp`),d;try{let m;try{m=await ie(u,r.get)}catch(l){throw new c(`wellkit: Cannot download ${n} from ${u.host}: ${l instanceof Error?l.message:"request failed"}. The first run needs network access to github.com.`)}d=M(f,"w",493);let w=P("sha256"),h=0;try{for await(let l of m){if(h+=l.length,h>o.size)throw new c(`wellkit: ${n} is larger than expected; refusing it.`);w.update(l),X(d,l)}}catch(l){if(l instanceof c)throw l;throw new c(`wellkit: The download of ${n} was interrupted: ${l instanceof Error?l.message:"stream failed"}.`)}if(U(d),d=void 0,h!==o.size||w.digest("hex")!==o.sha256)throw new c(`wellkit: Checksum mismatch for ${n} ${t}; the download does not match the checksum embedded in this package and was discarded.`);try{r.rename(f,a)}catch(l){if(!N(a,o)){let y=!1;try{L(a),y=!0}catch{}if(b(a,{force:!0}),y)return _(e,t,r,s);throw l}}}finally{if(d!==void 0)U(d);b(f,{force:!0})}return a}async function ae(e,t=se){let r={},s="";if(t.platform==="linux"){try{r=t.report()}catch{}if(!j(r,""))for(let m of["/usr/bin/ldd","/bin/ldd"])try{s=t.read(m,"utf8");break}catch{}}let n=Z(t.platform,t.arch,r,s),o;try{o=JSON.parse(t.read(p(t.dir,"package.json"),"utf8")).version}catch{}if(typeof o!=="string")throw new c("wellkit: Invalid launcher version; reinstall wellkit.");let i;try{i=T(t.read(p(t.dir,x),"utf8"),o)}catch{throw new c(`wellkit: ${x} is missing or does not match this version; refusing to run an unverified binary. Reinstall wellkit.`)}let a=await _(n,o,t,i),u=t.spawn(a,e,{stdio:"inherit"}),f=["SIGINT","SIGTERM","SIGHUP"].map((m)=>{let w=()=>{if("kill"in u)u.kill(m)};return t.on(m,w),{signal:m,relay:w}}),d;try{d=await u}finally{for(let{signal:m,relay:w}of f)t.off(m,w)}if(d.error)throw new c("wellkit: Unable to start the downloaded well binary; remove the wellkit cache directory and retry.");if(d.signal)return t.kill(t.pid,d.signal),1;return d.status??2}async function ce(e=import.meta.url,t=process,r=console,s=ae,n=D){if(!t.argv[1])return;try{if(n(t.argv[1])!==n(E(e)))return}catch{return}try{t.exitCode=await s(t.argv.slice(2))}catch(o){r.error(o instanceof c?o.message:"wellkit: Unable to start; reinstall wellkit."),t.exitCode=2}}ce();export{Q as cacheRoot,_ as ensureBinary,re as httpGet,ce as main,ee as proxyFor,te as proxyPort,ae as runLauncher,Z as selectTarget,se as system};
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.