@rafay99/cvx 0.12.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/cvx.1 +105 -0
- package/launcher.js +30 -0
- package/package.json +19 -0
package/cvx.1
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
.TH CVX 1 "2026" "convex-switch" "User Commands"
|
|
2
|
+
.SH NAME
|
|
3
|
+
cvx \- switch Convex accounts per project, automatically
|
|
4
|
+
.SH SYNOPSIS
|
|
5
|
+
.B cvx
|
|
6
|
+
.I command
|
|
7
|
+
.RI [ args ]
|
|
8
|
+
.SH DESCRIPTION
|
|
9
|
+
.B convex-switch
|
|
10
|
+
(\fBcvx\fR) lets you run several Convex accounts across many projects at once
|
|
11
|
+
without logging in and out. The Convex CLI reads your identity from a single
|
|
12
|
+
global file, \fI~/.convex/config.json\fR; \fBcvx\fR keeps a private vault of
|
|
13
|
+
your account tokens and a map of project \(-> account, then rewrites that one
|
|
14
|
+
file to the linked account whenever you \fBcd\fR into a project (via a zsh
|
|
15
|
+
\fBchpwd\fR hook). No deploy keys, and no tokens are stored inside your
|
|
16
|
+
repositories.
|
|
17
|
+
.PP
|
|
18
|
+
Because a running \fBconvex dev\fR caches its deployment credentials at startup,
|
|
19
|
+
swapping the global file afterwards does not disturb sessions already running \(em
|
|
20
|
+
so several accounts can run side by side in separate terminals.
|
|
21
|
+
.SH COMMANDS
|
|
22
|
+
.SS Setup
|
|
23
|
+
.TP
|
|
24
|
+
.B cvx add \fR[\fIname\fR] [\fB--token\fR \fIvalue\fR] [\fB--force\fR]
|
|
25
|
+
Store the login currently in \fI~/.convex/config.json\fR as an account. The token
|
|
26
|
+
is verified against Convex; if \fIname\fR is omitted the team slug is used.
|
|
27
|
+
.TP
|
|
28
|
+
.B cvx login \fIname\fR
|
|
29
|
+
Force a fresh browser sign-in (\fBconvex login --force\fR), then store it as
|
|
30
|
+
\fIname\fR. Use this to add a second or third account.
|
|
31
|
+
.SS Wire projects to accounts
|
|
32
|
+
.TP
|
|
33
|
+
.B cvx link \fIaccount\fR \fR[\fIpath\fR]
|
|
34
|
+
Link a project directory (default: the current directory) to an account. One
|
|
35
|
+
account may be linked to many projects.
|
|
36
|
+
.TP
|
|
37
|
+
.B cvx unlink \fR[\fIpath\fR]
|
|
38
|
+
Remove a link.
|
|
39
|
+
.TP
|
|
40
|
+
.B cvx hook \fR[\fB--install\fR]
|
|
41
|
+
Print the zsh cd-hook, or with \fB--install\fR append it to \fI~/.zshrc\fR.
|
|
42
|
+
.SS Everyday
|
|
43
|
+
.TP
|
|
44
|
+
.B cvx activate \fR[\fB-q\fR] [\fIpath\fR]
|
|
45
|
+
Activate the account linked to a directory by rewriting the global config. The
|
|
46
|
+
shell hook calls this on every \fBcd\fR; \fB-q\fR silences the "nothing to do"
|
|
47
|
+
cases.
|
|
48
|
+
.TP
|
|
49
|
+
.B cvx status
|
|
50
|
+
Show the active account and the current directory's link.
|
|
51
|
+
.TP
|
|
52
|
+
.B cvx accounts
|
|
53
|
+
List stored accounts; the active one is marked.
|
|
54
|
+
.TP
|
|
55
|
+
.B cvx ls
|
|
56
|
+
List linked projects; the current directory is marked.
|
|
57
|
+
.TP
|
|
58
|
+
.B cvx which \fR[\fIpath\fR]
|
|
59
|
+
Print the account name for a directory (exit 1 if none). For scripting.
|
|
60
|
+
.SS Manage
|
|
61
|
+
.TP
|
|
62
|
+
.B cvx rm \fIaccount\fR
|
|
63
|
+
Forget an account and any links pointing at it.
|
|
64
|
+
.TP
|
|
65
|
+
.B cvx welcome
|
|
66
|
+
Show the welcome screen again.
|
|
67
|
+
.TP
|
|
68
|
+
.B cvx version
|
|
69
|
+
Print the version.
|
|
70
|
+
.TP
|
|
71
|
+
.B cvx help
|
|
72
|
+
Show the full command reference.
|
|
73
|
+
.SH FILES
|
|
74
|
+
.TP
|
|
75
|
+
.I ~/.convex-switch/accounts.json
|
|
76
|
+
Stored account tokens (chmod 600).
|
|
77
|
+
.TP
|
|
78
|
+
.I ~/.convex-switch/links.json
|
|
79
|
+
Project \(-> account map (chmod 600).
|
|
80
|
+
.TP
|
|
81
|
+
.I ~/.convex/config.json
|
|
82
|
+
The Convex CLI's global login, which \fBcvx\fR rewrites.
|
|
83
|
+
.SH ENVIRONMENT
|
|
84
|
+
.TP
|
|
85
|
+
.B NO_COLOR
|
|
86
|
+
Disable colored output.
|
|
87
|
+
.SH EXAMPLES
|
|
88
|
+
.PP
|
|
89
|
+
Add two accounts and wire up projects:
|
|
90
|
+
.PP
|
|
91
|
+
.RS
|
|
92
|
+
.nf
|
|
93
|
+
cvx login personal
|
|
94
|
+
cvx login work
|
|
95
|
+
cd ~/Code/app-a && cvx link personal
|
|
96
|
+
cd ~/Code/app-b && cvx link work
|
|
97
|
+
cvx hook --install && exec zsh
|
|
98
|
+
.fi
|
|
99
|
+
.RE
|
|
100
|
+
.SH SEE ALSO
|
|
101
|
+
.BR convex (1)
|
|
102
|
+
.PP
|
|
103
|
+
Project home: https://github.com/rafay99-epic/convex-switch
|
|
104
|
+
.SH AUTHOR
|
|
105
|
+
Abdul Rafay
|
package/launcher.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
/**
|
|
4
|
+
* Launcher for the `convex-switch` npm package. The actual `cvx` binary is
|
|
5
|
+
* shipped inside a per-platform package (convex-switch-<os>-<arch>) selected by
|
|
6
|
+
* npm/bun/pnpm via `os`/`cpu`. This shim resolves that binary and execs it —
|
|
7
|
+
* no postinstall, so it works even under `bun add -g` and `--ignore-scripts`.
|
|
8
|
+
*/
|
|
9
|
+
const { spawnSync } = require("child_process");
|
|
10
|
+
|
|
11
|
+
const target = `@rafay99/cvx-${process.platform}-${process.arch}`;
|
|
12
|
+
|
|
13
|
+
let binary;
|
|
14
|
+
try {
|
|
15
|
+
binary = require.resolve(`${target}/bin/cvx`);
|
|
16
|
+
} catch {
|
|
17
|
+
console.error(
|
|
18
|
+
`cvx: no prebuilt binary for ${process.platform}-${process.arch}.\n` +
|
|
19
|
+
`Supported: darwin-arm64, darwin-x64, linux-x64, linux-arm64.\n` +
|
|
20
|
+
`If your platform is supported, reinstall without --no-optional.`,
|
|
21
|
+
);
|
|
22
|
+
process.exit(1);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const res = spawnSync(binary, process.argv.slice(2), { stdio: "inherit" });
|
|
26
|
+
if (res.error) {
|
|
27
|
+
console.error(res.error.message);
|
|
28
|
+
process.exit(1);
|
|
29
|
+
}
|
|
30
|
+
process.exit(res.status === null ? 1 : res.status);
|
package/package.json
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@rafay99/cvx",
|
|
3
|
+
"version": "0.12.0",
|
|
4
|
+
"description": "Switch Convex accounts per project automatically — no deploy keys, no tokens in repos",
|
|
5
|
+
"keywords": ["convex", "cli", "accounts", "multi-account", "workspace"],
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"homepage": "https://github.com/rafay99-epic/convex-switch",
|
|
8
|
+
"repository": "https://github.com/rafay99-epic/convex-switch",
|
|
9
|
+
"bin": { "cvx": "launcher.js" },
|
|
10
|
+
"man": ["cvx.1"],
|
|
11
|
+
"files": ["launcher.js", "cvx.1"],
|
|
12
|
+
"engines": { "node": ">=16" },
|
|
13
|
+
"optionalDependencies": {
|
|
14
|
+
"@rafay99/cvx-darwin-arm64": "0.12.0",
|
|
15
|
+
"@rafay99/cvx-darwin-x64": "0.12.0",
|
|
16
|
+
"@rafay99/cvx-linux-x64": "0.12.0",
|
|
17
|
+
"@rafay99/cvx-linux-arm64": "0.12.0"
|
|
18
|
+
}
|
|
19
|
+
}
|