@devroasts/cli 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 ADDED
@@ -0,0 +1,22 @@
1
+ # @devroasts/cli
2
+
3
+ One-command runner for DevRoasts.
4
+
5
+ ```bash
6
+ npx -y @devroasts/cli@latest --submit --api https://api.devroasts.com --link drl_...
7
+ ```
8
+
9
+ The command parses local Codex and Claude Code session logs, uploads only the
10
+ privacy-safe feature vector, and exits after the backend returns a scorecard.
11
+
12
+ Published releases include native binaries under
13
+ `native/<platform>-<arch>/devroasts`, so users only need Node/npm. The GitHub
14
+ source install path falls back to `go run ./apps/cli` and is only for local
15
+ development machines with Go installed.
16
+
17
+ Build native binaries before packing or publishing:
18
+
19
+ ```bash
20
+ DEVROASTS_NATIVE_TARGETS=darwin-arm64,darwin-x64,linux-x64,linux-arm64,win32-x64 npm run build:native
21
+ npm pack
22
+ ```
@@ -0,0 +1,63 @@
1
+ #!/usr/bin/env node
2
+ import { existsSync } from "node:fs";
3
+ import { dirname, join, resolve } from "node:path";
4
+ import { fileURLToPath } from "node:url";
5
+ import { spawn } from "node:child_process";
6
+
7
+ const here = dirname(fileURLToPath(import.meta.url));
8
+ const packageRoot = resolve(here, "..");
9
+ const args = process.argv.slice(2);
10
+
11
+ const nativeName = process.platform === "win32" ? "devroasts.exe" : "devroasts";
12
+ const nativeTarget = `${process.platform}-${process.arch}`;
13
+ const nativePath = join(packageRoot, "native", nativeTarget, nativeName);
14
+
15
+ if (existsSync(nativePath)) {
16
+ run(nativePath, args, {});
17
+ } else {
18
+ const repoRoot = findRepoRoot(packageRoot);
19
+ if (repoRoot) {
20
+ run("go", ["run", "./apps/cli", ...args], { cwd: repoRoot, sourceFallback: true });
21
+ } else {
22
+ console.error(`No DevRoasts native binary for ${nativeTarget} was found in this npm package.`);
23
+ console.error(`Expected: native/${nativeTarget}/${nativeName}`);
24
+ console.error("Install the latest published package: npx -y @devroasts/cli@latest");
25
+ process.exit(1);
26
+ }
27
+ }
28
+
29
+ function findRepoRoot(start) {
30
+ let current = start;
31
+ while (current !== dirname(current)) {
32
+ if (existsSync(join(current, "go.mod")) && existsSync(join(current, "apps", "cli", "main.go"))) {
33
+ return current;
34
+ }
35
+ current = dirname(current);
36
+ }
37
+ return "";
38
+ }
39
+
40
+ function run(command, commandArgs, options) {
41
+ const child = spawn(command, commandArgs, {
42
+ ...options,
43
+ stdio: "inherit",
44
+ env: process.env,
45
+ });
46
+ child.on("exit", (code, signal) => {
47
+ if (signal) {
48
+ process.kill(process.pid, signal);
49
+ return;
50
+ }
51
+ process.exit(code ?? 1);
52
+ });
53
+ child.on("error", (error) => {
54
+ if (options.sourceFallback && error.code === "ENOENT") {
55
+ console.error("GitHub source install requires Go because this checkout does not include a bundled native binary.");
56
+ console.error("Install Go 1.23+ for the GitHub fallback, or use the published package: npx -y @devroasts/cli@latest");
57
+ process.exit(1);
58
+ return;
59
+ }
60
+ console.error(`Could not start DevRoasts CLI: ${error.message}`);
61
+ process.exit(1);
62
+ });
63
+ }
Binary file
Binary file
Binary file
Binary file
Binary file
package/package.json ADDED
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "@devroasts/cli",
3
+ "version": "0.1.0",
4
+ "description": "One-command DevRoasts CLI runner for local agent log analysis.",
5
+ "license": "UNLICENSED",
6
+ "type": "module",
7
+ "bin": {
8
+ "devroasts": "./bin/devroasts.js"
9
+ },
10
+ "files": [
11
+ "bin",
12
+ "native",
13
+ "README.md"
14
+ ],
15
+ "engines": {
16
+ "node": ">=18"
17
+ },
18
+ "scripts": {
19
+ "build:native": "node ./scripts/build-native.js",
20
+ "test:wrapper": "node ./scripts/test-wrapper.js",
21
+ "smoke": "node ./bin/devroasts.js --dry-run --fixture ../../packages/fixtures/basic-combined --json"
22
+ }
23
+ }