@getclue/cli 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.
Files changed (2) hide show
  1. package/bin/clue +58 -0
  2. package/package.json +16 -0
package/bin/clue ADDED
@@ -0,0 +1,58 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { spawnSync } = require("child_process");
4
+ const os = require("os");
5
+ const path = require("path");
6
+
7
+ function getBinaryPath() {
8
+ // Allow override for development
9
+ if (process.env.CLUE_BINARY) {
10
+ return process.env.CLUE_BINARY;
11
+ }
12
+
13
+ const platform = process.platform;
14
+ const arch = os.arch();
15
+
16
+ const PLATFORMS = {
17
+ "darwin-arm64": "@clue/cli-darwin-arm64",
18
+ "darwin-x64": "@clue/cli-darwin-x64",
19
+ "linux-x64": "@clue/cli-linux-x64",
20
+ "linux-arm64": "@clue/cli-linux-arm64",
21
+ "win32-x64": "@clue/cli-win32-x64",
22
+ };
23
+
24
+ const key = `${platform}-${arch}`;
25
+ const pkg = PLATFORMS[key];
26
+
27
+ if (!pkg) {
28
+ console.error(
29
+ `Unsupported platform: ${platform}-${arch}. ` +
30
+ `Supported: ${Object.keys(PLATFORMS).join(", ")}`
31
+ );
32
+ process.exit(1);
33
+ }
34
+
35
+ const binaryName = platform === "win32" ? "clue.exe" : "clue";
36
+
37
+ try {
38
+ const pkgDir = path.dirname(require.resolve(`${pkg}/package.json`));
39
+ return path.join(pkgDir, binaryName);
40
+ } catch {
41
+ console.error(
42
+ `Could not find the clue binary for ${platform}-${arch}.\n` +
43
+ `The package ${pkg} does not appear to be installed.\n` +
44
+ `Try reinstalling: npm i -g clue`
45
+ );
46
+ process.exit(1);
47
+ }
48
+ }
49
+
50
+ const binary = getBinaryPath();
51
+ const result = spawnSync(binary, process.argv.slice(2), { stdio: "inherit" });
52
+
53
+ if (result.error) {
54
+ console.error(`Failed to execute clue: ${result.error.message}`);
55
+ process.exit(1);
56
+ }
57
+
58
+ process.exit(result.status ?? 1);
package/package.json ADDED
@@ -0,0 +1,16 @@
1
+ {
2
+ "name": "@getclue/cli",
3
+ "version": "0.1.0",
4
+ "description": "Capture and explore the reasoning behind AI-assisted code changes",
5
+ "license": "MIT",
6
+ "bin": {
7
+ "clue": "bin/clue"
8
+ },
9
+ "optionalDependencies": {
10
+ "@getclue/cli-darwin-arm64": "0.1.0",
11
+ "@getclue/cli-darwin-x64": "0.1.0",
12
+ "@getclue/cli-linux-x64": "0.1.0",
13
+ "@getclue/cli-linux-arm64": "0.1.0",
14
+ "@getclue/cli-win32-x64": "0.1.0"
15
+ }
16
+ }