@cocycles/bitx 0.0.0-stage → 0.1.0-alpha.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/README.md +168 -2
- package/bin/bitx.js +44 -0
- package/package.json +24 -4
package/README.md
CHANGED
|
@@ -1,3 +1,169 @@
|
|
|
1
|
-
#
|
|
1
|
+
# bitx
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**See what breaks. Ship what doesn't.**
|
|
4
|
+
|
|
5
|
+
Git versions repositories. Software doesn't stop at repository boundaries.
|
|
6
|
+
|
|
7
|
+
Your apps, services and libraries depend on each other. Git knows the files that changed.
|
|
8
|
+
It doesn't know what that change will break.
|
|
9
|
+
|
|
10
|
+
bitx does.
|
|
11
|
+
|
|
12
|
+
It connects your apps, services and libraries into a software graph, revealing how changes affect the
|
|
13
|
+
software that depends on them.
|
|
14
|
+
|
|
15
|
+
> **Alpha.** Commands and output may change between releases.
|
|
16
|
+
|
|
17
|
+
## Install
|
|
18
|
+
|
|
19
|
+
```sh
|
|
20
|
+
npm i -g @cocycles/bitx@next # globally
|
|
21
|
+
npm i -D @cocycles/bitx@next # or per repo, then call `bitx` from npm scripts
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
One prebuilt native binary for your platform (macOS arm64/x64, Linux x64/arm64, Windows x64). No install
|
|
25
|
+
scripts, nothing downloaded at install time, no daemon. Node 18+ only starts the binary.
|
|
26
|
+
|
|
27
|
+
It works on the workspace you already have: pnpm, npm, Yarn or Bun workspaces, or Cargo. Nothing moves.
|
|
28
|
+
|
|
29
|
+
bitx is the CLI; [Bit Cloud](https://bit.cloud) is the hosted graph it connects to.
|
|
30
|
+
|
|
31
|
+
## Quick start
|
|
32
|
+
|
|
33
|
+
```sh
|
|
34
|
+
bitx init # connect your existing workspace
|
|
35
|
+
# change a public API (or check out a branch that does), then:
|
|
36
|
+
bitx impact # what your changes break, and what uses them
|
|
37
|
+
bitx impact --repo github.com/acme/app # ...in another repo (a URL or a path)
|
|
38
|
+
bitx impact --package <name> # ...in a published npm package
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
`bitx --help` lists every command; `bitx <command> --help` explains one.
|
|
42
|
+
|
|
43
|
+
## See what a change breaks
|
|
44
|
+
|
|
45
|
+
`bitx init` discovers the packages, apps and services your repo already declares and connects them in a
|
|
46
|
+
dependency graph.
|
|
47
|
+
|
|
48
|
+
Make a change, and `bitx impact` compares the public API with where your branch left `main` (or any
|
|
49
|
+
revision, with `--base`). Each API change gets one of four verdicts, and you see everything that uses it:
|
|
50
|
+
|
|
51
|
+
- **breaking:** callers that compiled before won't (an export removed, a parameter now required)
|
|
52
|
+
- **feature:** new API, nothing breaks (an export added, an optional parameter)
|
|
53
|
+
- **compatible:** no effect on callers
|
|
54
|
+
- **review:** a type changed, and the source alone can't tell whether callers break
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
$ bitx impact --repo ../storefront
|
|
58
|
+
bitx impact · acme/checkout-flow workspace only · 2.7s
|
|
59
|
+
|
|
60
|
+
2 components use it · 2 in acme
|
|
61
|
+
|
|
62
|
+
API CHANGES 3 since main
|
|
63
|
+
acme/checkout-flow breaking · major
|
|
64
|
+
− PaymentError breaking · export removed interface PaymentError
|
|
65
|
+
~ retryPayment breaking · required parameter `attempts` added
|
|
66
|
+
retryPayment(orderId: string): Promise<boolean>
|
|
67
|
+
retryPayment(orderId: string, attempts: number): …
|
|
68
|
+
~ PaymentStatus review · wider (TypeScript): code creating it is fine; code reading it may get more than it handles
|
|
69
|
+
type PaymentStatus = 'paid' | 'declined'
|
|
70
|
+
type PaymentStatus = 'paid' | 'declined' | 'pendi…
|
|
71
|
+
|
|
72
|
+
REPO ../storefront
|
|
73
|
+
breaks · 3 uses of what changed, in 1 file · 1 use to review · 1 other file uses the packages safely
|
|
74
|
+
✖ src/checkout/pay.ts:1,3 PaymentError `PaymentError` was removed
|
|
75
|
+
✖ src/checkout/pay.ts:8 retryPayment passes 1 argument: required parameter `attempts` added
|
|
76
|
+
? src/checkout/status.ts:3 PaymentStatus wider (TypeScript): code creating it is fine; code reading it may get more than it handles
|
|
77
|
+
|
|
78
|
+
IN ACME 2 your scope
|
|
79
|
+
admin
|
|
80
|
+
storefront
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
A verdict is about the contract: removing `PaymentError` is breaking for anyone who could use it. Whether a
|
|
84
|
+
particular consumer breaks depends on what it uses, and `--repo` shows that: the files and lines that use
|
|
85
|
+
what changed, and the ones that use the package without touching it. `PaymentStatus` gained `'pending'`:
|
|
86
|
+
code that creates one is fine, but a `switch` that reads one may not handle the new value, so it's flagged
|
|
87
|
+
for review, with the line, not guessed.
|
|
88
|
+
|
|
89
|
+
bitx analyzes TypeScript and Rust APIs directly from source, without a build. When TypeScript inference
|
|
90
|
+
is needed, it uses your existing TypeScript installation. Anything it can't verify is reported explicitly.
|
|
91
|
+
|
|
92
|
+
`nx affected` and `turbo --filter` tell you which packages a file change reaches. bitx tells you what the
|
|
93
|
+
change does to them: an internal rewrite has no API changes, a new optional parameter is a feature, a
|
|
94
|
+
removed export is breaking.
|
|
95
|
+
|
|
96
|
+
Other repos work too: `--repo` (a Git URL or a path) and `--package <name>` check a change against a
|
|
97
|
+
repository or a published package you name, locally. Finding every repo that depends on you, including
|
|
98
|
+
the ones you don't know about, is what Bit Cloud does (below).
|
|
99
|
+
|
|
100
|
+
## Why now: trusting AI-generated code
|
|
101
|
+
|
|
102
|
+
AI can generate changes faster than teams can verify them. Trusting them is the new bottleneck.
|
|
103
|
+
|
|
104
|
+
A Git diff shows what changed. bitx shows what the change does to the software that depends on it, and
|
|
105
|
+
agents can use it the same way you do:
|
|
106
|
+
|
|
107
|
+
- **Check their own work before a PR.** An agent runs `bitx impact --base main` and sees a breaking API
|
|
108
|
+
change it missed, with the software it reaches, before you review it.
|
|
109
|
+
- **Test only what a change reaches.** `bitx impact --json` lists the dependents, so CI or an agent runs
|
|
110
|
+
your own tests on exactly those.
|
|
111
|
+
- **Work with the graph.** Bit Cloud's hosted MCP server connects agents to it (`bitx init` writes the
|
|
112
|
+
config).
|
|
113
|
+
|
|
114
|
+
The verdicts cover the public API. A change in behavior behind an unchanged signature still needs your
|
|
115
|
+
tests, your review and the previews (below).
|
|
116
|
+
|
|
117
|
+
## Fast enough to disappear
|
|
118
|
+
|
|
119
|
+
`bitx impact` takes about 0.4 s on a 134-package workspace, 2 s when TypeScript checks inferred types
|
|
120
|
+
(warm caches). The rest of the toolchain is just as quick: against classic Bit, the Node.js CLI bitx
|
|
121
|
+
replaces, on the same generated monorepo of 3,000 TypeScript packages (each importing 2–3 others, 30 layers
|
|
122
|
+
deep):
|
|
123
|
+
|
|
124
|
+
| | classic `bit` | bitx |
|
|
125
|
+
| -------------------------------- | ------------- | ---------- |
|
|
126
|
+
| Status | 16.6 s | **0.11 s** |
|
|
127
|
+
| Status after versioning all | 81.0 s | **0.53 s** |
|
|
128
|
+
| Compile every package | 41.6 s | **2.2 s** |
|
|
129
|
+
| Install | 92.5 s | **2.4 s** |
|
|
130
|
+
| Version all 3,000 packages | 116.6 s | **4.6 s** |
|
|
131
|
+
|
|
132
|
+
On a production workspace (493 packages, 16,000 installed dependencies), bitx compiles everything
|
|
133
|
+
in 3.5 s, type-checks what changed in 0.7 s, and starts an app ready to serve in 10.5 s.
|
|
134
|
+
|
|
135
|
+
Written in Rust, bitx performs graph operations locally and invokes each environment's tooling only when
|
|
136
|
+
needed. No daemon or server round trips for local work.
|
|
137
|
+
|
|
138
|
+
## Versions that follow the API
|
|
139
|
+
|
|
140
|
+
When you release, `bitx tag` can set the versions too: the API decides each bump (breaking is a major, new
|
|
141
|
+
API a minor, the rest a patch), written into `package.json` or `Cargo.toml` with the ranges other packages
|
|
142
|
+
in the repo have on it. It only sets versions; publishing and changelogs stay with the tools you use.
|
|
143
|
+
|
|
144
|
+
## Already using Bit?
|
|
145
|
+
|
|
146
|
+
bitx supports existing Bit workspaces and commands, including create, install, snap, tag and export. Your
|
|
147
|
+
existing components and workflows continue to work, and bitx will also ship as the next Bit release in bvm.
|
|
148
|
+
|
|
149
|
+
No migration required.
|
|
150
|
+
|
|
151
|
+
## One software graph. Across every repo.
|
|
152
|
+
|
|
153
|
+
Say your team changes a shared authentication library that three other teams use across six repositories.
|
|
154
|
+
Git sees a change to one repository. `--repo` checks the repositories you know about. Bit Cloud knows all
|
|
155
|
+
of them.
|
|
156
|
+
|
|
157
|
+
[Bit Cloud](https://bit.cloud) is the software graph across every repository, team and organization.
|
|
158
|
+
Connect your repos, and `bitx impact` finds every dependent of a change for you: across your organization
|
|
159
|
+
and beyond, including repos you'd never think to check, how they reach it (`--details`), and how far it
|
|
160
|
+
goes. Backend services too: AI review finds the API contracts your services expose and the services that
|
|
161
|
+
call them.
|
|
162
|
+
|
|
163
|
+
Bit Cloud can also run the rest of the change for you, when you want it: Ripple CI builds what a change
|
|
164
|
+
affects across repos, every change gets previews and staging, and releases publish themselves.
|
|
165
|
+
|
|
166
|
+
For an organization, that's the difference between a breaking change caught in review and an outage across
|
|
167
|
+
six repositories.
|
|
168
|
+
|
|
169
|
+
**Keep Git. See the whole software graph.**
|
package/bin/bitx.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// bitx's npm entry: run the native binary of this platform's package (installed through optionalDependencies,
|
|
3
|
+
// npm picks the one matching os/cpu - no install scripts). Exit code and signals pass through.
|
|
4
|
+
'use strict';
|
|
5
|
+
const { spawnSync } = require('child_process');
|
|
6
|
+
const path = require('path');
|
|
7
|
+
|
|
8
|
+
const PLATFORMS = {
|
|
9
|
+
'darwin-arm64': 'darwin-arm64',
|
|
10
|
+
'darwin-x64': 'darwin-x64',
|
|
11
|
+
'linux-x64': 'linux-x64',
|
|
12
|
+
'linux-arm64': 'linux-arm64',
|
|
13
|
+
'win32-x64': 'win32-x64',
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
function binaryPath() {
|
|
17
|
+
if (process.env.BITX_BINARY) return process.env.BITX_BINARY;
|
|
18
|
+
const key = PLATFORMS[`${process.platform}-${process.arch}`];
|
|
19
|
+
if (!key) {
|
|
20
|
+
throw new Error(`bitx has no build for ${process.platform}-${process.arch} yet`);
|
|
21
|
+
}
|
|
22
|
+
const pkg = `${require('../package.json').name}-${key}`;
|
|
23
|
+
const exe = process.platform === 'win32' ? 'bitx.exe' : 'bitx';
|
|
24
|
+
try {
|
|
25
|
+
return path.join(path.dirname(require.resolve(`${pkg}/package.json`)), 'bin', exe);
|
|
26
|
+
} catch {
|
|
27
|
+
throw new Error(`${pkg} isn't installed: reinstall without --no-optional (npm installs the binary for your platform as an optional dependency)`);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
let bin;
|
|
32
|
+
try {
|
|
33
|
+
bin = binaryPath();
|
|
34
|
+
} catch (e) {
|
|
35
|
+
process.stderr.write(`error: ${e.message}\n`);
|
|
36
|
+
process.exit(1);
|
|
37
|
+
}
|
|
38
|
+
const r = spawnSync(bin, process.argv.slice(2), { stdio: 'inherit', windowsHide: false });
|
|
39
|
+
if (r.error) {
|
|
40
|
+
process.stderr.write(`error: running ${bin}: ${r.error.message}\n`);
|
|
41
|
+
process.exit(1);
|
|
42
|
+
}
|
|
43
|
+
if (r.signal) process.kill(process.pid, r.signal);
|
|
44
|
+
process.exit(r.status === null ? 1 : r.status);
|
package/package.json
CHANGED
|
@@ -1,6 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cocycles/bitx",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0-alpha.1",
|
|
4
|
+
"description": "bitx: Bit's native CLI, one binary. Keep Git, turn your software into a graph.",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/Cocycles/bitx.git"
|
|
9
|
+
},
|
|
10
|
+
"bin": {
|
|
11
|
+
"bitx": "bin/bitx.js"
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"bin"
|
|
15
|
+
],
|
|
16
|
+
"engines": {
|
|
17
|
+
"node": ">=18"
|
|
18
|
+
},
|
|
19
|
+
"optionalDependencies": {
|
|
20
|
+
"@cocycles/bitx-darwin-arm64": "0.1.0-alpha.1",
|
|
21
|
+
"@cocycles/bitx-darwin-x64": "0.1.0-alpha.1",
|
|
22
|
+
"@cocycles/bitx-linux-x64": "0.1.0-alpha.1",
|
|
23
|
+
"@cocycles/bitx-linux-arm64": "0.1.0-alpha.1",
|
|
24
|
+
"@cocycles/bitx-win32-x64": "0.1.0-alpha.1"
|
|
25
|
+
}
|
|
26
|
+
}
|