tachograph 0.1.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/README.md +24 -0
- package/asset.js +32 -0
- package/bin/tacho.js +26 -0
- package/install.js +54 -0
- package/package.json +36 -0
package/README.md
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# tachograph
|
|
2
|
+
|
|
3
|
+
A compact instrument cluster for your coding agents (**Claude Code** / **Codex**) —
|
|
4
|
+
model, rate-limit usage (5-hour / weekly), and context window, at a glance.
|
|
5
|
+
|
|
6
|
+
```sh
|
|
7
|
+
npm install -g tachograph
|
|
8
|
+
tacho # one-shot compact status
|
|
9
|
+
tacho setup claude # wire up the Claude Code statusLine
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
`npm install` downloads the prebuilt `tacho` binary for your platform from the
|
|
13
|
+
matching [GitHub release](https://github.com/kosako/tachograph/releases). If no
|
|
14
|
+
prebuilt binary fits your platform, install from source instead:
|
|
15
|
+
|
|
16
|
+
```sh
|
|
17
|
+
go install github.com/kosako/tachograph/cmd/tacho@latest
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Full documentation: <https://github.com/kosako/tachograph>.
|
|
21
|
+
|
|
22
|
+
## License
|
|
23
|
+
|
|
24
|
+
[MIT](https://github.com/kosako/tachograph/blob/main/LICENSE)
|
package/asset.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// Maps the running platform to the GoReleaser release asset that carries the
|
|
2
|
+
// matching `tacho` binary. Kept pure and dependency-free so it can be unit
|
|
3
|
+
// tested without touching the network or filesystem.
|
|
4
|
+
|
|
5
|
+
const PLATFORMS = { darwin: "darwin", linux: "linux", win32: "windows" };
|
|
6
|
+
const ARCHES = { x64: "amd64", arm64: "arm64" };
|
|
7
|
+
|
|
8
|
+
// assetFor returns { asset, binary } for the given Node platform/arch, or
|
|
9
|
+
// throws with a clear message when the combination has no published build.
|
|
10
|
+
function assetFor(platform, arch) {
|
|
11
|
+
const os = PLATFORMS[platform];
|
|
12
|
+
const goarch = ARCHES[arch];
|
|
13
|
+
if (!os || !goarch) {
|
|
14
|
+
throw new Error(
|
|
15
|
+
`tachograph: no prebuilt binary for ${platform}/${arch}. ` +
|
|
16
|
+
`Install from source instead: go install github.com/kosako/tachograph/cmd/tacho@latest`,
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
const ext = os === "windows" ? "zip" : "tar.gz";
|
|
20
|
+
return {
|
|
21
|
+
asset: `tachograph_${os}_${goarch}.${ext}`,
|
|
22
|
+
binary: os === "windows" ? "tacho.exe" : "tacho",
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// downloadURL builds the GitHub release download URL for a version + asset.
|
|
27
|
+
function downloadURL(version, asset) {
|
|
28
|
+
const tag = version.startsWith("v") ? version : `v${version}`;
|
|
29
|
+
return `https://github.com/kosako/tachograph/releases/download/${tag}/${asset}`;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
module.exports = { assetFor, downloadURL, PLATFORMS, ARCHES };
|
package/bin/tacho.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Launcher: exec the platform binary that postinstall placed next to this file,
|
|
3
|
+
// forwarding args, stdio, and exit code.
|
|
4
|
+
|
|
5
|
+
const path = require("path");
|
|
6
|
+
const fs = require("fs");
|
|
7
|
+
const { spawnSync } = require("child_process");
|
|
8
|
+
|
|
9
|
+
const binary = process.platform === "win32" ? "tacho.exe" : "tacho";
|
|
10
|
+
const binPath = path.join(__dirname, binary);
|
|
11
|
+
|
|
12
|
+
if (!fs.existsSync(binPath)) {
|
|
13
|
+
console.error(
|
|
14
|
+
"tachograph: binary not found — the postinstall download may have failed.\n" +
|
|
15
|
+
"Reinstall (npm i -g tachograph), or install from source:\n" +
|
|
16
|
+
" go install github.com/kosako/tachograph/cmd/tacho@latest",
|
|
17
|
+
);
|
|
18
|
+
process.exit(1);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const res = spawnSync(binPath, process.argv.slice(2), { stdio: "inherit" });
|
|
22
|
+
if (res.error) {
|
|
23
|
+
console.error(`tachograph: ${res.error.message}`);
|
|
24
|
+
process.exit(1);
|
|
25
|
+
}
|
|
26
|
+
process.exit(res.status === null ? 1 : res.status);
|
package/install.js
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// postinstall: download the tacho binary matching this platform from the
|
|
2
|
+
// GitHub release for this package's version, and extract it into bin/.
|
|
3
|
+
//
|
|
4
|
+
// Archives are produced by GoReleaser (tar.gz everywhere except Windows zip).
|
|
5
|
+
// We extract via the system `tar`, which is bsdtar on macOS/Windows (handles
|
|
6
|
+
// both formats) and GNU tar on Linux (handles our tar.gz). This keeps the
|
|
7
|
+
// package dependency-free.
|
|
8
|
+
|
|
9
|
+
const fs = require("fs");
|
|
10
|
+
const os = require("os");
|
|
11
|
+
const path = require("path");
|
|
12
|
+
const { execFileSync } = require("child_process");
|
|
13
|
+
const { assetFor, downloadURL } = require("./asset");
|
|
14
|
+
|
|
15
|
+
const { version } = require("./package.json");
|
|
16
|
+
const binDir = path.join(__dirname, "bin");
|
|
17
|
+
|
|
18
|
+
async function main() {
|
|
19
|
+
const { asset, binary } = assetFor(process.platform, process.arch);
|
|
20
|
+
const url = downloadURL(version, asset);
|
|
21
|
+
|
|
22
|
+
const res = await fetch(url, { redirect: "follow" });
|
|
23
|
+
if (!res.ok) {
|
|
24
|
+
throw new Error(`download failed: ${res.status} ${res.statusText} for ${url}`);
|
|
25
|
+
}
|
|
26
|
+
const buf = Buffer.from(await res.arrayBuffer());
|
|
27
|
+
|
|
28
|
+
const tmp = fs.mkdtempSync(path.join(os.tmpdir(), "tacho-"));
|
|
29
|
+
const archive = path.join(tmp, asset);
|
|
30
|
+
fs.writeFileSync(archive, buf);
|
|
31
|
+
|
|
32
|
+
fs.mkdirSync(binDir, { recursive: true });
|
|
33
|
+
// bsdtar/GNU tar both extract by extension; -C lands the binary in bin/.
|
|
34
|
+
execFileSync("tar", ["-xf", archive, "-C", binDir], { stdio: "inherit" });
|
|
35
|
+
fs.rmSync(tmp, { recursive: true, force: true });
|
|
36
|
+
|
|
37
|
+
const binPath = path.join(binDir, binary);
|
|
38
|
+
if (!fs.existsSync(binPath)) {
|
|
39
|
+
throw new Error(`extracted archive but ${binary} not found in ${binDir}`);
|
|
40
|
+
}
|
|
41
|
+
if (process.platform !== "win32") {
|
|
42
|
+
fs.chmodSync(binPath, 0o755);
|
|
43
|
+
}
|
|
44
|
+
console.log(`tachograph: installed ${binary} ${version}`);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
main().catch((err) => {
|
|
48
|
+
console.error(`\n${err.message}\n`);
|
|
49
|
+
console.error(
|
|
50
|
+
"You can install from source instead:\n" +
|
|
51
|
+
" go install github.com/kosako/tachograph/cmd/tacho@latest\n",
|
|
52
|
+
);
|
|
53
|
+
process.exit(1);
|
|
54
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "tachograph",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "A compact instrument cluster for your coding agents (Claude Code / Codex). Shows model, rate-limit usage, and context at a glance.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"claude-code",
|
|
7
|
+
"codex",
|
|
8
|
+
"statusline",
|
|
9
|
+
"rate-limit",
|
|
10
|
+
"cli"
|
|
11
|
+
],
|
|
12
|
+
"homepage": "https://github.com/kosako/tachograph#readme",
|
|
13
|
+
"bugs": "https://github.com/kosako/tachograph/issues",
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "git+https://github.com/kosako/tachograph.git",
|
|
17
|
+
"directory": "npm"
|
|
18
|
+
},
|
|
19
|
+
"license": "MIT",
|
|
20
|
+
"author": "kosako",
|
|
21
|
+
"bin": {
|
|
22
|
+
"tacho": "bin/tacho.js"
|
|
23
|
+
},
|
|
24
|
+
"files": [
|
|
25
|
+
"bin/tacho.js",
|
|
26
|
+
"install.js",
|
|
27
|
+
"asset.js"
|
|
28
|
+
],
|
|
29
|
+
"scripts": {
|
|
30
|
+
"postinstall": "node install.js",
|
|
31
|
+
"test": "node test.js"
|
|
32
|
+
},
|
|
33
|
+
"engines": {
|
|
34
|
+
"node": ">=18"
|
|
35
|
+
}
|
|
36
|
+
}
|