duhem 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 (3) hide show
  1. package/README.md +37 -0
  2. package/bin.js +78 -0
  3. package/package.json +39 -0
package/README.md ADDED
@@ -0,0 +1,37 @@
1
+ # duhem
2
+
3
+ The command-line interface for [Duhem](https://github.com/onsager-ai/duhem) —
4
+ a holistic verification platform for AI-delivered software.
5
+
6
+ ## Install
7
+
8
+ ```bash
9
+ npm install -g duhem
10
+ # or run without installing
11
+ npx duhem --help
12
+ ```
13
+
14
+ This package is a thin launcher. The real binary ships per-platform via an
15
+ optional dependency (`@duhem/cli-<os>-<arch>`); npm installs only the one
16
+ matching your machine. Prebuilt targets: linux-x64, linux-arm64, darwin-x64,
17
+ darwin-arm64, windows-x64.
18
+
19
+ Prebuilt binaries are also attached to each
20
+ [GitHub Release](https://github.com/onsager-ai/duhem/releases).
21
+
22
+ ## Usage
23
+
24
+ ```bash
25
+ duhem init # scaffold a Verification Definition
26
+ duhem validate # validate VDs / manifest against the schema
27
+ duhem run # run a verification and emit a verdict
28
+ duhem dashboard # serve / export the run dashboard
29
+ duhem --version
30
+ ```
31
+
32
+ See the [project README](https://github.com/onsager-ai/duhem#readme) for the
33
+ full documentation.
34
+
35
+ ## License
36
+
37
+ Apache-2.0
package/bin.js ADDED
@@ -0,0 +1,78 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * bin.js — entry point for the `duhem` CLI installed from npm.
5
+ *
6
+ * The npm `duhem` package is a thin JS launcher. The actual Rust binary
7
+ * ships in a per-platform optional dependency (`@duhem/cli-<os>-<arch>`);
8
+ * npm installs only the one matching the host at install time. This
9
+ * launcher resolves that package, locates the binary inside it, and execs
10
+ * it with all CLI arguments forwarded and the exit code preserved.
11
+ *
12
+ * Architecture: rust-npm-publish skill (optionalDependencies platform
13
+ * packages, same pattern as esbuild / swc / turbo).
14
+ */
15
+
16
+ const { execFileSync } = require('node:child_process');
17
+ const { join } = require('node:path');
18
+
19
+ // Map Node's `${process.platform}-${process.arch}` to the platform package.
20
+ // NOTE: `process.platform` is `win32` (not `windows`); the package name uses
21
+ // `windows`. Keep this table in sync with npm/platforms/* and the
22
+ // optionalDependencies in npm/duhem/package.json.
23
+ const PLATFORM_PACKAGES = {
24
+ 'linux-x64': '@duhem/cli-linux-x64',
25
+ 'linux-arm64': '@duhem/cli-linux-arm64',
26
+ 'darwin-x64': '@duhem/cli-darwin-x64',
27
+ 'darwin-arm64': '@duhem/cli-darwin-arm64',
28
+ 'win32-x64': '@duhem/cli-windows-x64',
29
+ };
30
+
31
+ function resolveBinary() {
32
+ const key = `${process.platform}-${process.arch}`;
33
+ const pkg = PLATFORM_PACKAGES[key];
34
+
35
+ if (!pkg) {
36
+ const supported = Object.keys(PLATFORM_PACKAGES)
37
+ .map((k) => ` - ${k}`)
38
+ .join('\n');
39
+ console.error(
40
+ `duhem: unsupported platform "${key}".\n\n` +
41
+ `Prebuilt binaries are published for:\n${supported}\n\n` +
42
+ 'Build from source instead: https://github.com/onsager-ai/duhem',
43
+ );
44
+ process.exit(1);
45
+ }
46
+
47
+ try {
48
+ // require.resolve the platform package's manifest, then read `main`
49
+ // to find the binary file shipped alongside it.
50
+ const manifestPath = require.resolve(`${pkg}/package.json`);
51
+ const manifest = require(`${pkg}/package.json`);
52
+ return join(manifestPath, '..', manifest.main);
53
+ } catch {
54
+ console.error(
55
+ `duhem: the platform package "${pkg}" for ${key} is not installed.\n\n` +
56
+ 'This usually means the optional dependency was skipped at install\n' +
57
+ 'time (e.g. --no-optional, --omit=optional, or an offline mirror).\n\n' +
58
+ 'Try reinstalling:\n npm install -g duhem\n\n' +
59
+ 'or install the platform package directly:\n' +
60
+ ` npm install ${pkg}`,
61
+ );
62
+ process.exit(1);
63
+ }
64
+ }
65
+
66
+ const binary = resolveBinary();
67
+
68
+ try {
69
+ execFileSync(binary, process.argv.slice(2), { stdio: 'inherit' });
70
+ } catch (error) {
71
+ // execFileSync throws on a non-zero exit — forward the child's exit code.
72
+ if (error && typeof error.status === 'number') {
73
+ process.exit(error.status);
74
+ }
75
+ // No status (e.g. binary missing exec bit, ENOENT) — surface and fail.
76
+ console.error(`duhem: failed to execute ${binary}: ${error && error.message}`);
77
+ process.exit(1);
78
+ }
package/package.json ADDED
@@ -0,0 +1,39 @@
1
+ {
2
+ "name": "duhem",
3
+ "version": "0.1.0",
4
+ "description": "Holistic verification platform for AI-delivered software — the `duhem` CLI.",
5
+ "license": "Apache-2.0",
6
+ "bin": {
7
+ "duhem": "bin.js"
8
+ },
9
+ "files": [
10
+ "bin.js",
11
+ "README.md"
12
+ ],
13
+ "engines": {
14
+ "node": ">=18"
15
+ },
16
+ "keywords": [
17
+ "duhem",
18
+ "verification",
19
+ "acceptance-criteria",
20
+ "ai",
21
+ "testing",
22
+ "cli"
23
+ ],
24
+ "homepage": "https://github.com/onsager-ai/duhem#readme",
25
+ "bugs": {
26
+ "url": "https://github.com/onsager-ai/duhem/issues"
27
+ },
28
+ "repository": {
29
+ "type": "git",
30
+ "url": "git+https://github.com/onsager-ai/duhem.git"
31
+ },
32
+ "optionalDependencies": {
33
+ "@duhem/cli-linux-x64": "0.1.0",
34
+ "@duhem/cli-linux-arm64": "0.1.0",
35
+ "@duhem/cli-darwin-x64": "0.1.0",
36
+ "@duhem/cli-darwin-arm64": "0.1.0",
37
+ "@duhem/cli-windows-x64": "0.1.0"
38
+ }
39
+ }