@tangle-network/traces 0.8.11 → 0.8.12

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 CHANGED
@@ -28,9 +28,12 @@ It reads the transcripts your harness leaves on disk, reconstructs the run as sp
28
28
  ## Install
29
29
 
30
30
  ```bash
31
- npm i -g @tangle-network/traces # the `traces` CLI
32
- npx @tangle-network/traces analyze # or run without installing
33
- npm i @tangle-network/traces # or use it as a library
31
+ curl -fsSL https://raw.githubusercontent.com/tangle-network/traces/main/install.sh | bash
32
+ traces --version
33
+
34
+ npx --yes @tangle-network/traces@latest analyze --harness claude-code --last 1 # run without installing
35
+ npm i -g @tangle-network/traces # install manually
36
+ npm i @tangle-network/traces # use it as a library
34
37
  ```
35
38
 
36
39
  Requires Node ≥ 22.
@@ -227,6 +230,7 @@ Merging to `main` publishes a patch release automatically:
227
230
  2. It commits `chore(release): vX.Y.(Z+1) [skip release]` back to `main`.
228
231
  3. It pushes the matching `vX.Y.(Z+1)` tag.
229
232
  4. The same workflow verifies the tag, builds, publishes to npm, and creates a GitHub release.
233
+ 5. `pnpm check:package` proves the npm tarball contains the `traces` binary before release.
230
234
 
231
235
  Minor releases are manual. Run the Publish workflow from GitHub Actions and choose `minor`; it publishes `X.(Y+1).0`. Use manual `patch` only when you need a patch release without merging a new code change.
232
236
 
package/dist/cli.js CHANGED
@@ -33,6 +33,7 @@ import {
33
33
  } from "./chunk-PRRWLKSI.js";
34
34
 
35
35
  // src/cli.ts
36
+ import { readFileSync } from "fs";
36
37
  import { readFile, stat, writeFile } from "fs/promises";
37
38
 
38
39
  // src/report.ts
@@ -194,6 +195,11 @@ function renderAdoption(ar) {
194
195
  }
195
196
 
196
197
  // src/cli.ts
