@agence-debord/codefidence 0.3.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.
Files changed (2) hide show
  1. package/bin/codefidence +78 -0
  2. package/package.json +23 -0
@@ -0,0 +1,78 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { execFileSync } = require("child_process");
4
+ const path = require("path");
5
+ const fs = require("fs");
6
+
7
+ const PLATFORMS = {
8
+ "darwin-arm64": "@agence-debord/codefidence-darwin-arm64",
9
+ "darwin-x64": "@agence-debord/codefidence-darwin-x64",
10
+ "linux-x64": "@agence-debord/codefidence-linux-x64",
11
+ "linux-arm64": "@agence-debord/codefidence-linux-arm64",
12
+ "win32-x64": "@agence-debord/codefidence-win32-x64",
13
+ };
14
+
15
+ function getBinaryPath() {
16
+ const platform = process.platform;
17
+ const arch = process.arch;
18
+
19
+ // Normalize arch names
20
+ let normalizedArch;
21
+ switch (arch) {
22
+ case "arm64":
23
+ normalizedArch = "arm64";
24
+ break;
25
+ case "x64":
26
+ normalizedArch = "x64";
27
+ break;
28
+ default:
29
+ throw new Error(`Unsupported architecture: ${arch}`);
30
+ }
31
+
32
+ const key = `${platform}-${normalizedArch}`;
33
+ const pkg = PLATFORMS[key];
34
+
35
+ if (!pkg) {
36
+ throw new Error(
37
+ `Unsupported platform: ${platform}-${normalizedArch}. ` +
38
+ `Supported platforms: ${Object.keys(PLATFORMS).join(", ")}`
39
+ );
40
+ }
41
+
42
+ const binaryName =
43
+ platform === "win32" ? "codefidence.exe" : "codefidence";
44
+
45
+ try {
46
+ const pkgPath = require.resolve(`${pkg}/package.json`);
47
+ const binPath = path.join(path.dirname(pkgPath), binaryName);
48
+
49
+ if (!fs.existsSync(binPath)) {
50
+ throw new Error(`Binary not found at ${binPath}`);
51
+ }
52
+
53
+ return binPath;
54
+ } catch (e) {
55
+ throw new Error(
56
+ `Could not find the codefidence binary for ${platform}-${normalizedArch}. ` +
57
+ `Make sure ${pkg} is installed.\n\n` +
58
+ `If you're using npm, try reinstalling with:\n` +
59
+ ` npm install @agence-debord/codefidence-cli\n\n` +
60
+ `Original error: ${e.message}`
61
+ );
62
+ }
63
+ }
64
+
65
+ try {
66
+ const binPath = getBinaryPath();
67
+ const result = execFileSync(binPath, process.argv.slice(2), {
68
+ stdio: "inherit",
69
+ env: process.env,
70
+ });
71
+ } catch (e) {
72
+ if (e.status !== undefined) {
73
+ // execFileSync throws with status when the child process exits non-zero
74
+ process.exit(e.status);
75
+ }
76
+ console.error(e.message);
77
+ process.exit(1);
78
+ }
package/package.json ADDED
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "@agence-debord/codefidence",
3
+ "version": "0.3.3",
4
+ "description": "Auto-managed project knowledge wiki for AI-assisted development",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/agencedebord/codefidence"
9
+ },
10
+ "bin": {
11
+ "codefidence": "bin/codefidence"
12
+ },
13
+ "files": [
14
+ "bin"
15
+ ],
16
+ "optionalDependencies": {
17
+ "@agence-debord/codefidence-darwin-arm64": "0.3.3",
18
+ "@agence-debord/codefidence-darwin-x64": "0.3.3",
19
+ "@agence-debord/codefidence-linux-x64": "0.3.3",
20
+ "@agence-debord/codefidence-linux-arm64": "0.3.3",
21
+ "@agence-debord/codefidence-win32-x64": "0.3.3"
22
+ }
23
+ }