tryharness 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.
- package/README.md +19 -0
- package/cli.mjs +54 -0
- package/package.json +23 -0
package/README.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# tryharness
|
|
2
|
+
|
|
3
|
+
Connect this machine to [Harness](https://tryharness.ai).
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
npx tryharness
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Prints a short code — approve it in Harness (Settings, Connections, Connect a machine).
|
|
10
|
+
Then it sets up everything it finds on this machine: memory access for your coding
|
|
11
|
+
agents (Claude Code, Codex), automatic session sharing with a one-time history import,
|
|
12
|
+
and the bridge that lets Harness send tasks to your agents (Claude Code, pi, opencode).
|
|
13
|
+
|
|
14
|
+
Other commands: `npx tryharness bridge` (start the task bridge again),
|
|
15
|
+
`npx tryharness backfill` (re-import recent Claude Code sessions),
|
|
16
|
+
`npx tryharness drain` (retry session reports that missed).
|
|
17
|
+
|
|
18
|
+
No tokens to copy: approval releases the credential directly to the waiting command.
|
|
19
|
+
Everything your agents share stays between your machine and your browser.
|
package/cli.mjs
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// tryharness: thin bootstrap. The real logic lives on the Harness server and is fetched
|
|
3
|
+
// fresh on every run, so this package never needs republishing to pick up improvements
|
|
4
|
+
// (a cached copy in ~/.harness runs when offline). Commands:
|
|
5
|
+
// npx tryharness pair this machine + set up every detected agent
|
|
6
|
+
// npx tryharness bridge start the task bridge (after pairing)
|
|
7
|
+
// npx tryharness backfill re-import recent Claude Code sessions
|
|
8
|
+
// npx tryharness drain retry any session reports that missed
|
|
9
|
+
import fs from "node:fs";
|
|
10
|
+
import path from "node:path";
|
|
11
|
+
import os from "node:os";
|
|
12
|
+
import { spawn } from "node:child_process";
|
|
13
|
+
|
|
14
|
+
const HARNESS_DIR = path.join(os.homedir(), ".harness");
|
|
15
|
+
const COMMANDS = {
|
|
16
|
+
connect: { file: "connect.mjs", args: [] },
|
|
17
|
+
bridge: { file: "bridge.mjs", args: [] },
|
|
18
|
+
backfill: { file: "report-session.mjs", args: ["--backfill"] },
|
|
19
|
+
drain: { file: "report-session.mjs", args: ["--drain"] },
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const argv = process.argv.slice(2);
|
|
23
|
+
const sub = argv[0] && !argv[0].startsWith("-") ? argv.shift() : "connect";
|
|
24
|
+
const command = COMMANDS[sub];
|
|
25
|
+
if (!command) {
|
|
26
|
+
console.error("unknown command: " + sub + " (try: connect | bridge | backfill | drain)");
|
|
27
|
+
process.exit(1);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
let savedOrigin = null;
|
|
31
|
+
try {
|
|
32
|
+
savedOrigin = JSON.parse(fs.readFileSync(path.join(HARNESS_DIR, "config.json"), "utf8")).origin || null;
|
|
33
|
+
} catch {
|
|
34
|
+
savedOrigin = null;
|
|
35
|
+
}
|
|
36
|
+
const originIndex = argv.indexOf("--origin");
|
|
37
|
+
const origin = (originIndex !== -1 && argv[originIndex + 1] ? argv[originIndex + 1] : savedOrigin || "https://tryharness.ai").replace(/\/$/, "");
|
|
38
|
+
|
|
39
|
+
const dest = path.join(HARNESS_DIR, command.file);
|
|
40
|
+
fs.mkdirSync(HARNESS_DIR, { recursive: true });
|
|
41
|
+
try {
|
|
42
|
+
const res = await fetch(origin + "/" + command.file);
|
|
43
|
+
if (!res.ok) throw new Error("HTTP " + res.status);
|
|
44
|
+
fs.writeFileSync(dest, await res.text());
|
|
45
|
+
} catch (error) {
|
|
46
|
+
if (!fs.existsSync(dest)) {
|
|
47
|
+
console.error("could not reach " + origin + " (" + error.message + ") and no cached copy exists");
|
|
48
|
+
process.exit(1);
|
|
49
|
+
}
|
|
50
|
+
console.error("could not refresh from " + origin + " - running the cached copy");
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const child = spawn(process.execPath, [dest, ...command.args, ...argv], { stdio: "inherit" });
|
|
54
|
+
child.on("close", (code) => process.exit(code ?? 0));
|
package/package.json
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "tryharness",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Connect this machine to Harness: pair with a code, link your coding agents (Claude Code, Codex, opencode, pi), share session history, and accept delegated tasks.",
|
|
5
|
+
"bin": {
|
|
6
|
+
"tryharness": "cli.mjs"
|
|
7
|
+
},
|
|
8
|
+
"type": "module",
|
|
9
|
+
"engines": {
|
|
10
|
+
"node": ">=20"
|
|
11
|
+
},
|
|
12
|
+
"files": [
|
|
13
|
+
"cli.mjs",
|
|
14
|
+
"README.md"
|
|
15
|
+
],
|
|
16
|
+
"keywords": [
|
|
17
|
+
"harness",
|
|
18
|
+
"coding-agents",
|
|
19
|
+
"claude-code"
|
|
20
|
+
],
|
|
21
|
+
"homepage": "https://tryharness.ai",
|
|
22
|
+
"license": "MIT"
|
|
23
|
+
}
|