@chadsly/knit 0.1.3
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/README.md +34 -0
- package/artifacts/checksums.sig +0 -0
- package/artifacts/checksums.txt +10 -0
- package/artifacts/knit_0.1.3_darwin_amd64.tar.gz +0 -0
- package/artifacts/knit_0.1.3_darwin_arm64.tar.gz +0 -0
- package/artifacts/knit_0.1.3_linux_amd64.tar.gz +0 -0
- package/artifacts/knit_0.1.3_linux_arm64.tar.gz +0 -0
- package/artifacts/knit_0.1.3_windows_amd64.zip +0 -0
- package/artifacts/release-manifest.json +21 -0
- package/bin/knit-daemon.js +39 -0
- package/lib/install.js +105 -0
- package/package.json +47 -0
package/README.md
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# `@chadsly/knit`
|
|
2
|
+
|
|
3
|
+
`@chadsly/knit` installs the host-specific Knit daemon from bundled release artifacts and exposes it through the `knit` command.
|
|
4
|
+
|
|
5
|
+
Install:
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install -g @chadsly/knit
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Start Knit:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
knit start
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Other commands:
|
|
18
|
+
|
|
19
|
+
- `knit path`
|
|
20
|
+
- `knit version`
|
|
21
|
+
|
|
22
|
+
What happens on install:
|
|
23
|
+
|
|
24
|
+
- `postinstall` selects the archive for the current OS and CPU
|
|
25
|
+
- verifies it against the bundled release manifest
|
|
26
|
+
- extracts the native daemon into the package runtime directory
|
|
27
|
+
|
|
28
|
+
Supported platforms:
|
|
29
|
+
|
|
30
|
+
- macOS: `x64`, `arm64`
|
|
31
|
+
- Linux: `x64`, `arm64`
|
|
32
|
+
- Windows: `x64`
|
|
33
|
+
|
|
34
|
+
When you run `knit start`, the native daemon prints the local UI URL. Knit’s browser extension and main review UI still live outside this npm wrapper; this package is only the daemon/runtime install path.
|
|
Binary file
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
6a45d89f7773bf9547385c1f45173039e32e60976526228285a4c0f326f61609 /home/runner/work/knit/knit/dist-ci/packages/installers/knit_0.1.3_darwin_amd64.install.command
|
|
2
|
+
1e8141748f53201b7de63561c6ac6862e49bb1e2888fa7367b79151d4f1f9fcc /home/runner/work/knit/knit/dist-ci/packages/installers/knit_0.1.3_darwin_arm64.install.command
|
|
3
|
+
057470c0667c130a09a26322004905d211734df19440146e41e608b12a80a129 /home/runner/work/knit/knit/dist-ci/packages/installers/knit_0.1.3_linux_amd64.install.sh
|
|
4
|
+
3429a3ff4bbd4fd218356ce3fb43ae5b12b3fd0215e8672a058c26c1f952616a /home/runner/work/knit/knit/dist-ci/packages/installers/knit_0.1.3_linux_arm64.install.sh
|
|
5
|
+
df3c3c6c7ed2e6c81ed529eb45e61052eafe52f17f7b7fc7a0bcd7662f362e2a /home/runner/work/knit/knit/dist-ci/packages/installers/knit_0.1.3_windows_amd64.install.ps1
|
|
6
|
+
3b557f02cfbf0d0830dc1af91d333c093ee83f00be27cd7b64f068eb62ff3ee1 /home/runner/work/knit/knit/dist-ci/packages/knit_0.1.3_darwin_amd64.tar.gz
|
|
7
|
+
693de12510597391332fecf18d0579ae350d6e2d71bdae8d62eac26af46ec5a0 /home/runner/work/knit/knit/dist-ci/packages/knit_0.1.3_darwin_arm64.tar.gz
|
|
8
|
+
edb1f751c9db3114d35d68eca130bb516c316b9e972da2951715bb2a1692073d /home/runner/work/knit/knit/dist-ci/packages/knit_0.1.3_linux_amd64.tar.gz
|
|
9
|
+
8bef9284f505ab76dfd11b7cd86f1b8c80869cce8de414d44f5aaec41722795b /home/runner/work/knit/knit/dist-ci/packages/knit_0.1.3_linux_arm64.tar.gz
|
|
10
|
+
2cbc44bd20e22e185538c5a8bb8c83b6065969f542ce9463302f8e365bd857f9 /home/runner/work/knit/knit/dist-ci/packages/knit_0.1.3_windows_amd64.zip
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "0.1.3",
|
|
3
|
+
"source_date_epoch": "0",
|
|
4
|
+
"checksums_file": "checksums.txt",
|
|
5
|
+
"signed_checksums": true,
|
|
6
|
+
"has_build_manifest": true,
|
|
7
|
+
"has_sbom": true,
|
|
8
|
+
"has_dependency_scan": true,
|
|
9
|
+
"artifacts": [
|
|
10
|
+
{"sha256":"6a45d89f7773bf9547385c1f45173039e32e60976526228285a4c0f326f61609","path":"installers/knit_0.1.3_darwin_amd64.install.command"},
|
|
11
|
+
{"sha256":"1e8141748f53201b7de63561c6ac6862e49bb1e2888fa7367b79151d4f1f9fcc","path":"installers/knit_0.1.3_darwin_arm64.install.command"},
|
|
12
|
+
{"sha256":"057470c0667c130a09a26322004905d211734df19440146e41e608b12a80a129","path":"installers/knit_0.1.3_linux_amd64.install.sh"},
|
|
13
|
+
{"sha256":"3429a3ff4bbd4fd218356ce3fb43ae5b12b3fd0215e8672a058c26c1f952616a","path":"installers/knit_0.1.3_linux_arm64.install.sh"},
|
|
14
|
+
{"sha256":"df3c3c6c7ed2e6c81ed529eb45e61052eafe52f17f7b7fc7a0bcd7662f362e2a","path":"installers/knit_0.1.3_windows_amd64.install.ps1"},
|
|
15
|
+
{"sha256":"3b557f02cfbf0d0830dc1af91d333c093ee83f00be27cd7b64f068eb62ff3ee1","path":"knit_0.1.3_darwin_amd64.tar.gz"},
|
|
16
|
+
{"sha256":"693de12510597391332fecf18d0579ae350d6e2d71bdae8d62eac26af46ec5a0","path":"knit_0.1.3_darwin_arm64.tar.gz"},
|
|
17
|
+
{"sha256":"edb1f751c9db3114d35d68eca130bb516c316b9e972da2951715bb2a1692073d","path":"knit_0.1.3_linux_amd64.tar.gz"},
|
|
18
|
+
{"sha256":"8bef9284f505ab76dfd11b7cd86f1b8c80869cce8de414d44f5aaec41722795b","path":"knit_0.1.3_linux_arm64.tar.gz"},
|
|
19
|
+
{"sha256":"2cbc44bd20e22e185538c5a8bb8c83b6065969f542ce9463302f8e365bd857f9","path":"knit_0.1.3_windows_amd64.zip"}
|
|
20
|
+
]
|
|
21
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const { spawnSync } = require("node:child_process");
|
|
3
|
+
const path = require("node:path");
|
|
4
|
+
const fs = require("node:fs");
|
|
5
|
+
const { ensureInstalled, runtimeDirForPackage, daemonBinaryPath, packageRoot } = require("../lib/install");
|
|
6
|
+
|
|
7
|
+
function usage() {
|
|
8
|
+
process.stdout.write("Usage: knit <start|path|version> [args...]\n");
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function main() {
|
|
12
|
+
const command = process.argv[2] || "start";
|
|
13
|
+
if (command === "version") {
|
|
14
|
+
const pkg = JSON.parse(fs.readFileSync(path.join(packageRoot(), "package.json"), "utf8"));
|
|
15
|
+
process.stdout.write(String(pkg.version || "") + "\n");
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
if (command === "path") {
|
|
19
|
+
ensureInstalled();
|
|
20
|
+
process.stdout.write(daemonBinaryPath(runtimeDirForPackage()) + "\n");
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
if (command !== "start") {
|
|
24
|
+
usage();
|
|
25
|
+
process.exitCode = 1;
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
ensureInstalled();
|
|
29
|
+
const bin = daemonBinaryPath(runtimeDirForPackage());
|
|
30
|
+
const args = process.argv.slice(3);
|
|
31
|
+
const child = spawnSync(bin, args, { stdio: "inherit", env: process.env });
|
|
32
|
+
if (typeof child.status === "number") {
|
|
33
|
+
process.exitCode = child.status;
|
|
34
|
+
} else if (child.error) {
|
|
35
|
+
throw child.error;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
main();
|
package/lib/install.js
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
const fs = require("node:fs");
|
|
2
|
+
const path = require("node:path");
|
|
3
|
+
const crypto = require("node:crypto");
|
|
4
|
+
const { spawnSync } = require("node:child_process");
|
|
5
|
+
|
|
6
|
+
function packageRoot() {
|
|
7
|
+
return path.resolve(__dirname, "..");
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function runtimeDirForPackage() {
|
|
11
|
+
return path.join(packageRoot(), "artifacts", "runtime");
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function hostTarget() {
|
|
15
|
+
const platform = process.platform;
|
|
16
|
+
const archMap = { x64: "amd64", arm64: "arm64" };
|
|
17
|
+
const arch = archMap[process.arch];
|
|
18
|
+
if (!arch) {
|
|
19
|
+
throw new Error(`Unsupported architecture: ${process.arch}`);
|
|
20
|
+
}
|
|
21
|
+
if (!["darwin", "linux", "win32"].includes(platform)) {
|
|
22
|
+
throw new Error(`Unsupported platform: ${platform}`);
|
|
23
|
+
}
|
|
24
|
+
const os = platform === "win32" ? "windows" : platform;
|
|
25
|
+
return `${os}_${arch}`;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function packageManifest() {
|
|
29
|
+
const raw = fs.readFileSync(path.join(packageRoot(), "artifacts", "release-manifest.json"), "utf8");
|
|
30
|
+
return JSON.parse(raw);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function archivePathForTarget() {
|
|
34
|
+
const target = hostTarget();
|
|
35
|
+
const manifest = packageManifest();
|
|
36
|
+
const suffix = target.startsWith("windows_") ? ".zip" : ".tar.gz";
|
|
37
|
+
const archive = (manifest.artifacts || []).find((item) => String(item.path || "").includes(`_${target}${suffix}`));
|
|
38
|
+
if (!archive) {
|
|
39
|
+
throw new Error(`No packaged archive found for target ${target}`);
|
|
40
|
+
}
|
|
41
|
+
return {
|
|
42
|
+
target,
|
|
43
|
+
relPath: String(archive.path),
|
|
44
|
+
sha256: String(archive.sha256 || "")
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function verifyArchive(absPath, expectedSHA256) {
|
|
49
|
+
const actual = crypto.createHash("sha256").update(fs.readFileSync(absPath)).digest("hex");
|
|
50
|
+
if (actual !== expectedSHA256) {
|
|
51
|
+
throw new Error(`Archive checksum mismatch for ${path.basename(absPath)}`);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function extractArchive(absArchive, outDir) {
|
|
56
|
+
fs.rmSync(outDir, { recursive: true, force: true });
|
|
57
|
+
fs.mkdirSync(outDir, { recursive: true });
|
|
58
|
+
if (absArchive.endsWith(".zip")) {
|
|
59
|
+
const ps = spawnSync("powershell", [
|
|
60
|
+
"-NoProfile",
|
|
61
|
+
"-Command",
|
|
62
|
+
`Expand-Archive -Force -Path '${absArchive.replace(/'/g, "''")}' -DestinationPath '${outDir.replace(/'/g, "''")}'`
|
|
63
|
+
], { stdio: "pipe" });
|
|
64
|
+
if (ps.status !== 0) {
|
|
65
|
+
throw new Error(ps.stderr.toString() || "Expand-Archive failed");
|
|
66
|
+
}
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
const tar = spawnSync("tar", ["-xzf", absArchive, "-C", outDir], { stdio: "pipe" });
|
|
70
|
+
if (tar.status !== 0) {
|
|
71
|
+
throw new Error(tar.stderr.toString() || "tar extraction failed");
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function daemonBinaryPath(runtimeDir) {
|
|
76
|
+
return path.join(runtimeDir, process.platform === "win32" ? "daemon.exe" : "daemon");
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function ensureInstalled(force = false) {
|
|
80
|
+
const runtimeDir = runtimeDirForPackage();
|
|
81
|
+
const daemonPath = daemonBinaryPath(runtimeDir);
|
|
82
|
+
if (!force && fs.existsSync(daemonPath)) {
|
|
83
|
+
return runtimeDir;
|
|
84
|
+
}
|
|
85
|
+
const archive = archivePathForTarget();
|
|
86
|
+
const absArchive = path.join(packageRoot(), "artifacts", archive.relPath);
|
|
87
|
+
verifyArchive(absArchive, archive.sha256);
|
|
88
|
+
extractArchive(absArchive, runtimeDir);
|
|
89
|
+
if (!fs.existsSync(daemonPath)) {
|
|
90
|
+
throw new Error(`Daemon binary missing after extraction: ${daemonPath}`);
|
|
91
|
+
}
|
|
92
|
+
return runtimeDir;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if (require.main === module) {
|
|
96
|
+
ensureInstalled();
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
module.exports = {
|
|
100
|
+
ensureInstalled,
|
|
101
|
+
runtimeDirForPackage,
|
|
102
|
+
daemonBinaryPath,
|
|
103
|
+
hostTarget,
|
|
104
|
+
packageRoot
|
|
105
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@chadsly/knit",
|
|
3
|
+
"version": "0.1.3",
|
|
4
|
+
"description": "Install and run the local Knit daemon from bundled release artifacts.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"private": false,
|
|
7
|
+
"homepage": "https://github.com/chadsly/knit#readme",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/chadsly/knit.git"
|
|
11
|
+
},
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/chadsly/knit/issues"
|
|
14
|
+
},
|
|
15
|
+
"keywords": [
|
|
16
|
+
"knit",
|
|
17
|
+
"daemon",
|
|
18
|
+
"desktop",
|
|
19
|
+
"agent",
|
|
20
|
+
"feedback",
|
|
21
|
+
"review"
|
|
22
|
+
],
|
|
23
|
+
"engines": {
|
|
24
|
+
"node": ">=18"
|
|
25
|
+
},
|
|
26
|
+
"os": [
|
|
27
|
+
"darwin",
|
|
28
|
+
"linux",
|
|
29
|
+
"win32"
|
|
30
|
+
],
|
|
31
|
+
"cpu": [
|
|
32
|
+
"x64",
|
|
33
|
+
"arm64"
|
|
34
|
+
],
|
|
35
|
+
"bin": {
|
|
36
|
+
"knit": "bin/knit-daemon.js"
|
|
37
|
+
},
|
|
38
|
+
"scripts": {
|
|
39
|
+
"postinstall": "node ./lib/install.js"
|
|
40
|
+
},
|
|
41
|
+
"files": [
|
|
42
|
+
"bin/",
|
|
43
|
+
"lib/",
|
|
44
|
+
"artifacts/",
|
|
45
|
+
"README.md"
|
|
46
|
+
]
|
|
47
|
+
}
|