agentusage 0.1.0
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/bin/au.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
const { spawnSync } = require("child_process");
|
|
5
|
+
const path = require("path");
|
|
6
|
+
const os = require("os");
|
|
7
|
+
|
|
8
|
+
const PLATFORM_PACKAGES = {
|
|
9
|
+
"darwin-arm64": "@agentusage/cli-darwin-arm64",
|
|
10
|
+
"darwin-x64": "@agentusage/cli-darwin-x64",
|
|
11
|
+
"linux-x64": "@agentusage/cli-linux-x64",
|
|
12
|
+
"win32-x64": "@agentusage/cli-win32-x64",
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const platformKey = `${os.platform()}-${os.arch()}`;
|
|
16
|
+
const pkg = PLATFORM_PACKAGES[platformKey];
|
|
17
|
+
|
|
18
|
+
if (!pkg) {
|
|
19
|
+
process.stderr.write(
|
|
20
|
+
`agentusage: unsupported platform '${platformKey}'\n` +
|
|
21
|
+
`Supported platforms: ${Object.keys(PLATFORM_PACKAGES).join(", ")}\n` +
|
|
22
|
+
`You can also install from source: https://github.com/agentusage-team/agentusage-cli\n`
|
|
23
|
+
);
|
|
24
|
+
process.exit(1);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
let pkgDir;
|
|
28
|
+
try {
|
|
29
|
+
pkgDir = path.dirname(require.resolve(`${pkg}/package.json`));
|
|
30
|
+
} catch {
|
|
31
|
+
process.stderr.write(
|
|
32
|
+
`agentusage: platform package '${pkg}' is not installed.\n` +
|
|
33
|
+
`This is unexpected — please file a bug at https://github.com/agentusage-team/agentusage-cli/issues\n`
|
|
34
|
+
);
|
|
35
|
+
process.exit(1);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const ext = os.platform() === "win32" ? ".exe" : "";
|
|
39
|
+
const binary = path.join(pkgDir, "bin", `au${ext}`);
|
|
40
|
+
|
|
41
|
+
const result = spawnSync(binary, process.argv.slice(2), { stdio: "inherit" });
|
|
42
|
+
|
|
43
|
+
if (result.error) {
|
|
44
|
+
process.stderr.write(`agentusage: failed to run binary: ${result.error.message}\n`);
|
|
45
|
+
process.exit(1);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
process.exit(result.status ?? 1);
|
package/package.json
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "agentusage",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "AI provider usage monitor — agent skill for model selection",
|
|
5
|
+
"homepage": "https://agentusage.dev",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/agentusage-team/agentusage-cli"
|
|
9
|
+
},
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"bin": {
|
|
12
|
+
"au": "bin/au.js"
|
|
13
|
+
},
|
|
14
|
+
"optionalDependencies": {
|
|
15
|
+
"@agentusage/cli-darwin-arm64": "0.1.0",
|
|
16
|
+
"@agentusage/cli-darwin-x64": "0.1.0",
|
|
17
|
+
"@agentusage/cli-linux-x64": "0.1.0",
|
|
18
|
+
"@agentusage/cli-win32-x64": "0.1.0"
|
|
19
|
+
},
|
|
20
|
+
"engines": {
|
|
21
|
+
"node": ">=16"
|
|
22
|
+
}
|
|
23
|
+
}
|