do-harness 0.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 do-harness contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,42 @@
1
+ # do-harness (npm wrapper)
2
+
3
+ Zero-install launcher for the [do-harness](../../README.md) CLI:
4
+
5
+ ```sh
6
+ npx do-harness init
7
+ npx do-harness verify --set verification --format json --strict
8
+ npx do-harness status --set verification
9
+ ```
10
+
11
+ The wrapper contains no verification policy. It resolves the prebuilt binary
12
+ for the current platform from a platform package installed through
13
+ `optionalDependencies` and execs it with inherited stdio.
14
+
15
+ Supported platforms: Linux x64/arm64 (static musl), macOS x64/arm64. Other
16
+ platforms install from source or download a release; Linux/macOS can use the
17
+ shell installer:
18
+
19
+ ```sh
20
+ curl -fsSL https://raw.githubusercontent.com/d-o-hub/do-harness/main/scripts/install.sh | sh
21
+ ```
22
+
23
+ **Windows x64 is not available through npm.** The `do-harness-win32-x64`
24
+ platform package is rejected by the npm registry's name screening (HTTP 403,
25
+ "Package name triggered spam detection"), so the meta package's pinned
26
+ `optionalDependency` cannot resolve and `npx do-harness` has no Windows binary
27
+ to run. The Windows binary ships as a GitHub release zip instead — see the
28
+ Windows section of [docs/adoption.md](../../docs/adoption.md).
29
+
30
+ Note that `npm install do-harness` **succeeds** on Windows anyway: an absent
31
+ optional dependency is not an install error. The failure appears at run time,
32
+ where the shim exits 1 and points at the release zip rather than suggesting
33
+ `--include=optional`, which cannot help.
34
+
35
+ ## Notes
36
+
37
+ - `npx do-harness ...` runs commands without adding anything to `PATH`.
38
+ - For git hooks, point `DO_HARNESS_BIN` at the installed wrapper
39
+ (`node_modules/.bin/do-harness`) or install the CLI onto `PATH` with the
40
+ shell installer; managed hooks resolve `$DO_HARNESS_BIN` first.
41
+ - Versions are pinned: the meta package depends on exact platform package
42
+ versions, and every publish is generated from a tagged release.
@@ -0,0 +1,79 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+
4
+ // Thin launcher: resolve the prebuilt platform package installed through
5
+ // optionalDependencies and exec the real binary with inherited stdio.
6
+ // The model never sees this file; `npx do-harness ...` is the entrypoint.
7
+
8
+ const { spawnSync } = require("node:child_process");
9
+ const fs = require("node:fs");
10
+ const path = require("node:path");
11
+
12
+ const { UNAVAILABLE_PACKAGES, binaryName, platformPackage } = require("../lib/platform.js");
13
+
14
+ // Test seam: lets the wrapper tests assert the guidance for a platform other
15
+ // than the host (e.g. the unavailable Windows package, checked on Linux CI).
16
+ // Ignored in normal use.
17
+ const pkg =
18
+ process.env.DO_HARNESS_TEST_PLATFORM_PACKAGE ??
19
+ platformPackage(process.platform, process.arch);
20
+ if (!pkg) {
21
+ console.error(
22
+ `do-harness: no prebuilt binary for ${process.platform}/${process.arch}.`,
23
+ );
24
+ console.error(
25
+ "Install on a supported platform, build from source, or download a release:",
26
+ );
27
+ console.error(" https://github.com/d-o-hub/do-harness/releases");
28
+ process.exit(1);
29
+ }
30
+
31
+ let binary;
32
+ try {
33
+ const packageJson = require.resolve(`${pkg}/package.json`);
34
+ binary = path.join(
35
+ path.dirname(packageJson),
36
+ "bin",
37
+ binaryName(process.platform),
38
+ );
39
+ } catch {
40
+ if (UNAVAILABLE_PACKAGES.has(pkg)) {
41
+ // Distinct from "optional dependencies disabled": npm installed cleanly
42
+ // because the pinned package is not on the registry at all, so
43
+ // --include=optional cannot help. Point at the channel that does work.
44
+ console.error(
45
+ `do-harness: no npm package is published for ${process.platform}/${process.arch} yet (${pkg} is unavailable).`,
46
+ );
47
+ console.error(
48
+ "Install the prebuilt binary from the GitHub release instead (see the",
49
+ );
50
+ console.error(
51
+ "Windows section of docs/adoption.md), or build from source with",
52
+ );
53
+ console.error("`cargo install do-harness`.");
54
+ process.exit(1);
55
+ }
56
+ console.error(
57
+ `do-harness: platform package ${pkg} is not installed (optional dependencies may be disabled).`,
58
+ );
59
+ console.error(`Try: npm install --include=optional do-harness`);
60
+ process.exit(1);
61
+ }
62
+
63
+ // npm may normalize archive modes; make sure the binary is executable.
64
+ try {
65
+ fs.accessSync(binary, fs.constants.X_OK);
66
+ } catch {
67
+ try {
68
+ fs.chmodSync(binary, 0o755);
69
+ } catch {
70
+ // The spawn below reports the real error if this fails.
71
+ }
72
+ }
73
+
74
+ const result = spawnSync(binary, process.argv.slice(2), { stdio: "inherit" });
75
+ if (result.error) {
76
+ console.error(`do-harness: failed to run ${binary}: ${result.error.message}`);
77
+ process.exit(1);
78
+ }
79
+ process.exit(result.status === null ? 1 : result.status);
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+
3
+ // Maps the running Node platform/arch to the prebuilt platform package.
4
+
5
+ const PLATFORM_PACKAGES = Object.freeze({
6
+ "linux-x64": "do-harness-linux-x64",
7
+ "linux-arm64": "do-harness-linux-arm64",
8
+ "darwin-x64": "do-harness-darwin-x64",
9
+ "darwin-arm64": "do-harness-darwin-arm64",
10
+ "win32-x64": "do-harness-win32-x64",
11
+ });
12
+
13
+ /**
14
+ * Returns the platform package for `platform`/`arch`, or null when the
15
+ * platform has no prebuilt binary.
16
+ */
17
+ function platformPackage(platform, arch) {
18
+ return PLATFORM_PACKAGES[`${platform}-${arch}`] ?? null;
19
+ }
20
+
21
+ /**
22
+ * Platform packages mapped above that are NOT published on npm.
23
+ *
24
+ * `do-harness-win32-x64` is blocked by npm's registry name screening
25
+ * (HTTP 403 "Package name triggered spam detection") and the meta package's
26
+ * pinned `optionalDependencies` therefore cannot resolve on Windows. The
27
+ * Windows binary ships as a GitHub release zip instead. npm installs the meta
28
+ * package successfully regardless (an absent optional dependency is not an
29
+ * install error), so the shim must recognise this case and point at the
30
+ * channel that works rather than suggesting `--include=optional`, which
31
+ * cannot help.
32
+ *
33
+ * Keep this in sync with docs/adoption.md's Windows section; removing an
34
+ * entry requires the corresponding package to be live on npm.
35
+ */
36
+ const UNAVAILABLE_PACKAGES = Object.freeze(new Set(["do-harness-win32-x64"]));
37
+
38
+ /** Returns the binary filename for a Node platform. */
39
+ function binaryName(platform) {
40
+ return platform === "win32" ? "do-harness.exe" : "do-harness";
41
+ }
42
+
43
+ module.exports = {
44
+ PLATFORM_PACKAGES,
45
+ UNAVAILABLE_PACKAGES,
46
+ binaryName,
47
+ platformPackage,
48
+ };
package/package.json ADDED
@@ -0,0 +1,31 @@
1
+ {
2
+ "name": "do-harness",
3
+ "version": "0.1.1",
4
+ "description": "Zero-install npm wrapper for the do-harness agent execution harness CLI",
5
+ "license": "MIT",
6
+ "homepage": "https://github.com/d-o-hub/do-harness",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/d-o-hub/do-harness.git"
10
+ },
11
+ "bugs": {
12
+ "url": "https://github.com/d-o-hub/do-harness/issues"
13
+ },
14
+ "bin": {
15
+ "do-harness": "bin/do-harness.js"
16
+ },
17
+ "files": [
18
+ "bin/",
19
+ "lib/"
20
+ ],
21
+ "engines": {
22
+ "node": ">=18"
23
+ },
24
+ "optionalDependencies": {
25
+ "do-harness-darwin-arm64": "0.1.1",
26
+ "do-harness-darwin-x64": "0.1.1",
27
+ "do-harness-linux-arm64": "0.1.1",
28
+ "do-harness-linux-x64": "0.1.1",
29
+ "do-harness-win32-x64": "0.1.1"
30
+ }
31
+ }