198
+ function packageVersion() {
199
+ const pkg = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8"));
200
+ if (typeof pkg.version !== "string" || !pkg.version) throw new Error("package.json is missing version");
201
+ return pkg.version;
202
+ }
197
203
  function parseArgs(argv) {
198
204
  const a = {
199
205
  command: argv[0] === "--help" || argv[0] === "-h" ? "help" : argv[0] ?? "help",
@@ -688,12 +694,18 @@ Options:
688
694
  --no-content upload: strip prompt/response text \u2014 send metadata only
689
695
  --redactor <cmd> upload: external PII scrubber (JSON array stdin\u2192stdout) after the regex pass
690
696
  --yes, -y upload: skip the confirmation prompt
697
+ --version, -v Print the installed traces version
691
698
  --help, -h Show help (use \`traces export --help\` for export examples)
692
699
 
693
700
  Upload env: TANGLE_INGEST_URL (or TANGLE_ORCHESTRATOR_URL), TANGLE_INGEST_API_KEY (or TANGLE_API_KEY), TANGLE_TENANT_ID`);
694
701
  }
695
702
  async function main() {
696
- const args = parseArgs(process.argv.slice(2));
703
+ const rawArgs = process.argv.slice(2);
704
+ if (rawArgs[0] === "--version" || rawArgs[0] === "-v" || rawArgs[0] === "version") {
705
+ console.log(`traces ${packageVersion()}`);
706
+ return;
707
+ }
708
+ const args = parseArgs(rawArgs);
697
709
  if (args.help) {
698
710
  if (args.command === "export" || args.command === "help" && args.input === "export") usageExport();
699
711
  else usage();
package/install.sh ADDED
@@ -0,0 +1,102 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ PACKAGE="@tangle-network/traces"
5
+ VERSION="${TRACES_VERSION:-latest}"
6
+ PREFIX="${TRACES_PREFIX:-}"
7
+
8
+ usage() {
9
+ cat <<'USAGE'
10
+ Install the traces CLI from npm.
11
+
12
+ Usage:
13
+ curl -fsSL https://raw.githubusercontent.com/tangle-network/traces/main/install.sh | bash
14
+ ./install.sh [--version <version>] [--prefix <dir>]
15
+
16
+ Environment:
17
+ TRACES_VERSION npm version or tag to install (default: latest)
18
+ TRACES_PREFIX npm global prefix to use when the default is not writable
19
+ USAGE
20
+ }
21
+
22
+ while [ "$#" -gt 0 ]; do
23
+ case "$1" in
24
+ --version)
25
+ [ "${2:-}" ] || { echo "missing value for --version" >&2; exit 2; }
26
+ VERSION="$2"
27
+ shift 2
28
+ ;;
29
+ --prefix)
30
+ [ "${2:-}" ] || { echo "missing value for --prefix" >&2; exit 2; }
31
+ PREFIX="$2"
32
+ shift 2
33
+ ;;
34
+ -h|--help)
35
+ usage
36
+ exit 0
37
+ ;;
38
+ *)
39
+ echo "unknown argument: $1" >&2
40
+ usage >&2
41
+ exit 2
42
+ ;;
43
+ esac
44
+ done
45
+
46
+ if ! command -v node >/dev/null 2>&1; then
47
+ echo "Node.js >=22 is required before installing traces." >&2
48
+ exit 1
49
+ fi
50
+
51
+ node_version="$(node -e "process.stdout.write(process.versions.node)")"
52
+ node_major="${node_version%%.*}"
53
+ if [ "$node_major" -lt 22 ]; then
54
+ echo "Node.js >=22 is required; found v$node_version." >&2
55
+ exit 1
56
+ fi
57
+
58
+ if ! command -v npm >/dev/null 2>&1; then
59
+ echo "npm is required before installing traces." >&2
60
+ exit 1
61
+ fi
62
+
63
+ install_args=(install -g "${PACKAGE}@${VERSION}")
64
+ npm_prefix="$(npm prefix -g)"
65
+ install_prefix="$npm_prefix"
66
+
67
+ if [ -n "$PREFIX" ]; then
68
+ mkdir -p "$PREFIX"
69
+ install_args+=(--prefix "$PREFIX")
70
+ install_prefix="$PREFIX"
71
+ else
72
+ if [ ! -w "$npm_prefix" ]; then
73
+ install_prefix="$HOME/.local"
74
+ mkdir -p "$install_prefix"
75
+ install_args+=(--prefix "$install_prefix")
76
+ echo "npm global prefix is not writable; installing into $install_prefix"
77
+ fi
78
+ fi
79
+
80
+ npm "${install_args[@]}"
81
+
82
+ bin_dir="$install_prefix/bin"
83
+ if [ -x "$bin_dir/traces" ]; then
84
+ traces_cmd="$bin_dir/traces"
85
+ elif command -v traces >/dev/null 2>&1; then
86
+ traces_cmd="traces"
87
+ else
88
+ echo "Installed ${PACKAGE}@${VERSION}, but the traces binary was not found at $bin_dir/traces or on PATH." >&2
89
+ echo "Add this to PATH: $bin_dir" >&2
90
+ exit 1
91
+ fi
92
+
93
+ version_output="$("$traces_cmd" --version 2>/dev/null || true)"
94
+ case "$version_output" in
95
+ traces\ [0-9]*.[0-9]*.[0-9]*) echo "$version_output" ;;
96
+ *) echo "traces installed: $traces_cmd" ;;
97
+ esac
98
+ case ":$PATH:" in
99
+ *":$bin_dir:"*) ;;
100
+ *) echo "Add this to PATH for future shells: $bin_dir" ;;
101
+ esac
102
+ echo "Run: traces analyze --harness claude-code --last 1"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/traces",
3
- "version": "0.8.11",
3
+ "version": "0.8.12",
4
4
  "description": "Point it at your coding-agent session traces (Claude Code, Codex, OpenCode, Gemini, Pi, …) and get failure-mode + efficiency findings. CLI + SDK over the @tangle-network/agent-eval analyst suite — observe live sessions, run your own analysts, redact, and upload to the Tangle Intelligence Platform.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -36,6 +36,7 @@
36
36
  },
37
37
  "files": [
38
38
  "dist",
39
+ "install.sh",
39
40
  "README.md"
40
41
  ],
41
42
  "engines": {
@@ -56,6 +57,7 @@
56
57
  "scripts": {
57
58
  "dev": "tsx src/cli.ts",
58
59
  "build": "tsup src/index.ts src/cli.ts --format esm --target node22 --clean --dts",
60
+ "check:package": "node scripts/check-package-bin.mjs",
59
61
  "test": "vitest run",
60
62
  "test:watch": "vitest",
61
63
  "typecheck": "tsc --noEmit"