codeint 0.0.0-stage → 0.2.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/bin/codeint.js ADDED
@@ -0,0 +1,61 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+
4
+ const { spawnSync } = require("node:child_process");
5
+ const fs = require("node:fs");
6
+ const path = require("node:path");
7
+
8
+ const PLATFORMS = {
9
+ "darwin-arm64": { pkg: "@avidian/codeint-darwin-arm64", bin: "bin/codeint" },
10
+ "darwin-x64": { pkg: "@avidian/codeint-darwin-x64", bin: "bin/codeint" },
11
+ "linux-arm64": { pkg: "@avidian/codeint-linux-arm64", bin: "bin/codeint" },
12
+ "linux-x64": { pkg: "@avidian/codeint-linux-x64", bin: "bin/codeint" },
13
+ "win32-arm64": { pkg: "@avidian/codeint-win32-arm64", bin: "bin/codeint.exe" },
14
+ "win32-x64": { pkg: "@avidian/codeint-win32-x64", bin: "bin/codeint.exe" },
15
+ };
16
+
17
+ const platformKey = `${process.platform}-${process.arch}`;
18
+ const target = PLATFORMS[platformKey];
19
+
20
+ if (!target) {
21
+ const supported = Object.keys(PLATFORMS).join(", ");
22
+ process.stderr.write(
23
+ `codeint: unsupported platform "${platformKey}". Supported platforms: ${supported}.\n`
24
+ );
25
+ process.exit(2);
26
+ }
27
+
28
+ let packageJsonPath;
29
+ try {
30
+ packageJsonPath = require.resolve(`${target.pkg}/package.json`);
31
+ } catch (error) {
32
+ process.stderr.write(
33
+ `codeint: missing platform package "${target.pkg}" for ${platformKey} (${error.message}). Reinstall codeint with optional dependencies enabled.\n`
34
+ );
35
+ process.exit(2);
36
+ }
37
+
38
+ const binaryPath = path.join(path.dirname(packageJsonPath), target.bin);
39
+ if (!fs.existsSync(binaryPath)) {
40
+ process.stderr.write(
41
+ `codeint: native binary not found at ${binaryPath} (package "${target.pkg}").\n`
42
+ );
43
+ process.exit(2);
44
+ }
45
+
46
+ const result = spawnSync(binaryPath, process.argv.slice(2), {
47
+ stdio: "inherit",
48
+ });
49
+
50
+ if (result.error) {
51
+ process.stderr.write(
52
+ `codeint: failed to execute ${binaryPath}: ${result.error.message}\n`
53
+ );
54
+ process.exit(2);
55
+ }
56
+
57
+ if (result.signal) {
58
+ process.kill(process.pid, result.signal);
59
+ }
60
+
61
+ process.exit(result.status ?? 2);
package/package.json CHANGED
@@ -1,6 +1,32 @@
1
1
  {
2
2
  "name": "codeint",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.2.1",
4
+ "description": "Measures the Software entropy of a codebase",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/avidianity/codeint.git",
9
+ "directory": "npm/codeint"
10
+ },
11
+ "bin": {
12
+ "codeint": "bin/codeint.js"
13
+ },
14
+ "files": [
15
+ "bin/codeint.js"
16
+ ],
17
+ "engines": {
18
+ "node": ">=18"
19
+ },
20
+ "optionalDependencies": {
21
+ "@avidian/codeint-darwin-arm64": "0.2.1",
22
+ "@avidian/codeint-darwin-x64": "0.2.1",
23
+ "@avidian/codeint-linux-arm64": "0.2.1",
24
+ "@avidian/codeint-linux-x64": "0.2.1",
25
+ "@avidian/codeint-win32-arm64": "0.2.1",
26
+ "@avidian/codeint-win32-x64": "0.2.1"
27
+ },
28
+ "publishConfig": {
29
+ "access": "public",
30
+ "provenance": true
31
+ }
32
+ }
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.