@tryarcanist/cli 0.1.362 → 0.1.364
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/dist/index.js +45 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -7409,7 +7409,7 @@ function isTerminalPhase(phase, _sessionKind) {
|
|
|
7409
7409
|
// package.json
|
|
7410
7410
|
var package_default = {
|
|
7411
7411
|
name: "@tryarcanist/cli",
|
|
7412
|
-
version: "0.1.
|
|
7412
|
+
version: "0.1.364",
|
|
7413
7413
|
description: "Command-line interface for Arcanist: inspect sessions, prepare Zeus environments, and trigger reviews",
|
|
7414
7414
|
type: "module",
|
|
7415
7415
|
bin: {
|
|
@@ -28040,6 +28040,42 @@ function nextAction(state) {
|
|
|
28040
28040
|
}
|
|
28041
28041
|
return "wait";
|
|
28042
28042
|
}
|
|
28043
|
+
function environmentCoversRepo(environment, repo) {
|
|
28044
|
+
const covered = environment.repos?.length ? environment.repos : [{ repoOwner: environment.repoOwner, repoName: environment.repoName }];
|
|
28045
|
+
return covered.some(
|
|
28046
|
+
(entry) => entry.repoOwner.toLowerCase() === repo.owner.toLowerCase() && entry.repoName.toLowerCase() === repo.repo.toLowerCase()
|
|
28047
|
+
);
|
|
28048
|
+
}
|
|
28049
|
+
async function fetchBrowserLoginStatus(config2, repo) {
|
|
28050
|
+
let environments2;
|
|
28051
|
+
try {
|
|
28052
|
+
const response = await apiFetch(
|
|
28053
|
+
config2,
|
|
28054
|
+
"/api/environments"
|
|
28055
|
+
);
|
|
28056
|
+
environments2 = response.data.environments;
|
|
28057
|
+
} catch {
|
|
28058
|
+
return null;
|
|
28059
|
+
}
|
|
28060
|
+
const environment = environments2.find((item) => item.scope === "team" && environmentCoversRepo(item, repo));
|
|
28061
|
+
if (!environment) return null;
|
|
28062
|
+
const command = `arcanist environments login ${environment.repoOwner}/${environment.repoName}`;
|
|
28063
|
+
const summary = environment.browserState;
|
|
28064
|
+
if (!summary) return { state: "none", capturedAt: null, command };
|
|
28065
|
+
if (summary.reloginNeeded) return { state: "expired", capturedAt: summary.capturedAt, command };
|
|
28066
|
+
if (!summary.lastVerifiedAt) return { state: "unverified", capturedAt: summary.capturedAt, command: null };
|
|
28067
|
+
return { state: "ready", capturedAt: summary.capturedAt, command: null };
|
|
28068
|
+
}
|
|
28069
|
+
function printBrowserLogin(status) {
|
|
28070
|
+
if (!status) return;
|
|
28071
|
+
const label = {
|
|
28072
|
+
none: "not captured",
|
|
28073
|
+
ready: "ready",
|
|
28074
|
+
expired: "expired",
|
|
28075
|
+
unverified: "captured, not verified yet"
|
|
28076
|
+
}[status.state];
|
|
28077
|
+
console.log(`browser login: ${label}${status.command ? ` (run: ${sanitizeTerminalText(status.command)})` : ""}`);
|
|
28078
|
+
}
|
|
28043
28079
|
function printState(state) {
|
|
28044
28080
|
const detail = state.failureReason ?? state.stage ?? state.buildStatus ?? state.nextAction;
|
|
28045
28081
|
console.log(
|
|
@@ -28073,7 +28109,11 @@ async function environmentStatusCommand(repoArg, options = {}, command) {
|
|
|
28073
28109
|
const { config: config2 } = resolveBusinessContext(command, options);
|
|
28074
28110
|
await apiFetch(config2, "/api/repos");
|
|
28075
28111
|
const state = options.wait ? await waitForSetup(config2, repo.fullName, pollIntervalMs ?? SETUP_POLL_INTERVAL_MS) : await fetchSetupState(config2, repo.fullName);
|
|
28076
|
-
|
|
28112
|
+
const browserLogin = await fetchBrowserLoginStatus(config2, repo);
|
|
28113
|
+
emit(command, options, { repository: state, browserLogin }, ({ repository, browserLogin: login }) => {
|
|
28114
|
+
printState(repository);
|
|
28115
|
+
printBrowserLogin(login);
|
|
28116
|
+
});
|
|
28077
28117
|
}
|
|
28078
28118
|
async function environmentPrepareCommand(repoArg, options = {}, command) {
|
|
28079
28119
|
const pollIntervalMs = options.wait ? parsePollInterval(options.pollInterval, { defaultMs: SETUP_POLL_INTERVAL_MS, maxMs: null }) : null;
|
|
@@ -32575,7 +32615,9 @@ environments.command("status").description("Show repository environment setup st
|
|
|
32575
32615
|
"after",
|
|
32576
32616
|
`
|
|
32577
32617
|
JSON:
|
|
32578
|
-
Returns {repository: {fullName, status, stage, nextAction, command, buildStatus?, failureReason?, secretRequest?, question?}}.
|
|
32618
|
+
Returns {repository: {fullName, status, stage, nextAction, command, buildStatus?, failureReason?, secretRequest?, question?}, browserLogin}.
|
|
32619
|
+
browserLogin is {state, capturedAt, command} for the repository's team environment, or null when there is none.
|
|
32620
|
+
The stable browserLogin state values are none, ready, expired, and unverified.
|
|
32579
32621
|
command is the CLI argv to run, or null when the next step is the web UI or Arcanist.
|
|
32580
32622
|
The stable status values are not_started, pending, running, escalated, succeeded, failed, and ready.
|
|
32581
32623
|
`
|