@trce/cli 0.1.0-beta.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/CHANGELOG.md ADDED
@@ -0,0 +1,19 @@
1
+ # Changelog
2
+
3
+ Notable changes to trce are documented here.
4
+
5
+ ## 0.1.0-beta.1 — Unreleased
6
+
7
+ First public beta.
8
+
9
+ ### Added
10
+
11
+ - Self-contained native CLI packages for macOS, Linux, and Windows on arm64
12
+ and x64.
13
+ - Claude Code and Codex CLI hook installation, local recording, normalization,
14
+ on-device redaction, one-shot sharing, live sharing, and unshare.
15
+ - Local device identity with owner-only POSIX permissions.
16
+ - Retry-safe bounded uploads and visible oversized-event truncation metadata.
17
+ - `@trce/protocol` with runtime Zod schemas and TypeScript declarations.
18
+ - Cross-platform package smoke tests, fixture goldens, schema validation, and
19
+ planted-secret coverage.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Tair Asim
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,126 @@
1
+ # trce
2
+
3
+ ![trce — See what your coding agents do](docs/github-social-preview.png)
4
+
5
+ See what your coding agents do.
6
+
7
+ [![CI](https://github.com/assimovt/trce-cli/actions/workflows/ci.yml/badge.svg)](https://github.com/assimovt/trce-cli/actions/workflows/ci.yml)
8
+ [![License: MIT](https://img.shields.io/badge/license-MIT-magenta.svg)](LICENSE)
9
+
10
+ `trce` records Claude Code and Codex CLI sessions locally as structured events.
11
+ Inspect each trace on your machine, or explicitly share it for live viewing and
12
+ replay.
13
+
14
+ > Recording is local. Nothing leaves your machine until you explicitly share.
15
+ > Redaction runs on-device before every upload.
16
+
17
+ ## Install
18
+
19
+ ```sh
20
+ npm install -g @trce/cli@next
21
+ trce help
22
+ ```
23
+
24
+ The package installs a self-contained native executable; Bun is not required at
25
+ runtime. Install scripts and optional dependencies must be enabled so npm can
26
+ select the binary for your platform.
27
+
28
+ Supported targets:
29
+
30
+ - macOS, Linux, and Windows
31
+ - arm64 and x64
32
+
33
+ ## Quick start
34
+
35
+ Preview and install hooks for the current project:
36
+
37
+ ```sh
38
+ # Claude Code
39
+ trce init --harness claude-code --scope project --dry-run
40
+ trce init --harness claude-code --scope project --yes
41
+
42
+ # Codex CLI
43
+ trce init --harness codex-cli --scope project --dry-run
44
+ trce init --harness codex-cli --scope project --yes
45
+ ```
46
+
47
+ Use `--scope global` to install for every project. Start a new Claude Code or
48
+ Codex session after installation; hooks then record lifecycle events locally in
49
+ `~/.trce/spool/`.
50
+
51
+ Share the latest session when you choose:
52
+
53
+ ```sh
54
+ trce share --latest # one-shot share
55
+ trce share --latest --live # live updates until the session ends
56
+ trce share --latest --local # redacted JSON and HTML; no upload
57
+ ```
58
+
59
+ Claude Code users can also run `/trce-share` or `/trce-share live`. In Codex,
60
+ ask the agent to run the same `trce share` command, or run it yourself.
61
+
62
+ Delete a hosted copy without deleting the local recording:
63
+
64
+ ```sh
65
+ trce unshare https://trce.sh/t/<share-id>
66
+ ```
67
+
68
+ ## How it works
69
+
70
+ 1. Harness hooks append native events to a local JSONL spool. `trce spool` does
71
+ no network work, normalization, or redaction.
72
+ 2. An explicit share action combines the spool with the native transcript,
73
+ normalizes it, and redacts it on-device.
74
+ 3. The CLI writes a local `trace.json`, redaction report, and HTML preview. It
75
+ uploads only when `--local` is not set.
76
+
77
+ Long sessions are uploaded in ordered, retry-safe batches. Oversized event
78
+ payloads are reduced to a visible first/last preview for sharing while the raw
79
+ local recording remains untouched.
80
+
81
+ ## Privacy
82
+
83
+ Applied `trce init` creates a random device token in `~/.trce/config.toml`.
84
+ The token is never printed or included in trace data; it is used only as the
85
+ authorization header for explicit publish and unshare actions. Existing tokens
86
+ are preserved. On macOS and Linux, the directory is mode `0700` and the config
87
+ file is mode `0600`.
88
+
89
+ Redaction masks secret-looking keys and values, common credential formats,
90
+ authorization headers, database URLs, PEM keys, values loaded from local
91
+ `.env*` files, and configured extra values. Redaction is best-effort, and every
92
+ share includes a visible report. Review sensitive traces before sharing.
93
+
94
+ ## Documentation
95
+
96
+ - [CLI interface](docs/cli-interface.md)
97
+ - [Publish protocol](docs/publish-protocol.md)
98
+ - [Trace schema](docs/trace-schema.md) and [JSON Schema](docs/trace-schema.json)
99
+ - [Project scope and privacy invariants](docs/project-scope.md)
100
+ - [`@trce/protocol`](packages/protocol/README.md)
101
+
102
+ The Zod definitions in `packages/schema` are the source of truth for the
103
+ `trce: "0.1"` format. Unknown native records degrade to `other` rather than
104
+ crashing when harness formats drift.
105
+
106
+ ## Development
107
+
108
+ Requires Bun 1.3.12. Node.js 24 and npm 11 are also used by package smoke tests.
109
+
110
+ ```sh
111
+ bun install --frozen-lockfile
112
+ bun run verify
113
+ ```
114
+
115
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for fixture, privacy, and pull-request
116
+ requirements.
117
+
118
+ ## Community
119
+
120
+ - Use [GitHub Issues](https://github.com/assimovt/trce-cli/issues) for sanitized
121
+ bug reports and focused feature proposals.
122
+ - Use [SECURITY.md](SECURITY.md) for private vulnerability reports. Never post
123
+ raw traces, credentials, or device tokens publicly.
124
+ - Participation is governed by the [Code of Conduct](CODE_OF_CONDUCT.md).
125
+
126
+ Maintained by Tair Asim. Released under the [MIT License](LICENSE).
package/bin/trce.exe ADDED
@@ -0,0 +1,5 @@
1
+ echo "Error: trce's postinstall script was not run." >&2
2
+ echo "" >&2
3
+ echo "Reinstall @trce/cli without --ignore-scripts or --omit=optional." >&2
4
+ echo "The install needs its platform-specific native binary package." >&2
5
+ exit 1
Binary file
package/install.cjs ADDED
@@ -0,0 +1,88 @@
1
+ "use strict";
2
+
3
+ const { chmodSync, copyFileSync, existsSync, renameSync } = require("node:fs");
4
+ const { dirname, join } = require("node:path");
5
+ const { spawnSync } = require("node:child_process");
6
+
7
+ const PLATFORM_PACKAGES = {
8
+ "darwin-arm64": {
9
+ binary: "bin/trce",
10
+ packageName: "@trce/cli-darwin-arm64",
11
+ },
12
+ "darwin-x64": {
13
+ binary: "bin/trce",
14
+ packageName: "@trce/cli-darwin-x64",
15
+ },
16
+ "linux-arm64": {
17
+ binary: "bin/trce",
18
+ packageName: "@trce/cli-linux-arm64",
19
+ },
20
+ "linux-x64": {
21
+ binary: "bin/trce",
22
+ packageName: "@trce/cli-linux-x64",
23
+ },
24
+ "win32-arm64": {
25
+ binary: "bin/trce.exe",
26
+ packageName: "@trce/cli-win32-arm64",
27
+ },
28
+ "win32-x64": {
29
+ binary: "bin/trce.exe",
30
+ packageName: "@trce/cli-win32-x64",
31
+ },
32
+ };
33
+
34
+ function platformPackage(platform = process.platform, arch = process.arch) {
35
+ return PLATFORM_PACKAGES[`${platform}-${arch}`] ?? null;
36
+ }
37
+
38
+ function install() {
39
+ // The source checkout builds platform packages explicitly. Published npm
40
+ // tarballs do not contain .git and must always install their native binary.
41
+ if (existsSync(join(__dirname, ".git"))) {
42
+ return;
43
+ }
44
+
45
+ const target = platformPackage();
46
+ if (target === null) {
47
+ throw new Error(`Unsupported platform: ${process.platform} ${process.arch}`);
48
+ }
49
+
50
+ const packageJson = require.resolve(`${target.packageName}/package.json`);
51
+ const packageVersion = require(packageJson).version;
52
+ const rootVersion = require(join(__dirname, "package.json")).version;
53
+ if (packageVersion !== rootVersion) {
54
+ throw new Error(
55
+ `Native package version mismatch: @trce/cli ${rootVersion}, ${target.packageName} ${packageVersion}`,
56
+ );
57
+ }
58
+
59
+ const source = join(dirname(packageJson), target.binary);
60
+ const destination = join(__dirname, "bin", "trce.exe");
61
+ if (!existsSync(source)) {
62
+ throw new Error(`Native trce binary is missing from ${target.packageName}`);
63
+ }
64
+
65
+ const smoke = spawnSync(source, ["help"], { encoding: "utf8" });
66
+ if (smoke.status !== 0) {
67
+ throw new Error(smoke.stderr || smoke.stdout || `Could not run ${source}`);
68
+ }
69
+
70
+ try {
71
+ renameSync(source, destination);
72
+ } catch {
73
+ copyFileSync(source, destination);
74
+ }
75
+ chmodSync(destination, 0o755);
76
+ }
77
+
78
+ module.exports = { install, platformPackage };
79
+
80
+ if (require.main === module) {
81
+ try {
82
+ install();
83
+ } catch (error) {
84
+ console.error(`trce install failed: ${error instanceof Error ? error.message : String(error)}`);
85
+ console.error("Reinstall without --ignore-scripts or --omit=optional.");
86
+ process.exit(1);
87
+ }
88
+ }
package/package.json ADDED
@@ -0,0 +1,90 @@
1
+ {
2
+ "name": "@trce/cli",
3
+ "version": "0.1.0-beta.1",
4
+ "description": "Local recorder and share CLI for coding-agent traces.",
5
+ "author": "Tair Asim",
6
+ "homepage": "https://trce.sh",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/assimovt/trce-cli.git"
10
+ },
11
+ "bugs": {
12
+ "url": "https://github.com/assimovt/trce-cli/issues"
13
+ },
14
+ "license": "MIT",
15
+ "type": "module",
16
+ "packageManager": "bun@1.3.12",
17
+ "engines": {
18
+ "node": ">=18"
19
+ },
20
+ "os": [
21
+ "darwin",
22
+ "linux",
23
+ "win32"
24
+ ],
25
+ "cpu": [
26
+ "arm64",
27
+ "x64"
28
+ ],
29
+ "publishConfig": {
30
+ "access": "public"
31
+ },
32
+ "keywords": [
33
+ "agents",
34
+ "claude-code",
35
+ "codex",
36
+ "tracing"
37
+ ],
38
+ "bin": {
39
+ "trce": "./bin/trce.exe"
40
+ },
41
+ "files": [
42
+ "bin/trce.exe",
43
+ "install.cjs",
44
+ "README.md",
45
+ "CHANGELOG.md",
46
+ "LICENSE",
47
+ "docs/github-social-preview.png"
48
+ ],
49
+ "workspaces": [
50
+ "packages/*",
51
+ "apps/*"
52
+ ],
53
+ "optionalDependencies": {
54
+ "@trce/cli-darwin-arm64": "0.1.0-beta.1",
55
+ "@trce/cli-darwin-x64": "0.1.0-beta.1",
56
+ "@trce/cli-linux-arm64": "0.1.0-beta.1",
57
+ "@trce/cli-linux-x64": "0.1.0-beta.1",
58
+ "@trce/cli-win32-arm64": "0.1.0-beta.1",
59
+ "@trce/cli-win32-x64": "0.1.0-beta.1"
60
+ },
61
+ "scripts": {
62
+ "build": "bun run scripts/build-bundle.ts",
63
+ "build:binary": "bun run scripts/build-platform.ts --target current",
64
+ "build:binaries": "bun run scripts/build-platform.ts --target all",
65
+ "build:cli": "bun run build",
66
+ "build:protocol": "bun run scripts/build-protocol.ts",
67
+ "check:packages": "bun run scripts/check-packages.ts",
68
+ "dev:cli": "bun run packages/cli/src/index.ts",
69
+ "lint": "biome lint .",
70
+ "pack:check": "npm_config_cache=./dist/.npm-cache npm pack --dry-run",
71
+ "pack:local": "bun run scripts/pack-local.ts --target current",
72
+ "pack:protocol": "bun run scripts/pack-protocol.ts",
73
+ "pack:protocol:check": "npm_config_cache=./dist/.npm-cache npm pack ./packages/protocol --dry-run",
74
+ "postinstall": "node install.cjs",
75
+ "prepack": "bun run check:packages",
76
+ "schema:check": "bun run scripts/generate-json-schema.ts --check",
77
+ "schema:generate": "bun run scripts/generate-json-schema.ts",
78
+ "release:check": "bun run scripts/check-release.ts --version 0.1.0-beta.1 --tag next",
79
+ "smoke:package": "bun run scripts/smoke-package.ts --target current",
80
+ "smoke:protocol": "bun run scripts/smoke-protocol.ts",
81
+ "test": "bun test",
82
+ "typecheck": "bun run build:protocol && tsc -p packages/schema/tsconfig.json --noEmit && tsc -p packages/protocol/tsconfig.json --noEmit && tsc -p packages/cli/tsconfig.json --noEmit && tsc -p scripts/tsconfig.json --noEmit",
83
+ "verify": "bun run lint && bun run typecheck && bun run test && bun run check:packages && bun run schema:check && bun run build"
84
+ },
85
+ "devDependencies": {
86
+ "@biomejs/biome": "^2.5.2",
87
+ "@types/bun": "^1.3.14",
88
+ "typescript": "^7.0.2"
89
+ }
90
+ }