@viraatdas/rudder 2.16.4 → 2.16.6
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 +98 -19
- package/README.md +4 -1
- package/dist/brain.d.ts +1 -0
- package/dist/brain.js +4 -0
- package/dist/brain.js.map +1 -1
- package/dist/cloud.js +184 -3
- package/dist/cloud.js.map +1 -1
- package/dist/native/darwin-arm64/rudder-native +0 -0
- package/dist/native/darwin-x64/rudder-native +0 -0
- package/dist/native/linux-x64/rudder-native +0 -0
- package/dist/planner.js +2 -0
- package/dist/planner.js.map +1 -1
- package/package.json +2 -2
package/LICENSE
CHANGED
|
@@ -1,21 +1,100 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
1
|
Copyright (c) 2026 Viraat Das
|
|
4
2
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
3
|
+
Rudder is source-available under the Elastic License 2.0 (ELv2), below.
|
|
4
|
+
You may use, copy, modify and distribute it under these terms, but you may not
|
|
5
|
+
provide it to third parties as a hosted or managed service, circumvent license
|
|
6
|
+
key functionality, or remove licensing, copyright or other notices.
|
|
7
|
+
|
|
8
|
+
Elastic License 2.0
|
|
9
|
+
|
|
10
|
+
URL: https://www.elastic.co/licensing/elastic-license
|
|
11
|
+
|
|
12
|
+
## Acceptance
|
|
13
|
+
|
|
14
|
+
By using the software, you agree to all of the terms and conditions below.
|
|
15
|
+
|
|
16
|
+
## Copyright License
|
|
17
|
+
|
|
18
|
+
The licensor grants you a non-exclusive, royalty-free, worldwide,
|
|
19
|
+
non-sublicensable, non-transferable license to use, copy, distribute, make
|
|
20
|
+
available, and prepare derivative works of the software, in each case subject to
|
|
21
|
+
the limitations and conditions below.
|
|
22
|
+
|
|
23
|
+
## Limitations
|
|
24
|
+
|
|
25
|
+
You may not provide the software to third parties as a hosted or managed
|
|
26
|
+
service, where the service provides users with access to any substantial set of
|
|
27
|
+
the features or functionality of the software.
|
|
28
|
+
|
|
29
|
+
You may not move, change, disable, or circumvent the license key functionality
|
|
30
|
+
in the software, and you may not remove or obscure any functionality in the
|
|
31
|
+
software that is protected by the license key.
|
|
32
|
+
|
|
33
|
+
You may not alter, remove, or obscure any licensing, copyright, or other notices
|
|
34
|
+
of the licensor in the software. Any use of the licensor’s trademarks is subject
|
|
35
|
+
to applicable law.
|
|
36
|
+
|
|
37
|
+
## Patents
|
|
38
|
+
|
|
39
|
+
The licensor grants you a license, under any patent claims the licensor can
|
|
40
|
+
license, or becomes able to license, to make, have made, use, sell, offer for
|
|
41
|
+
sale, import and have imported the software, in each case subject to the
|
|
42
|
+
limitations and conditions in this license. This license does not cover any
|
|
43
|
+
patent claims that you cause to be infringed by modifications or additions to
|
|
44
|
+
the software. If you or your company make any written claim that the software
|
|
45
|
+
infringes or contributes to infringement of any patent, your patent license for
|
|
46
|
+
the software granted under these terms ends immediately. If your company makes
|
|
47
|
+
such a claim, your patent license ends immediately for work on behalf of your
|
|
48
|
+
company.
|
|
49
|
+
|
|
50
|
+
## Notices
|
|
51
|
+
|
|
52
|
+
You must ensure that anyone who gets a copy of any part of the software from you
|
|
53
|
+
also gets a copy of these terms.
|
|
54
|
+
|
|
55
|
+
If you modify the software, you must include in any modified copies of the
|
|
56
|
+
software prominent notices stating that you have modified the software.
|
|
57
|
+
|
|
58
|
+
## No Other Rights
|
|
59
|
+
|
|
60
|
+
These terms do not imply any licenses other than those expressly granted in
|
|
61
|
+
these terms.
|
|
62
|
+
|
|
63
|
+
## Termination
|
|
64
|
+
|
|
65
|
+
If you use the software in violation of these terms, such use is not licensed,
|
|
66
|
+
and your licenses will automatically terminate. If the licensor provides you
|
|
67
|
+
with a notice of your violation, and you cease all violation of this license no
|
|
68
|
+
later than 30 days after you receive that notice, your licenses will be
|
|
69
|
+
reinstated retroactively. However, if you violate these terms after such
|
|
70
|
+
reinstatement, any additional violation of these terms will cause your licenses
|
|
71
|
+
to terminate automatically and permanently.
|
|
72
|
+
|
|
73
|
+
## No Liability
|
|
74
|
+
|
|
75
|
+
*As far as the law allows, the software comes as is, without any warranty or
|
|
76
|
+
condition, and the licensor will not be liable to you for any damages arising
|
|
77
|
+
out of these terms or the use or nature of the software, under any kind of
|
|
78
|
+
legal claim.*
|
|
79
|
+
|
|
80
|
+
## Definitions
|
|
81
|
+
|
|
82
|
+
The **licensor** is the entity offering these terms, and the **software** is the
|
|
83
|
+
software the licensor makes available under these terms, including any portion
|
|
84
|
+
of it.
|
|
85
|
+
|
|
86
|
+
**you** refers to the individual or entity agreeing to these terms.
|
|
87
|
+
|
|
88
|
+
**your company** is any legal entity, sole proprietorship, or other kind of
|
|
89
|
+
organization that you work for, plus all organizations that have control over,
|
|
90
|
+
are under the control of, or are under common control with that
|
|
91
|
+
organization. **control** means ownership of substantially all the assets of an
|
|
92
|
+
entity, or the power to direct its management and policies by vote, contract, or
|
|
93
|
+
otherwise. Control can be direct or indirect.
|
|
94
|
+
|
|
95
|
+
**your licenses** are all the licenses granted to you for the software under
|
|
96
|
+
these terms.
|
|
97
|
+
|
|
98
|
+
**use** means anything you do with the software requiring one of your licenses.
|
|
99
|
+
|
|
100
|
+
**trademark** means trademarks, service marks, and similar rights.
|
package/README.md
CHANGED
|
@@ -679,4 +679,7 @@ implementation details, see [`AGENTS.md`](./AGENTS.md).
|
|
|
679
679
|
|
|
680
680
|
## License
|
|
681
681
|
|
|
682
|
-
|
|
682
|
+
[Elastic License 2.0](LICENSE) (ELv2). Source-available: you can use, modify and
|
|
683
|
+
redistribute Rudder, but you may not offer it to others as a hosted or managed
|
|
684
|
+
service. Versions published before 2.16.6 were released under MIT and remain
|
|
685
|
+
available under those terms.
|
package/dist/brain.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export declare function loadInstructionFiles(workspace: string, repoRoot?: strin
|
|
|
9
9
|
content: string;
|
|
10
10
|
}>>;
|
|
11
11
|
export declare function createSpec(run: RunRecord): Promise<SpecContract>;
|
|
12
|
+
export declare const PARALLEL_WORK_RULE = "Parallelize independent work. Batch independent reads, searches, and commands into one turn instead of running them one at a time. For independent subtasks (broad codebase searches, separate files or modules, independent verification), spawn concurrent subagents (Claude Code: the Agent/Task tool; Codex: its subagent tools when available), give each a self-contained brief, and merge their results yourself. Never let two subagents edit the same file. Keep steps that share files or depend on earlier results sequential, and verify after merging.";
|
|
12
13
|
export declare function renderContract(spec: SpecContract): string;
|
|
13
14
|
/**
|
|
14
15
|
* Judge one pass. `transcriptFrom` is the byte length `output.txt` had when
|
package/dist/brain.js
CHANGED
|
@@ -72,6 +72,9 @@ export async function createSpec(run) {
|
|
|
72
72
|
await writeJson(specPath(run.repoRoot, run.id), spec);
|
|
73
73
|
return spec;
|
|
74
74
|
}
|
|
75
|
+
// Parallel-work guidance for every implementing agent. Mirrors the Rust
|
|
76
|
+
// `parallel_work_rule!` in native/src/tasks.rs; keep the text in parity.
|
|
77
|
+
export const PARALLEL_WORK_RULE = "Parallelize independent work. Batch independent reads, searches, and commands into one turn instead of running them one at a time. For independent subtasks (broad codebase searches, separate files or modules, independent verification), spawn concurrent subagents (Claude Code: the Agent/Task tool; Codex: its subagent tools when available), give each a self-contained brief, and merge their results yourself. Never let two subagents edit the same file. Keep steps that share files or depend on earlier results sequential, and verify after merging.";
|
|
75
78
|
export function renderContract(spec) {
|
|
76
79
|
const instructions = spec.instructionsFiles
|
|
77
80
|
.map((file) => `### ${file.path}\n${file.content}`)
|
|
@@ -95,6 +98,7 @@ export function renderContract(spec) {
|
|
|
95
98
|
"- Preserve unrelated user changes.",
|
|
96
99
|
"- Run relevant checks when practical and report any checks that could not be run.",
|
|
97
100
|
"- Do not mark the task complete unless the acceptance criteria are handled.",
|
|
101
|
+
`- ${PARALLEL_WORK_RULE}`,
|
|
98
102
|
...PROPAGATION_RULES.map((rule) => `- ${rule}`),
|
|
99
103
|
"",
|
|
100
104
|
instructions ? `Repository instructions:\n\n${instructions}` : "",
|
package/dist/brain.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"brain.js","sourceRoot":"","sources":["../src/brain.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,kBAAkB,CAAC;AACnC,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,aAAa,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AACvG,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AACtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAExF,MAAM,iBAAiB,GAAG,CAAC,WAAW,EAAE,WAAW,EAAE,WAAW,CAAC,CAAC;AAClE,MAAM,sBAAsB,GAAG,MAAM,CAAC;AAEtC,wEAAwE;AACxE,4EAA4E;AAC5E,SAAS,0BAA0B,CAAC,IAAY,EAAE,OAAe;IAC/D,IAAI,OAAO,CAAC,MAAM,IAAI,sBAAsB,EAAE,CAAC;QAC7C,OAAO,OAAO,CAAC;IACjB,CAAC;IACD,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,sBAAsB,CAAC,gBAAgB,IAAI,iBAAiB,sBAAsB,OAAO,OAAO,CAAC,MAAM,gBAAgB,IAAI,kCAAkC,CAAC;AAC3L,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,SAAiB,EACjB,QAAiB;IAEjB,MAAM,iBAAi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,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;YACvC,WAAW,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAChC,CAAC;IACH,CAAC;IACD,OAAO,WAAW,CAAC;AACrB,CAAC"}
|
package/dist/cloud.js
CHANGED
|
@@ -126,6 +126,9 @@ export async function runCloudCommand(command, args, options = {}) {
|
|
|
126
126
|
case "home":
|
|
127
127
|
await homeCommand(rest, options);
|
|
128
128
|
return;
|
|
129
|
+
case "doctor":
|
|
130
|
+
await cloudDoctor(options);
|
|
131
|
+
return;
|
|
129
132
|
case "app":
|
|
130
133
|
case "pair":
|
|
131
134
|
await printAppLink(options);
|
|
@@ -2126,7 +2129,8 @@ async function secretsSync(options) {
|
|
|
2126
2129
|
});
|
|
2127
2130
|
}
|
|
2128
2131
|
}
|
|
2129
|
-
|
|
2132
|
+
const capturedEnv = captureCloudEnv();
|
|
2133
|
+
for (const [name, value] of Object.entries(capturedEnv)) {
|
|
2130
2134
|
items.push({
|
|
2131
2135
|
name,
|
|
2132
2136
|
kind: "env",
|
|
@@ -2134,6 +2138,14 @@ async function secretsSync(options) {
|
|
|
2134
2138
|
source: "sync",
|
|
2135
2139
|
});
|
|
2136
2140
|
}
|
|
2141
|
+
// gh keeps its token in the OS keychain, not in ~/.config/gh/hosts.yml, so
|
|
2142
|
+
// the synced gh config alone cannot clone a private repo in the cloud.
|
|
2143
|
+
if (!capturedEnv.GH_TOKEN && !capturedEnv.GITHUB_TOKEN) {
|
|
2144
|
+
const ghToken = await localGithubToken();
|
|
2145
|
+
if (ghToken) {
|
|
2146
|
+
items.push({ name: "GH_TOKEN", kind: "env", valueBase64: Buffer.from(ghToken, "utf8").toString("base64"), source: "sync" });
|
|
2147
|
+
}
|
|
2148
|
+
}
|
|
2137
2149
|
if (items.length === 0) {
|
|
2138
2150
|
throw new Error("Found nothing to sync: no allowlisted credential files or matching env vars.");
|
|
2139
2151
|
}
|
|
@@ -2733,6 +2745,26 @@ const KITTY_KEYBOARD_POP = "\x1b[<u";
|
|
|
2733
2745
|
function containsCtrlCInput(data) {
|
|
2734
2746
|
return data.includes(0x03) || /\x1b\[99;5(?::[123])?u/.test(data.toString("latin1"));
|
|
2735
2747
|
}
|
|
2748
|
+
// Stay attached through a control-plane deploy or a machine restart: say what
|
|
2749
|
+
// happened and reconnect, instead of dropping back to the shell silently.
|
|
2750
|
+
async function attachWithReconnect(target, options, reopen) {
|
|
2751
|
+
let result = await runAttach(target, { ...options, quietBanner: false });
|
|
2752
|
+
let attempts = 0;
|
|
2753
|
+
while (result === "dropped" && attempts < 40) {
|
|
2754
|
+
attempts += 1;
|
|
2755
|
+
process.stderr.write(`\r\nLost the connection to Rudder Cloud (it may be restarting). Reconnecting${attempts > 1 ? ` (try ${attempts})` : ""}...\r\n`);
|
|
2756
|
+
await sleep(Math.min(15_000, 2_000 * attempts));
|
|
2757
|
+
try {
|
|
2758
|
+
await reopen?.();
|
|
2759
|
+
result = await runAttach(target, { ...options, quietBanner: true });
|
|
2760
|
+
attempts = 0;
|
|
2761
|
+
}
|
|
2762
|
+
catch {
|
|
2763
|
+
result = "dropped";
|
|
2764
|
+
}
|
|
2765
|
+
}
|
|
2766
|
+
return result;
|
|
2767
|
+
}
|
|
2736
2768
|
async function runAttach(target, options) {
|
|
2737
2769
|
const client = await cloudClient({ requireToken: true });
|
|
2738
2770
|
const baseUrl = client.baseUrl;
|
|
@@ -2762,6 +2794,14 @@ async function runAttach(target, options) {
|
|
|
2762
2794
|
perMessageDeflate: false,
|
|
2763
2795
|
});
|
|
2764
2796
|
socket.binaryType = "nodebuffer";
|
|
2797
|
+
// Every deliberate close goes through socket.close() from this side; any
|
|
2798
|
+
// other close is the far end going away.
|
|
2799
|
+
let closedByUs = false;
|
|
2800
|
+
const closeSocket = socket.close.bind(socket);
|
|
2801
|
+
socket.close = ((code, reason) => {
|
|
2802
|
+
closedByUs = true;
|
|
2803
|
+
closeSocket(code, reason);
|
|
2804
|
+
});
|
|
2765
2805
|
let opened = false;
|
|
2766
2806
|
let cleaned = false;
|
|
2767
2807
|
let firstFrameRendered = false;
|
|
@@ -3141,7 +3181,8 @@ async function runAttach(target, options) {
|
|
|
3141
3181
|
reject(new Error(`Cloud attach failed (code ${code}${reasonText ? `: ${reasonText}` : ""})`));
|
|
3142
3182
|
return;
|
|
3143
3183
|
}
|
|
3144
|
-
|
|
3184
|
+
// 4410: the workspace was deleted; nothing to come back to.
|
|
3185
|
+
resolve(!closedByUs && code !== 4410 && code !== 1000 ? "dropped" : result);
|
|
3145
3186
|
});
|
|
3146
3187
|
socket.on("error", (err) => {
|
|
3147
3188
|
if (!opened) {
|
|
@@ -3368,6 +3409,9 @@ Usage:
|
|
|
3368
3409
|
rudder cloud home [status|start|stop|open <owner/repo>]
|
|
3369
3410
|
rudder cloud app
|
|
3370
3411
|
a one-time code that signs the phone app in to this account
|
|
3412
|
+
rudder cloud doctor
|
|
3413
|
+
do the cloud machine's GitHub, Claude and Codex logins work, as the same
|
|
3414
|
+
accounts as this laptop? names the fix for anything that differs
|
|
3371
3415
|
rudder cloud login [--github]
|
|
3372
3416
|
signs in with Google (or GitHub)
|
|
3373
3417
|
rudder cloud help
|
|
@@ -3483,6 +3527,7 @@ async function openOnHome(forceSnapshot, options) {
|
|
|
3483
3527
|
const name = slug.split("/")[1];
|
|
3484
3528
|
if (!options.json) {
|
|
3485
3529
|
await warnLocalOnlyWork(repoRoot);
|
|
3530
|
+
await ensureVaultGithubToken(client, slug);
|
|
3486
3531
|
await offerEnvFilesToVault(client, repoRoot, name);
|
|
3487
3532
|
process.stderr.write(`Opening ${slug} on your home machine...\n`);
|
|
3488
3533
|
}
|
|
@@ -3507,7 +3552,11 @@ async function openOnHome(forceSnapshot, options) {
|
|
|
3507
3552
|
return;
|
|
3508
3553
|
}
|
|
3509
3554
|
process.stderr.write(`Phone: ${appUrl(client.baseUrl)}\n`);
|
|
3510
|
-
await
|
|
3555
|
+
await reportCredentialParity(client, { problemsOnly: true }).catch(() => undefined);
|
|
3556
|
+
await attachWithReconnect({ kind: "workspace", id: workspaceId, label: `${name} on home` }, options, async () => {
|
|
3557
|
+
// Wake the machine again if it was what went away.
|
|
3558
|
+
await client.request("/api/rudder/home/open", { method: "POST", body: { repo: slug, ...(branch ? { branch } : {}) } });
|
|
3559
|
+
});
|
|
3511
3560
|
}
|
|
3512
3561
|
// The cloud clones from GitHub, so anything not pushed is not there. Say so
|
|
3513
3562
|
// plainly; it is a warning, not a gate.
|
|
@@ -3541,6 +3590,132 @@ async function warnLocalOnlyWork(repoRoot) {
|
|
|
3541
3590
|
process.stderr.write(`Heads up: ${parts.join(", ")}. The cloud clones from GitHub, so it won't see that. Push first, or use \`rudder cloud --snapshot\` to upload this folder instead.\n`);
|
|
3542
3591
|
}
|
|
3543
3592
|
}
|
|
3593
|
+
async function localGithubToken() {
|
|
3594
|
+
if (!commandExists("gh")) {
|
|
3595
|
+
return null;
|
|
3596
|
+
}
|
|
3597
|
+
const result = await runCommand("gh", ["auth", "token"], { allowFailure: true });
|
|
3598
|
+
const token = result.stdout.trim();
|
|
3599
|
+
return result.code === 0 && /^(gh[opsu]_|github_pat_)[A-Za-z0-9_]+$/.test(token) ? token : null;
|
|
3600
|
+
}
|
|
3601
|
+
// The cloud machine clones from GitHub, so a private repo needs a GitHub token
|
|
3602
|
+
// in the vault. gh keeps its token in the OS keychain (hosts.yml has none), so
|
|
3603
|
+
// it never arrived with the synced gh config; offer to put it there.
|
|
3604
|
+
async function ensureVaultGithubToken(client, slug) {
|
|
3605
|
+
const vault = await client.request("/api/rudder/secrets", { method: "GET" }).catch(() => null);
|
|
3606
|
+
if (!vault || (vault.secrets ?? []).some((secret) => secret.name === "GH_TOKEN" || secret.name === "GITHUB_TOKEN")) {
|
|
3607
|
+
return;
|
|
3608
|
+
}
|
|
3609
|
+
const token = await localGithubToken();
|
|
3610
|
+
if (!token) {
|
|
3611
|
+
process.stderr.write(`The cloud vault has no GitHub token, so private repos can't be cloned there. Run \`gh auth login\` here, or \`rudder cloud secrets set GH_TOKEN\`.\n`);
|
|
3612
|
+
return;
|
|
3613
|
+
}
|
|
3614
|
+
if (!isTty()) {
|
|
3615
|
+
process.stderr.write("The cloud vault has no GitHub token; private repos will fail to clone. Run `rudder cloud secrets sync` from a terminal.\n");
|
|
3616
|
+
return;
|
|
3617
|
+
}
|
|
3618
|
+
const yes = await promptConfirm(`The cloud machine needs GitHub access to clone ${slug} (and to push branches and open PRs). Copy your GitHub CLI token into the cloud vault?`, true);
|
|
3619
|
+
if (!yes) {
|
|
3620
|
+
return;
|
|
3621
|
+
}
|
|
3622
|
+
await client.request("/api/rudder/secrets/item", {
|
|
3623
|
+
method: "PUT",
|
|
3624
|
+
body: { name: "GH_TOKEN", kind: "env", valueBase64: Buffer.from(token, "utf8").toString("base64"), source: "rudder cloud" },
|
|
3625
|
+
});
|
|
3626
|
+
process.stderr.write("Stored GH_TOKEN in the cloud vault.\n");
|
|
3627
|
+
}
|
|
3628
|
+
async function localIdentities() {
|
|
3629
|
+
const [github, claude] = await Promise.all([
|
|
3630
|
+
commandExists("gh")
|
|
3631
|
+
? runCommand("gh", ["api", "user", "--jq", ".login"], { allowFailure: true }).then((r) => (r.code === 0 ? r.stdout.trim() || null : null))
|
|
3632
|
+
: Promise.resolve(null),
|
|
3633
|
+
commandExists("claude")
|
|
3634
|
+
? runCommand("claude", ["auth", "status", "--json"], { allowFailure: true }).then((r) => {
|
|
3635
|
+
try {
|
|
3636
|
+
const parsed = JSON.parse(r.stdout);
|
|
3637
|
+
return parsed.loggedIn ? parsed.email ?? "logged in" : null;
|
|
3638
|
+
}
|
|
3639
|
+
catch {
|
|
3640
|
+
return null;
|
|
3641
|
+
}
|
|
3642
|
+
})
|
|
3643
|
+
: Promise.resolve(null),
|
|
3644
|
+
]);
|
|
3645
|
+
let codex = null;
|
|
3646
|
+
try {
|
|
3647
|
+
const auth = JSON.parse(await fsp.readFile(path.join(os.homedir(), ".codex", "auth.json"), "utf8"));
|
|
3648
|
+
const payload = (auth.tokens?.id_token ?? "").split(".")[1];
|
|
3649
|
+
codex = payload ? JSON.parse(Buffer.from(payload, "base64url").toString("utf8")).email ?? null : null;
|
|
3650
|
+
}
|
|
3651
|
+
catch {
|
|
3652
|
+
codex = null;
|
|
3653
|
+
}
|
|
3654
|
+
return { github, claude, codex };
|
|
3655
|
+
}
|
|
3656
|
+
const CREDENTIAL_FIXES = {
|
|
3657
|
+
github: "run `rudder cloud` in a repo here (it offers to copy `gh auth token` into the vault)",
|
|
3658
|
+
claude: "run `rudder cloud`, then `/login` in a Claude pane there (the cloud keeps its own login)",
|
|
3659
|
+
codex: "run `rudder cloud`, then `$ codex login --device-auth` in the task pane there",
|
|
3660
|
+
};
|
|
3661
|
+
async function credentialParity(client) {
|
|
3662
|
+
const [local, home] = await Promise.all([
|
|
3663
|
+
localIdentities(),
|
|
3664
|
+
client.request("/api/rudder/home", { method: "GET" }),
|
|
3665
|
+
]);
|
|
3666
|
+
const cloud = home.home?.credentials ?? null;
|
|
3667
|
+
const rows = ["github", "claude", "codex"].map((tool) => {
|
|
3668
|
+
const remote = cloud?.[tool] ?? null;
|
|
3669
|
+
const mine = local[tool];
|
|
3670
|
+
if (!remote) {
|
|
3671
|
+
return { tool, local: mine, cloud: null, status: "unknown" };
|
|
3672
|
+
}
|
|
3673
|
+
if (!remote.ok) {
|
|
3674
|
+
// ENOENT: the CLI was being updated when the machine checked; it rechecks.
|
|
3675
|
+
const fix = /ENOENT/.test(remote.detail ?? "")
|
|
3676
|
+
? `${tool} was updating when the cloud checked; run \`rudder cloud doctor\` again in a minute`
|
|
3677
|
+
: CREDENTIAL_FIXES[tool];
|
|
3678
|
+
return { tool, local: mine, cloud: remote, status: mine ? "missing" : "unknown", fix };
|
|
3679
|
+
}
|
|
3680
|
+
if (mine && remote.account && remote.account.toLowerCase() !== mine.toLowerCase()) {
|
|
3681
|
+
return { tool, local: mine, cloud: remote, status: "different", fix: CREDENTIAL_FIXES[tool] };
|
|
3682
|
+
}
|
|
3683
|
+
return { tool, local: mine, cloud: remote, status: "match" };
|
|
3684
|
+
});
|
|
3685
|
+
return { rows, checkedAt: typeof cloud?.checkedAt === "string" ? cloud.checkedAt : null };
|
|
3686
|
+
}
|
|
3687
|
+
async function reportCredentialParity(client, { problemsOnly }) {
|
|
3688
|
+
const { rows, checkedAt } = await credentialParity(client);
|
|
3689
|
+
const problems = rows.filter((row) => row.status === "missing" || row.status === "different");
|
|
3690
|
+
if (problemsOnly && problems.length === 0) {
|
|
3691
|
+
return 0;
|
|
3692
|
+
}
|
|
3693
|
+
const label = (tool) => ({ github: "GitHub", claude: "Claude", codex: "Codex" })[tool] ?? tool;
|
|
3694
|
+
for (const row of problemsOnly ? problems : rows) {
|
|
3695
|
+
const here = row.local ?? "not logged in";
|
|
3696
|
+
const there = row.cloud ? (row.cloud.ok ? row.cloud.account ?? "logged in" : `not working (${row.cloud.detail ?? "unknown"})`) : "not checked yet";
|
|
3697
|
+
const mark = row.status === "match" ? "✓" : row.status === "unknown" ? "·" : row.status === "different" ? "⚠" : "✗";
|
|
3698
|
+
process.stderr.write(`${mark} ${label(row.tool).padEnd(7)} here: ${here} cloud: ${there}\n`);
|
|
3699
|
+
if (row.fix) {
|
|
3700
|
+
process.stderr.write(` fix: ${row.fix}\n`);
|
|
3701
|
+
}
|
|
3702
|
+
}
|
|
3703
|
+
if (!problemsOnly && !checkedAt) {
|
|
3704
|
+
process.stderr.write("The home machine has not finished checking its logins yet; try again in a minute.\n");
|
|
3705
|
+
}
|
|
3706
|
+
return problems.length;
|
|
3707
|
+
}
|
|
3708
|
+
async function cloudDoctor(options) {
|
|
3709
|
+
const client = await cloudClient({ requireToken: true });
|
|
3710
|
+
if (options.json) {
|
|
3711
|
+
printJson((await credentialParity(client)));
|
|
3712
|
+
return;
|
|
3713
|
+
}
|
|
3714
|
+
const problems = await reportCredentialParity(client, { problemsOnly: false });
|
|
3715
|
+
if (problems > 0) {
|
|
3716
|
+
process.exitCode = 1;
|
|
3717
|
+
}
|
|
3718
|
+
}
|
|
3544
3719
|
// The current branch, if GitHub has it; otherwise the default branch is used.
|
|
3545
3720
|
async function pushedBranch(repoRoot) {
|
|
3546
3721
|
const branch = (await runCommand("git", ["rev-parse", "--abbrev-ref", "HEAD"], { cwd: repoRoot, allowFailure: true })).stdout.trim();
|
|
@@ -3638,6 +3813,12 @@ async function printAppLink(options) {
|
|
|
3638
3813
|
async function homeCommand(args, options) {
|
|
3639
3814
|
const client = await cloudClient({ requireToken: true });
|
|
3640
3815
|
const sub = args[0] ?? "status";
|
|
3816
|
+
// An agent on the home machine stopping it would kill itself and every other
|
|
3817
|
+
// agent there mid-task (and a "restart" from inside never gets to the start
|
|
3818
|
+
// half). Restarts come from a laptop or the phone.
|
|
3819
|
+
if (sub === "stop" && process.env.RUDDER_CLOUD_RUNTIME === "home" && !options.yes) {
|
|
3820
|
+
throw new Error("refusing to stop the home machine from inside it: that ends this session and every agent on it. Run it from your laptop or the phone (or pass --force).");
|
|
3821
|
+
}
|
|
3641
3822
|
if (sub === "start" || sub === "stop") {
|
|
3642
3823
|
const result = await client.request(`/api/rudder/home/${sub}`, { method: "POST", body: {} });
|
|
3643
3824
|
if (options.json) {
|