rainbo 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/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Rainbo
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.
22
+
package/README.md ADDED
@@ -0,0 +1,183 @@
1
+ # rainbo
2
+
3
+ Rainbo command line tools for data migration workflows.
4
+
5
+ ## Requirements
6
+
7
+ - Node.js 16+
8
+ - Rust toolchain for source development. End users installing from npm get a prebuilt binary.
9
+
10
+ ## Install
11
+
12
+ ```bash
13
+ npm install -g rainbo
14
+ rainbo version
15
+ ```
16
+
17
+ ## Development
18
+
19
+ ```bash
20
+ node packaging/npm/run.js version
21
+ node packaging/npm/run.js help
22
+ npm run check:skills
23
+ npm run build:npm:local
24
+ ```
25
+
26
+ ## Output
27
+
28
+ Command output is structured for humans, scripts, and AI agents:
29
+
30
+ ```bash
31
+ rainbo version # JSON envelope on stdout
32
+ rainbo version --format pretty # Human-readable output
33
+ ```
34
+
35
+ Successful JSON output uses:
36
+
37
+ ```json
38
+ {"ok":true,"data":{...}}
39
+ ```
40
+
41
+ Errors are written to stderr:
42
+
43
+ ```json
44
+ {"ok":false,"error":{"type":"validation","subtype":"invalid_argument","message":"..."}}
45
+ ```
46
+
47
+ ## Update
48
+
49
+ ```bash
50
+ rainbo update --check
51
+ rainbo update
52
+ rainbo update --force
53
+ ```
54
+
55
+ `update --check` only reports status. Normal JSON command output may include
56
+ `_notice.update` when a newer npm version is known from the local update cache
57
+ and `_notice.skills` when locally synced skills are out of sync with the
58
+ running binary. Both notices recommend `rainbo update`.
59
+
60
+ `update` detects npm installations, runs `npm install -g rainbo@<latest>`
61
+ when auto-update is available, verifies the new binary, and syncs repository
62
+ skills with:
63
+
64
+ ```bash
65
+ npx skills add git@gitlab.clickzetta-inc.com:ee/rainbo.git -y -g
66
+ ```
67
+
68
+ Skill sync records detailed state in `skills-state.json` and updates installed
69
+ official skills incrementally when possible. If incremental planning is not
70
+ available, it falls back to a full install.
71
+
72
+ If automatic update is unavailable, the JSON action is `manual_required` and
73
+ the response includes release and changelog URLs.
74
+
75
+ ## Auth
76
+
77
+ ```bash
78
+ rainbo auth connect "rainbo://connect?base_url=http%3A%2F%2Flocalhost%3A8088&code=..."
79
+ rainbo auth status
80
+ rainbo auth logout
81
+ ```
82
+
83
+ Generate the connection URL from the logged-in Rainbo web UI user menu. `auth
84
+ connect` exchanges the one-time connection code for a revocable CLI bearer token
85
+ and stores it under `~/.config/rainbo/auth.json` with `0600` permissions on
86
+ Unix-like systems.
87
+
88
+ ## API Commands
89
+
90
+ Authenticated API commands reuse the session created by `rainbo auth connect`.
91
+ Complex request bodies can be passed with `--data-json`, `--data-file`, or
92
+ `--data @payload.json`.
93
+
94
+ ```bash
95
+ rainbo data-sync cmt-jobs --data-file cmt-jobs.json
96
+ rainbo data-verify lineage-verify-table --data-file verify-table.json
97
+ rainbo toolbox sql-debug --datasource-id 1 --sql "select 1"
98
+ rainbo toolbox lineage-spark --data-file lineage-spark.json
99
+
100
+ rainbo lineage graph create --data-file lineage-graph.json
101
+ rainbo lineage graph get "lineage_graph:migration:1001"
102
+ rainbo lineage graph --view-mode TABLE_GRAPH --graph-key "lineage_graph:migration:1001"
103
+ rainbo lineage upstream "lakehouse.dwd.user" --graph-key "lineage_graph:migration:1001" --side TARGET --depth 1
104
+ rainbo lineage downstream "lakehouse.ods.user" --graph-key "lineage_graph:migration:1001" --side TARGET --depth 1
105
+ rainbo lineage graph delete "lineage_graph:migration:1001"
106
+ ```
107
+
108
+ ## Release
109
+
110
+ 1. Update `package.json` and `rust/Cargo.toml` to the same version.
111
+ 2. Export the npm publish token from the release machine:
112
+
113
+ ```bash
114
+ source ~/.zshrc
115
+ export NPM_TOKEN="${NPM_TOKEN}"
116
+ ```
117
+
118
+ `NODE_AUTH_TOKEN` is also supported. Use a granular access token with read/write
119
+ access and "Bypass two-factor authentication" enabled. The publish script
120
+ requires token-based publishing, creates a temporary npm config, verifies
121
+ `npm whoami --registry` returns `singdata`, and refuses to publish any package
122
+ whose `package.json` name is not `rainbo`.
123
+
124
+ 3. Build, verify, dry-run pack, and publish from this directory:
125
+
126
+ ```bash
127
+ npm run publish:npm:local
128
+ ```
129
+
130
+ If npm returns `EOTP`, use an automation-capable publish token or pass the
131
+ current OTP:
132
+
133
+ ```bash
134
+ npm run publish:npm:local -- --otp=<code>
135
+ ```
136
+
137
+ By default the local script builds the current platform binary into
138
+ `packaging/npm/bin/<platform>/`. To publish multiple bundled platforms from a
139
+ machine with the required Rust targets/toolchains installed, set:
140
+
141
+ ```bash
142
+ RAINBO_NPM_BUILD_TARGETS=darwin-arm64,darwin-x64 npm run publish:npm:local
143
+ ```
144
+
145
+ The package source lives under the Rainbo GitLab repository as
146
+ `packages/rainbo-cli`; npm publishing is intentionally local and does not depend
147
+ on a separate repository or CI workflow.
148
+
149
+ ## Skills
150
+
151
+ Repository skills live in `skills/`. They can be installed from the repository:
152
+
153
+ ```bash
154
+ npx skills add git@gitlab.clickzetta-inc.com:ee/rainbo.git -y -g
155
+ ```
156
+
157
+ `git@gitlab.clickzetta-inc.com:ee/rainbo.git` is the skills repository
158
+ source used by `rainbo update`. The old aggregate `rainbo-cli` skill has
159
+ been removed; current Rainbo skills use focused names such as `rainbo-auth`.
160
+
161
+ New Rainbo skills should follow the style in the repository-level
162
+ `skill-template/`: the top-level
163
+ `SKILL.md` acts as a routing and safety rulebook, while detailed command
164
+ families live in `references/*.md`. Authenticated workflow skills should point
165
+ to `rainbo-auth` first instead of duplicating session rules.
166
+
167
+ ## Project layout
168
+
169
+ `packages/rainbo-cli/`:
170
+
171
+ ```text
172
+ rust/ Rust CLI implementation
173
+ Cargo.toml Cargo workspace for the Rust CLI
174
+ packaging/npm/ npm binary bundler and bin launcher
175
+ scripts/ local npm publishing and skill format checks
176
+ ```
177
+
178
+ Repository root:
179
+
180
+ ```text
181
+ skills/ Rainbo skills installable with `npx skills add`
182
+ skill-template/ Template for new Rainbo skills
183
+ ```
package/package.json ADDED
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "rainbo",
3
+ "version": "0.1.0",
4
+ "description": "Rainbo command line tools for data migration workflows",
5
+ "bin": {
6
+ "rainbo": "packaging/npm/run.js"
7
+ },
8
+ "scripts": {
9
+ "build:release": "cargo build --release --workspace",
10
+ "build:npm:local": "node scripts/build-npm-local.js",
11
+ "check:skills": "node scripts/skill-format-check/index.js",
12
+ "pack:npm:local": "npm run build:npm:local && npm pack --dry-run",
13
+ "publish:npm:local": "bash scripts/publish-npm-local.sh",
14
+ "test": "cargo test --workspace && node packaging/npm/run.js version && node packaging/npm/run.js help"
15
+ },
16
+ "os": [
17
+ "darwin",
18
+ "win32"
19
+ ],
20
+ "cpu": [
21
+ "x64",
22
+ "arm64"
23
+ ],
24
+ "engines": {
25
+ "node": ">=16"
26
+ },
27
+ "license": "MIT",
28
+ "files": [
29
+ "packaging/npm/bin",
30
+ "packaging/npm/platform.js",
31
+ "packaging/npm/run.js",
32
+ "README.md",
33
+ "LICENSE"
34
+ ]
35
+ }
@@ -0,0 +1,37 @@
1
+ const PLATFORM_PACKAGES = {
2
+ "darwin-x64": {
3
+ target: "x86_64-apple-darwin",
4
+ binary: "rainbo",
5
+ os: "darwin",
6
+ cpu: "x64",
7
+ archiveExt: ".tar.xz",
8
+ },
9
+ "darwin-arm64": {
10
+ target: "aarch64-apple-darwin",
11
+ binary: "rainbo",
12
+ os: "darwin",
13
+ cpu: "arm64",
14
+ archiveExt: ".tar.xz",
15
+ },
16
+ "win32-x64": {
17
+ target: "x86_64-pc-windows-msvc",
18
+ binary: "rainbo.exe",
19
+ os: "win32",
20
+ cpu: "x64",
21
+ archiveExt: ".zip",
22
+ },
23
+ };
24
+
25
+ function currentPlatformKey() {
26
+ return `${process.platform}-${process.arch}`;
27
+ }
28
+
29
+ function currentPlatformPackage() {
30
+ return PLATFORM_PACKAGES[currentPlatformKey()];
31
+ }
32
+
33
+ module.exports = {
34
+ PLATFORM_PACKAGES,
35
+ currentPlatformKey,
36
+ currentPlatformPackage,
37
+ };
@@ -0,0 +1,57 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { spawnSync } = require("child_process");
4
+ const fs = require("fs");
5
+ const path = require("path");
6
+ const { currentPlatformKey, currentPlatformPackage } = require("./platform");
7
+
8
+ const isWindows = process.platform === "win32";
9
+ const repoRoot = path.join(__dirname, "..", "..");
10
+ const sourceManifest = path.join(repoRoot, "rust", "Cargo.toml");
11
+
12
+ function resolveBundledLauncher() {
13
+ const platformPackage = currentPlatformPackage();
14
+ if (!platformPackage) return null;
15
+ const launcher = path.join(__dirname, "bin", currentPlatformKey(), platformPackage.binary);
16
+ return fs.existsSync(launcher) ? launcher : null;
17
+ }
18
+
19
+ function resolveLauncher() {
20
+ if (fs.existsSync(sourceManifest)) return null;
21
+ const bundledLauncher = resolveBundledLauncher();
22
+ if (bundledLauncher) return bundledLauncher;
23
+ return null;
24
+ }
25
+
26
+ function installIfMissing() {
27
+ if (resolveLauncher() || fs.existsSync(sourceManifest)) return;
28
+ const platformPackage = currentPlatformPackage();
29
+ const packageHint = platformPackage
30
+ ? `${currentPlatformKey()} binary`
31
+ : `unsupported platform ${currentPlatformKey()}`;
32
+ console.error(`rainbo binary package is missing for ${currentPlatformKey()}.`);
33
+ console.error(`Expected bundled npm binary: ${packageHint}`);
34
+ console.error("Rebuild and reinstall the npm package from packages/rainbo-cli.");
35
+ process.exit(1);
36
+ }
37
+
38
+ function recoverWindowsOldLauncher() {
39
+ // Kept as a no-op so older npm-launched processes can upgrade cleanly.
40
+ }
41
+
42
+ recoverWindowsOldLauncher();
43
+ installIfMissing();
44
+
45
+ const useSource = fs.existsSync(sourceManifest);
46
+ const command = useSource ? "cargo" : resolveLauncher();
47
+ const args = useSource
48
+ ? ["run", "--quiet", "--manifest-path", sourceManifest, "--", ...process.argv.slice(2)]
49
+ : process.argv.slice(2);
50
+ if (!command) process.exit(1);
51
+ const result = spawnSync(command, args, { stdio: "inherit", shell: isWindows });
52
+
53
+ if (result.error) {
54
+ console.error(result.error.message);
55
+ process.exit(1);
56
+ }
57
+ process.exit(result.status || 0);