replicas-cli 0.2.239 → 0.2.241
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.mjs +436 -391
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -7335,7 +7335,7 @@ var require_dist = __commonJS({
|
|
|
7335
7335
|
// src/index.ts
|
|
7336
7336
|
import "dotenv/config";
|
|
7337
7337
|
import { Command, InvalidArgumentError } from "commander";
|
|
7338
|
-
import
|
|
7338
|
+
import chalk23 from "chalk";
|
|
7339
7339
|
|
|
7340
7340
|
// src/commands/login.ts
|
|
7341
7341
|
import http from "http";
|
|
@@ -7447,6 +7447,9 @@ function readAgentConfig() {
|
|
|
7447
7447
|
}
|
|
7448
7448
|
}
|
|
7449
7449
|
|
|
7450
|
+
// src/lib/auth.ts
|
|
7451
|
+
import { isAuthError, isAuthRetryableFetchError } from "@supabase/supabase-js";
|
|
7452
|
+
|
|
7450
7453
|
// src/lib/supabase.ts
|
|
7451
7454
|
import { createClient } from "@supabase/supabase-js";
|
|
7452
7455
|
var supabaseUrl = process.env.REPLICAS_SUPABASE_URL || "https://mxeqiomwgdgaesecwtct.supabase.co";
|
|
@@ -7459,6 +7462,21 @@ var supabase = createClient(supabaseUrl, supabaseAnonKey, {
|
|
|
7459
7462
|
});
|
|
7460
7463
|
|
|
7461
7464
|
// src/lib/auth.ts
|
|
7465
|
+
var AuthRefreshError = class extends Error {
|
|
7466
|
+
constructor(message = 'Failed to refresh token. Please run "replicas login" again.') {
|
|
7467
|
+
super(message);
|
|
7468
|
+
this.name = "AuthRefreshError";
|
|
7469
|
+
}
|
|
7470
|
+
};
|
|
7471
|
+
var NotAuthenticatedError = class extends Error {
|
|
7472
|
+
constructor(message = 'Not authenticated. Please run "replicas login"') {
|
|
7473
|
+
super(message);
|
|
7474
|
+
this.name = "NotAuthenticatedError";
|
|
7475
|
+
}
|
|
7476
|
+
};
|
|
7477
|
+
function isReplicasAuthError(error) {
|
|
7478
|
+
return error instanceof AuthRefreshError || error instanceof NotAuthenticatedError;
|
|
7479
|
+
}
|
|
7462
7480
|
function isTokenExpired(expiresAt) {
|
|
7463
7481
|
const now = Math.floor(Date.now() / 1e3);
|
|
7464
7482
|
return expiresAt - now < 60;
|
|
@@ -7466,34 +7484,40 @@ function isTokenExpired(expiresAt) {
|
|
|
7466
7484
|
async function refreshToken() {
|
|
7467
7485
|
const config2 = readConfig();
|
|
7468
7486
|
if (!config2) {
|
|
7469
|
-
throw new
|
|
7487
|
+
throw new NotAuthenticatedError();
|
|
7470
7488
|
}
|
|
7489
|
+
let session;
|
|
7471
7490
|
try {
|
|
7472
7491
|
const { data, error } = await supabase.auth.refreshSession({
|
|
7473
7492
|
refresh_token: config2.refresh_token
|
|
7474
7493
|
});
|
|
7475
7494
|
if (error) throw error;
|
|
7476
|
-
if (!data.session) throw new
|
|
7477
|
-
|
|
7478
|
-
...config2,
|
|
7479
|
-
access_token: data.session.access_token,
|
|
7480
|
-
refresh_token: data.session.refresh_token,
|
|
7481
|
-
expires_at: data.session.expires_at || 0
|
|
7482
|
-
});
|
|
7495
|
+
if (!data.session) throw new AuthRefreshError();
|
|
7496
|
+
session = data.session;
|
|
7483
7497
|
} catch (error) {
|
|
7484
|
-
|
|
7498
|
+
if (error instanceof AuthRefreshError) throw error;
|
|
7499
|
+
if (isAuthError(error) && !isAuthRetryableFetchError(error)) {
|
|
7500
|
+
throw new AuthRefreshError();
|
|
7501
|
+
}
|
|
7502
|
+
throw error;
|
|
7485
7503
|
}
|
|
7504
|
+
writeConfig({
|
|
7505
|
+
...config2,
|
|
7506
|
+
access_token: session.access_token,
|
|
7507
|
+
refresh_token: session.refresh_token,
|
|
7508
|
+
expires_at: session.expires_at || 0
|
|
7509
|
+
});
|
|
7486
7510
|
}
|
|
7487
7511
|
async function getValidToken() {
|
|
7488
7512
|
const config2 = readConfig();
|
|
7489
7513
|
if (!config2) {
|
|
7490
|
-
throw new
|
|
7514
|
+
throw new NotAuthenticatedError();
|
|
7491
7515
|
}
|
|
7492
7516
|
if (isTokenExpired(config2.expires_at)) {
|
|
7493
7517
|
await refreshToken();
|
|
7494
7518
|
const newConfig = readConfig();
|
|
7495
7519
|
if (!newConfig) {
|
|
7496
|
-
throw new
|
|
7520
|
+
throw new AuthRefreshError();
|
|
7497
7521
|
}
|
|
7498
7522
|
return newConfig.access_token;
|
|
7499
7523
|
}
|
|
@@ -9118,7 +9142,7 @@ var HOOK_EXEC_MAX_BUFFER_BYTES = 10 * 1024 * 1024;
|
|
|
9118
9142
|
var REPLICAS_CONFIG_FILENAMES = ["replicas.json", "replicas.yaml", "replicas.yml"];
|
|
9119
9143
|
|
|
9120
9144
|
// ../shared/src/cli-version.ts
|
|
9121
|
-
var CLI_VERSION = "0.2.
|
|
9145
|
+
var CLI_VERSION = "0.2.241";
|
|
9122
9146
|
|
|
9123
9147
|
// ../shared/src/engine/environment.ts
|
|
9124
9148
|
var DESKTOP_NOVNC_PORT = 6080;
|
|
@@ -9222,12 +9246,11 @@ function workspaceConfigWithPrFollowups(config2, prFollowups = config2?.capabili
|
|
|
9222
9246
|
}
|
|
9223
9247
|
var WORKSPACE_FILE_UPLOAD_MAX_SIZE_BYTES = 20 * 1024 * 1024;
|
|
9224
9248
|
var WORKSPACE_FILE_CONTENT_MAX_SIZE_BYTES = 1 * 1024 * 1024;
|
|
9225
|
-
var WORKSPACE_SIDEBAR_VIEWS = ["owned", "shared", "team", "automated"];
|
|
9249
|
+
var WORKSPACE_SIDEBAR_VIEWS = ["owned", "shared", "team", "integrations", "automated"];
|
|
9226
9250
|
var WORKSPACE_STATUS_FILTERS = ["active", "sleeping", "preparing", "failed"];
|
|
9227
9251
|
var DEFAULT_STATUS_FILTERS = [...WORKSPACE_STATUS_FILTERS];
|
|
9228
9252
|
var DEFAULT_WORKSPACE_FILTERS = {
|
|
9229
9253
|
statuses: [...DEFAULT_STATUS_FILTERS],
|
|
9230
|
-
sources: [],
|
|
9231
9254
|
ownerIds: [],
|
|
9232
9255
|
activity: "any"
|
|
9233
9256
|
};
|
|
@@ -11451,7 +11474,7 @@ async function configListCommand() {
|
|
|
11451
11474
|
}
|
|
11452
11475
|
|
|
11453
11476
|
// src/commands/codex-auth.ts
|
|
11454
|
-
import
|
|
11477
|
+
import chalk10 from "chalk";
|
|
11455
11478
|
|
|
11456
11479
|
// src/lib/codex-oauth.ts
|
|
11457
11480
|
import http2 from "http";
|
|
@@ -11618,56 +11641,86 @@ async function runCodexOAuthFlow() {
|
|
|
11618
11641
|
return tokens;
|
|
11619
11642
|
}
|
|
11620
11643
|
|
|
11644
|
+
// src/lib/credential-upload.ts
|
|
11645
|
+
import chalk9 from "chalk";
|
|
11646
|
+
function displayCredentialUploadSuccess(labels, response, isUserScoped) {
|
|
11647
|
+
console.log(chalk9.green(`
|
|
11648
|
+
\u2713 ${labels.providerLabel} authentication complete!`));
|
|
11649
|
+
if (response.email) {
|
|
11650
|
+
console.log(chalk9.gray(` Account: ${response.email}`));
|
|
11651
|
+
}
|
|
11652
|
+
if (response.planType) {
|
|
11653
|
+
console.log(chalk9.gray(` Plan: ${response.planType}`));
|
|
11654
|
+
}
|
|
11655
|
+
if (isUserScoped) {
|
|
11656
|
+
console.log(
|
|
11657
|
+
chalk9.gray(`
|
|
11658
|
+
Your personal ${labels.providerLabel} credentials have been saved.
|
|
11659
|
+
`)
|
|
11660
|
+
);
|
|
11661
|
+
} else {
|
|
11662
|
+
console.log(chalk9.gray(`
|
|
11663
|
+
You can now use ${labels.productLabel} in your workspaces.
|
|
11664
|
+
`));
|
|
11665
|
+
}
|
|
11666
|
+
}
|
|
11667
|
+
async function withAuthRecovery(operation) {
|
|
11668
|
+
try {
|
|
11669
|
+
return await operation();
|
|
11670
|
+
} catch (error) {
|
|
11671
|
+
if (isAgentMode() || !isReplicasAuthError(error)) {
|
|
11672
|
+
throw error;
|
|
11673
|
+
}
|
|
11674
|
+
const message = error instanceof NotAuthenticatedError ? "You're not signed in to Replicas. Signing in..." : "Your Replicas session expired. Re-authenticating...";
|
|
11675
|
+
console.log(chalk9.yellow(`
|
|
11676
|
+
${message}`));
|
|
11677
|
+
await loginCommand();
|
|
11678
|
+
console.log(chalk9.gray("Retrying credential upload..."));
|
|
11679
|
+
return operation();
|
|
11680
|
+
}
|
|
11681
|
+
}
|
|
11682
|
+
|
|
11621
11683
|
// src/commands/codex-auth.ts
|
|
11622
11684
|
async function codexAuthCommand(options = {}) {
|
|
11623
11685
|
const isUserScoped = options.user === true;
|
|
11624
11686
|
const scopeLabel = isUserScoped ? "personal" : "organization";
|
|
11625
|
-
console.log(
|
|
11687
|
+
console.log(chalk10.cyan(`Authenticating with Codex (${scopeLabel})...
|
|
11626
11688
|
`));
|
|
11627
11689
|
try {
|
|
11628
11690
|
const tokens = await runCodexOAuthFlow();
|
|
11629
|
-
console.log(
|
|
11691
|
+
console.log(chalk10.gray("\nUploading credentials to Replicas..."));
|
|
11630
11692
|
const endpoint = isUserScoped ? "/v1/codex/user/credentials" : "/v1/codex/credentials";
|
|
11631
|
-
const response = await
|
|
11632
|
-
endpoint,
|
|
11633
|
-
{
|
|
11693
|
+
const response = await withAuthRecovery(
|
|
11694
|
+
() => orgAuthenticatedFetch(endpoint, {
|
|
11634
11695
|
method: "POST",
|
|
11635
11696
|
body: {
|
|
11636
11697
|
access_token: tokens.accessToken,
|
|
11637
11698
|
refresh_token: tokens.refreshToken,
|
|
11638
11699
|
id_token: tokens.idToken
|
|
11639
11700
|
}
|
|
11640
|
-
}
|
|
11701
|
+
})
|
|
11641
11702
|
);
|
|
11642
|
-
if (response.success) {
|
|
11643
|
-
console.log(chalk9.green("\n\u2713 Codex authentication complete!"));
|
|
11644
|
-
if (response.email) {
|
|
11645
|
-
console.log(chalk9.gray(` Account: ${response.email}`));
|
|
11646
|
-
}
|
|
11647
|
-
if (response.planType) {
|
|
11648
|
-
console.log(chalk9.gray(` Plan: ${response.planType}`));
|
|
11649
|
-
}
|
|
11650
|
-
if (isUserScoped) {
|
|
11651
|
-
console.log(chalk9.gray("\nYour personal Codex credentials have been saved.\n"));
|
|
11652
|
-
} else {
|
|
11653
|
-
console.log(chalk9.gray("\nYou can now use Codex in your workspaces.\n"));
|
|
11654
|
-
}
|
|
11655
|
-
} else {
|
|
11703
|
+
if (!response.success) {
|
|
11656
11704
|
throw new Error(response.error || "Failed to upload Codex credentials to Replicas");
|
|
11657
11705
|
}
|
|
11706
|
+
displayCredentialUploadSuccess(
|
|
11707
|
+
{ providerLabel: "Codex", productLabel: "Codex" },
|
|
11708
|
+
response,
|
|
11709
|
+
isUserScoped
|
|
11710
|
+
);
|
|
11658
11711
|
} catch (error) {
|
|
11659
|
-
console.log(
|
|
11712
|
+
console.log(chalk10.red("\n\u2717 Error:"), error instanceof Error ? error.message : error);
|
|
11660
11713
|
process.exit(1);
|
|
11661
11714
|
}
|
|
11662
11715
|
}
|
|
11663
11716
|
|
|
11664
11717
|
// src/commands/claude-auth.ts
|
|
11665
|
-
import
|
|
11718
|
+
import chalk12 from "chalk";
|
|
11666
11719
|
|
|
11667
11720
|
// src/lib/claude-oauth.ts
|
|
11668
11721
|
import open3 from "open";
|
|
11669
11722
|
import readline from "readline";
|
|
11670
|
-
import
|
|
11723
|
+
import chalk11 from "chalk";
|
|
11671
11724
|
var DEFAULT_CLIENT_ID = "9d1c250a-e61b-44d9-88ed-5944d1962f5e";
|
|
11672
11725
|
var CLAUDE_CLIENT_ID = process.env.CLAUDE_OAUTH_CLIENT_ID || DEFAULT_CLIENT_ID;
|
|
11673
11726
|
var AUTHORIZATION_ENDPOINT2 = "https://claude.ai/oauth/authorize";
|
|
@@ -11759,17 +11812,17 @@ async function runClaudeOAuthFlow() {
|
|
|
11759
11812
|
const pkce = generatePkceCodes();
|
|
11760
11813
|
const state = generateState2();
|
|
11761
11814
|
const authUrl = buildAuthorizationUrl2(pkce.codeChallenge, state);
|
|
11762
|
-
console.log(
|
|
11763
|
-
console.log(
|
|
11815
|
+
console.log(chalk11.gray("We will open your browser so you can authenticate with Claude Code."));
|
|
11816
|
+
console.log(chalk11.gray("If the browser does not open automatically, use the URL below:\n"));
|
|
11764
11817
|
console.log(authUrl);
|
|
11765
11818
|
console.log();
|
|
11766
11819
|
try {
|
|
11767
11820
|
await open3(authUrl);
|
|
11768
11821
|
} catch {
|
|
11769
|
-
console.warn(
|
|
11822
|
+
console.warn(chalk11.yellow("Failed to open browser automatically. Please copy and open the URL manually."));
|
|
11770
11823
|
}
|
|
11771
|
-
console.log(
|
|
11772
|
-
console.log(
|
|
11824
|
+
console.log(chalk11.cyan("After completing authentication, copy the code shown on the success page."));
|
|
11825
|
+
console.log(chalk11.cyan("You can paste either the full URL, or a value formatted as CODE#STATE.\n"));
|
|
11773
11826
|
const userInput = await promptForAuthorizationCode("Paste the authorization code (or URL) here: ");
|
|
11774
11827
|
if (!userInput) {
|
|
11775
11828
|
throw new Error("No authorization code provided.");
|
|
@@ -11778,9 +11831,9 @@ async function runClaudeOAuthFlow() {
|
|
|
11778
11831
|
if (!code) {
|
|
11779
11832
|
throw new Error("Unable to parse authorization code. Please try again.");
|
|
11780
11833
|
}
|
|
11781
|
-
console.log(
|
|
11834
|
+
console.log(chalk11.gray("\nExchanging authorization code for tokens..."));
|
|
11782
11835
|
const tokens = await exchangeCodeForTokens2(code, returnedState, state, pkce.codeVerifier);
|
|
11783
|
-
console.log(
|
|
11836
|
+
console.log(chalk11.green("\u2713 Successfully obtained Claude credentials"));
|
|
11784
11837
|
return tokens;
|
|
11785
11838
|
}
|
|
11786
11839
|
|
|
@@ -11788,15 +11841,14 @@ async function runClaudeOAuthFlow() {
|
|
|
11788
11841
|
async function claudeAuthCommand(options = {}) {
|
|
11789
11842
|
const isUserScoped = options.user === true;
|
|
11790
11843
|
const scopeLabel = isUserScoped ? "personal" : "organization";
|
|
11791
|
-
console.log(
|
|
11844
|
+
console.log(chalk12.cyan(`Authenticating with Claude Code (${scopeLabel})...
|
|
11792
11845
|
`));
|
|
11793
11846
|
try {
|
|
11794
11847
|
const tokens = await runClaudeOAuthFlow();
|
|
11795
|
-
console.log(
|
|
11848
|
+
console.log(chalk12.gray("\nUploading credentials to Replicas..."));
|
|
11796
11849
|
const endpoint = isUserScoped ? "/v1/claude/user/credentials" : "/v1/claude/credentials";
|
|
11797
|
-
const response = await
|
|
11798
|
-
endpoint,
|
|
11799
|
-
{
|
|
11850
|
+
const response = await withAuthRecovery(
|
|
11851
|
+
() => orgAuthenticatedFetch(endpoint, {
|
|
11800
11852
|
method: "POST",
|
|
11801
11853
|
body: {
|
|
11802
11854
|
access_token: tokens.accessToken,
|
|
@@ -11806,31 +11858,24 @@ async function claudeAuthCommand(options = {}) {
|
|
|
11806
11858
|
expires_at: tokens.expiresAt,
|
|
11807
11859
|
refresh_token_expires_at: tokens.refreshTokenExpiresAt
|
|
11808
11860
|
}
|
|
11809
|
-
}
|
|
11861
|
+
})
|
|
11810
11862
|
);
|
|
11811
11863
|
if (!response.success) {
|
|
11812
11864
|
throw new Error(response.error || "Failed to upload Claude credentials to Replicas");
|
|
11813
11865
|
}
|
|
11814
|
-
|
|
11815
|
-
|
|
11816
|
-
|
|
11817
|
-
|
|
11818
|
-
|
|
11819
|
-
console.log(chalk11.gray(` Plan: ${response.planType}`));
|
|
11820
|
-
}
|
|
11821
|
-
if (isUserScoped) {
|
|
11822
|
-
console.log(chalk11.gray("\nYour personal Claude credentials have been saved.\n"));
|
|
11823
|
-
} else {
|
|
11824
|
-
console.log(chalk11.gray("\nYou can now use Claude Code in your workspaces.\n"));
|
|
11825
|
-
}
|
|
11866
|
+
displayCredentialUploadSuccess(
|
|
11867
|
+
{ providerLabel: "Claude", productLabel: "Claude Code" },
|
|
11868
|
+
response,
|
|
11869
|
+
isUserScoped
|
|
11870
|
+
);
|
|
11826
11871
|
} catch (error) {
|
|
11827
|
-
console.log(
|
|
11872
|
+
console.log(chalk12.red("\n\u2717 Error:"), error instanceof Error ? error.message : error);
|
|
11828
11873
|
process.exit(1);
|
|
11829
11874
|
}
|
|
11830
11875
|
}
|
|
11831
11876
|
|
|
11832
11877
|
// src/commands/init.ts
|
|
11833
|
-
import
|
|
11878
|
+
import chalk13 from "chalk";
|
|
11834
11879
|
import fs3 from "fs";
|
|
11835
11880
|
import path4 from "path";
|
|
11836
11881
|
function getDefaultConfig() {
|
|
@@ -11862,11 +11907,11 @@ function initCommand(options) {
|
|
|
11862
11907
|
const existingPath = path4.join(process.cwd(), filename);
|
|
11863
11908
|
if (fs3.existsSync(existingPath) && !options.force) {
|
|
11864
11909
|
console.log(
|
|
11865
|
-
|
|
11910
|
+
chalk13.yellow(
|
|
11866
11911
|
`${filename} already exists in this directory.`
|
|
11867
11912
|
)
|
|
11868
11913
|
);
|
|
11869
|
-
console.log(
|
|
11914
|
+
console.log(chalk13.gray("Use --force to overwrite the existing file."));
|
|
11870
11915
|
return;
|
|
11871
11916
|
}
|
|
11872
11917
|
}
|
|
@@ -11879,31 +11924,31 @@ function initCommand(options) {
|
|
|
11879
11924
|
}
|
|
11880
11925
|
try {
|
|
11881
11926
|
fs3.writeFileSync(configPath, configContent, "utf-8");
|
|
11882
|
-
console.log(
|
|
11927
|
+
console.log(chalk13.green(`\u2713 Created ${targetFilename}`));
|
|
11883
11928
|
for (const filename of REPLICAS_CONFIG_FILENAMES) {
|
|
11884
11929
|
if (filename === targetFilename) break;
|
|
11885
11930
|
const higherPath = path4.join(process.cwd(), filename);
|
|
11886
11931
|
if (fs3.existsSync(higherPath)) {
|
|
11887
11932
|
console.log("");
|
|
11888
11933
|
console.log(
|
|
11889
|
-
|
|
11934
|
+
chalk13.yellow(
|
|
11890
11935
|
`Warning: ${filename} already exists and takes priority over ${targetFilename}.`
|
|
11891
11936
|
)
|
|
11892
11937
|
);
|
|
11893
|
-
console.log(
|
|
11938
|
+
console.log(chalk13.gray(`Remove or rename ${filename} for ${targetFilename} to take effect.`));
|
|
11894
11939
|
}
|
|
11895
11940
|
}
|
|
11896
11941
|
console.log("");
|
|
11897
|
-
console.log(
|
|
11942
|
+
console.log(chalk13.gray("Configuration options:"));
|
|
11898
11943
|
console.log(
|
|
11899
|
-
|
|
11944
|
+
chalk13.gray(" systemPrompt - Custom instructions for AI coding assistants")
|
|
11900
11945
|
);
|
|
11901
11946
|
console.log(
|
|
11902
|
-
|
|
11947
|
+
chalk13.gray(" startHook - Commands to run on workspace startup")
|
|
11903
11948
|
);
|
|
11904
11949
|
if (!isYaml) {
|
|
11905
11950
|
console.log("");
|
|
11906
|
-
console.log(
|
|
11951
|
+
console.log(chalk13.gray("Tip: Use --yaml for YAML format with multiline system prompt support."));
|
|
11907
11952
|
}
|
|
11908
11953
|
} catch (error) {
|
|
11909
11954
|
throw new Error(
|
|
@@ -11913,7 +11958,7 @@ function initCommand(options) {
|
|
|
11913
11958
|
}
|
|
11914
11959
|
|
|
11915
11960
|
// src/lib/version-check.ts
|
|
11916
|
-
import
|
|
11961
|
+
import chalk14 from "chalk";
|
|
11917
11962
|
var MONOLITH_URL2 = process.env.REPLICAS_MONOLITH_URL || "https://api.tryreplicas.com";
|
|
11918
11963
|
var VERSION_CHECK_TIMEOUT = 2e3;
|
|
11919
11964
|
function compareVersions(v1, v2) {
|
|
@@ -11939,9 +11984,9 @@ async function checkForUpdates(currentVersion) {
|
|
|
11939
11984
|
const data = await response.json();
|
|
11940
11985
|
const latestVersion = data.version;
|
|
11941
11986
|
if (compareVersions(latestVersion, currentVersion) > 0) {
|
|
11942
|
-
console.error(
|
|
11987
|
+
console.error(chalk14.yellow(`
|
|
11943
11988
|
Update available: ${currentVersion} \u2192 ${latestVersion}`));
|
|
11944
|
-
console.error(
|
|
11989
|
+
console.error(chalk14.cyan(`Run: curl -fsSL https://tryreplicas.com/install.sh | bash
|
|
11945
11990
|
`));
|
|
11946
11991
|
}
|
|
11947
11992
|
} catch {
|
|
@@ -11949,7 +11994,7 @@ Update available: ${currentVersion} \u2192 ${latestVersion}`));
|
|
|
11949
11994
|
}
|
|
11950
11995
|
|
|
11951
11996
|
// src/commands/replica.ts
|
|
11952
|
-
import
|
|
11997
|
+
import chalk15 from "chalk";
|
|
11953
11998
|
import prompts3 from "prompts";
|
|
11954
11999
|
function formatDate(dateString) {
|
|
11955
12000
|
return new Date(dateString).toLocaleString();
|
|
@@ -11957,9 +12002,9 @@ function formatDate(dateString) {
|
|
|
11957
12002
|
function formatStatus(status) {
|
|
11958
12003
|
switch (status) {
|
|
11959
12004
|
case "active":
|
|
11960
|
-
return
|
|
12005
|
+
return chalk15.green(status);
|
|
11961
12006
|
case "sleeping":
|
|
11962
|
-
return
|
|
12007
|
+
return chalk15.gray(status);
|
|
11963
12008
|
default:
|
|
11964
12009
|
return status;
|
|
11965
12010
|
}
|
|
@@ -11972,87 +12017,87 @@ function formatDisplayMessage(message) {
|
|
|
11972
12017
|
const time = new Date(message.timestamp).toLocaleTimeString();
|
|
11973
12018
|
switch (message.type) {
|
|
11974
12019
|
case "user":
|
|
11975
|
-
console.log(
|
|
12020
|
+
console.log(chalk15.blue(`
|
|
11976
12021
|
[${time}] USER:`));
|
|
11977
|
-
console.log(
|
|
12022
|
+
console.log(chalk15.white(` ${truncate(message.content, 500)}`));
|
|
11978
12023
|
break;
|
|
11979
12024
|
case "agent":
|
|
11980
|
-
console.log(
|
|
12025
|
+
console.log(chalk15.green(`
|
|
11981
12026
|
[${time}] ASSISTANT:`));
|
|
11982
|
-
console.log(
|
|
12027
|
+
console.log(chalk15.white(` ${truncate(message.content, 500)}`));
|
|
11983
12028
|
break;
|
|
11984
12029
|
case "reasoning":
|
|
11985
|
-
console.log(
|
|
12030
|
+
console.log(chalk15.gray(`
|
|
11986
12031
|
[${time}] THINKING:`));
|
|
11987
|
-
console.log(
|
|
12032
|
+
console.log(chalk15.gray(` ${truncate(message.content, 300)}`));
|
|
11988
12033
|
break;
|
|
11989
12034
|
case "command":
|
|
11990
|
-
console.log(
|
|
12035
|
+
console.log(chalk15.magenta(`
|
|
11991
12036
|
[${time}] COMMAND:`));
|
|
11992
|
-
console.log(
|
|
12037
|
+
console.log(chalk15.white(` $ ${message.command}`));
|
|
11993
12038
|
if (message.output) {
|
|
11994
|
-
console.log(
|
|
12039
|
+
console.log(chalk15.gray(` ${truncate(message.output, 200)}`));
|
|
11995
12040
|
}
|
|
11996
12041
|
if (message.exitCode !== void 0) {
|
|
11997
|
-
const exitColor = message.exitCode === 0 ?
|
|
12042
|
+
const exitColor = message.exitCode === 0 ? chalk15.green : chalk15.red;
|
|
11998
12043
|
console.log(exitColor(` Exit code: ${message.exitCode}`));
|
|
11999
12044
|
}
|
|
12000
12045
|
break;
|
|
12001
12046
|
case "file_change":
|
|
12002
|
-
console.log(
|
|
12047
|
+
console.log(chalk15.yellow(`
|
|
12003
12048
|
[${time}] FILE CHANGES:`));
|
|
12004
12049
|
for (const change of message.changes) {
|
|
12005
12050
|
const icon = change.kind === "add" ? "+" : change.kind === "delete" ? "-" : "~";
|
|
12006
|
-
const color = change.kind === "add" ?
|
|
12051
|
+
const color = change.kind === "add" ? chalk15.green : change.kind === "delete" ? chalk15.red : chalk15.yellow;
|
|
12007
12052
|
console.log(color(` ${icon} ${change.path}`));
|
|
12008
12053
|
}
|
|
12009
12054
|
break;
|
|
12010
12055
|
case "patch":
|
|
12011
|
-
console.log(
|
|
12056
|
+
console.log(chalk15.yellow(`
|
|
12012
12057
|
[${time}] PATCH:`));
|
|
12013
12058
|
for (const op of message.operations) {
|
|
12014
12059
|
const icon = op.action === "add" ? "+" : op.action === "delete" ? "-" : "~";
|
|
12015
|
-
const color = op.action === "add" ?
|
|
12060
|
+
const color = op.action === "add" ? chalk15.green : op.action === "delete" ? chalk15.red : chalk15.yellow;
|
|
12016
12061
|
console.log(color(` ${icon} ${op.path}`));
|
|
12017
12062
|
}
|
|
12018
12063
|
break;
|
|
12019
12064
|
case "tool_call":
|
|
12020
|
-
console.log(
|
|
12065
|
+
console.log(chalk15.cyan(`
|
|
12021
12066
|
[${time}] TOOL: ${message.tool}`));
|
|
12022
12067
|
if (message.output) {
|
|
12023
|
-
console.log(
|
|
12068
|
+
console.log(chalk15.gray(` ${truncate(message.output, 200)}`));
|
|
12024
12069
|
}
|
|
12025
12070
|
break;
|
|
12026
12071
|
case "web_search":
|
|
12027
|
-
console.log(
|
|
12072
|
+
console.log(chalk15.cyan(`
|
|
12028
12073
|
[${time}] WEB SEARCH:`));
|
|
12029
|
-
console.log(
|
|
12074
|
+
console.log(chalk15.white(` "${message.query}"`));
|
|
12030
12075
|
break;
|
|
12031
12076
|
case "todo_list":
|
|
12032
|
-
console.log(
|
|
12077
|
+
console.log(chalk15.blue(`
|
|
12033
12078
|
[${time}] PLAN:`));
|
|
12034
12079
|
for (const item of message.items) {
|
|
12035
|
-
const icon = item.completed ?
|
|
12080
|
+
const icon = item.completed ? chalk15.green("[x]") : chalk15.gray("[ ]");
|
|
12036
12081
|
console.log(` ${icon} ${item.text}`);
|
|
12037
12082
|
}
|
|
12038
12083
|
break;
|
|
12039
12084
|
case "subagent":
|
|
12040
|
-
console.log(
|
|
12085
|
+
console.log(chalk15.magenta(`
|
|
12041
12086
|
[${time}] SUBAGENT: ${message.description}`));
|
|
12042
12087
|
if (message.output) {
|
|
12043
|
-
console.log(
|
|
12088
|
+
console.log(chalk15.gray(` ${truncate(message.output, 200)}`));
|
|
12044
12089
|
}
|
|
12045
12090
|
break;
|
|
12046
12091
|
case "error":
|
|
12047
|
-
console.log(
|
|
12092
|
+
console.log(chalk15.red(`
|
|
12048
12093
|
[${time}] ERROR:`));
|
|
12049
|
-
console.log(
|
|
12094
|
+
console.log(chalk15.red(` ${message.message}`));
|
|
12050
12095
|
break;
|
|
12051
12096
|
}
|
|
12052
12097
|
}
|
|
12053
12098
|
async function replicaListCommand(options) {
|
|
12054
12099
|
if (!isAuthenticated()) {
|
|
12055
|
-
console.log(
|
|
12100
|
+
console.log(chalk15.red('Not logged in. Please run "replicas login" first.'));
|
|
12056
12101
|
process.exit(1);
|
|
12057
12102
|
}
|
|
12058
12103
|
try {
|
|
@@ -12064,79 +12109,79 @@ async function replicaListCommand(options) {
|
|
|
12064
12109
|
`/v1/replica${query ? "?" + query : ""}`
|
|
12065
12110
|
);
|
|
12066
12111
|
if (response.replicas.length === 0) {
|
|
12067
|
-
console.log(
|
|
12112
|
+
console.log(chalk15.yellow("\nNo replicas found.\n"));
|
|
12068
12113
|
return;
|
|
12069
12114
|
}
|
|
12070
|
-
console.log(
|
|
12115
|
+
console.log(chalk15.green(`
|
|
12071
12116
|
Replicas (Page ${response.page} of ${response.total_pages}, Total: ${response.total}):
|
|
12072
12117
|
`));
|
|
12073
12118
|
for (const replica of response.replicas) {
|
|
12074
|
-
console.log(
|
|
12075
|
-
console.log(
|
|
12119
|
+
console.log(chalk15.white(` ${replica.name}`));
|
|
12120
|
+
console.log(chalk15.gray(` ID: ${replica.id}`));
|
|
12076
12121
|
if (replica.repositories.length > 0) {
|
|
12077
|
-
console.log(
|
|
12122
|
+
console.log(chalk15.gray(` Repositories: ${replica.repositories.map((repository) => repository.name).join(", ")}`));
|
|
12078
12123
|
}
|
|
12079
|
-
console.log(
|
|
12080
|
-
console.log(
|
|
12124
|
+
console.log(chalk15.gray(` Status: ${formatStatus(replica.status)}`));
|
|
12125
|
+
console.log(chalk15.gray(` Created: ${formatDate(replica.created_at)}`));
|
|
12081
12126
|
if (replica.pull_requests && replica.pull_requests.length > 0) {
|
|
12082
|
-
console.log(
|
|
12127
|
+
console.log(chalk15.gray(` Pull Requests:`));
|
|
12083
12128
|
for (const pr of replica.pull_requests) {
|
|
12084
|
-
console.log(
|
|
12129
|
+
console.log(chalk15.cyan(` - ${pr.repository} #${pr.number}: ${pr.url}`));
|
|
12085
12130
|
}
|
|
12086
12131
|
}
|
|
12087
12132
|
console.log();
|
|
12088
12133
|
}
|
|
12089
12134
|
} catch (error) {
|
|
12090
|
-
console.error(
|
|
12135
|
+
console.error(chalk15.red(`Error: ${error instanceof Error ? error.message : "Unknown error"}`));
|
|
12091
12136
|
process.exit(1);
|
|
12092
12137
|
}
|
|
12093
12138
|
}
|
|
12094
12139
|
async function replicaGetCommand(id) {
|
|
12095
12140
|
if (!isAuthenticated()) {
|
|
12096
|
-
console.log(
|
|
12141
|
+
console.log(chalk15.red('Not logged in. Please run "replicas login" first.'));
|
|
12097
12142
|
process.exit(1);
|
|
12098
12143
|
}
|
|
12099
12144
|
try {
|
|
12100
12145
|
const response = await orgAuthenticatedFetch(`/v1/replica/${id}`);
|
|
12101
12146
|
const replica = response.replica;
|
|
12102
|
-
console.log(
|
|
12147
|
+
console.log(chalk15.green(`
|
|
12103
12148
|
Replica: ${replica.name}
|
|
12104
12149
|
`));
|
|
12105
|
-
console.log(
|
|
12150
|
+
console.log(chalk15.gray(` ID: ${replica.id}`));
|
|
12106
12151
|
if (replica.repositories.length > 0) {
|
|
12107
|
-
console.log(
|
|
12152
|
+
console.log(chalk15.gray(` Repositories: ${replica.repositories.map((repository) => repository.name).join(", ")}`));
|
|
12108
12153
|
}
|
|
12109
|
-
console.log(
|
|
12110
|
-
console.log(
|
|
12154
|
+
console.log(chalk15.gray(` Status: ${formatStatus(replica.status)}`));
|
|
12155
|
+
console.log(chalk15.gray(` Created: ${formatDate(replica.created_at)}`));
|
|
12111
12156
|
if (replica.waking) {
|
|
12112
|
-
console.log(
|
|
12157
|
+
console.log(chalk15.yellow("\n Workspace is waking from sleep. Retry in 30-90 seconds for full details.\n"));
|
|
12113
12158
|
} else {
|
|
12114
12159
|
if (replica.coding_agent) {
|
|
12115
|
-
console.log(
|
|
12160
|
+
console.log(chalk15.gray(` Coding Agent: ${replica.coding_agent}`));
|
|
12116
12161
|
}
|
|
12117
12162
|
if (replica.repository_statuses && replica.repository_statuses.length > 0) {
|
|
12118
|
-
console.log(
|
|
12163
|
+
console.log(chalk15.gray(" Repository Statuses:"));
|
|
12119
12164
|
for (const repositoryStatus of replica.repository_statuses) {
|
|
12120
|
-
const changeText = repositoryStatus.git_diff ? ` (${
|
|
12121
|
-
console.log(
|
|
12165
|
+
const changeText = repositoryStatus.git_diff ? ` (${chalk15.green(`+${repositoryStatus.git_diff.added}`)} / ${chalk15.red(`-${repositoryStatus.git_diff.removed}`)})` : "";
|
|
12166
|
+
console.log(chalk15.gray(` - ${repositoryStatus.repository}: ${repositoryStatus.branch || "unknown"}${changeText}`));
|
|
12122
12167
|
}
|
|
12123
12168
|
}
|
|
12124
12169
|
}
|
|
12125
12170
|
if (replica.pull_requests && replica.pull_requests.length > 0) {
|
|
12126
|
-
console.log(
|
|
12171
|
+
console.log(chalk15.gray(` Pull Requests:`));
|
|
12127
12172
|
for (const pr of replica.pull_requests) {
|
|
12128
|
-
console.log(
|
|
12173
|
+
console.log(chalk15.cyan(` - ${pr.repository} #${pr.number}: ${pr.url}`));
|
|
12129
12174
|
}
|
|
12130
12175
|
}
|
|
12131
12176
|
console.log();
|
|
12132
12177
|
} catch (error) {
|
|
12133
|
-
console.error(
|
|
12178
|
+
console.error(chalk15.red(`Error: ${error instanceof Error ? error.message : "Unknown error"}`));
|
|
12134
12179
|
process.exit(1);
|
|
12135
12180
|
}
|
|
12136
12181
|
}
|
|
12137
12182
|
async function replicaCreateCommand(name, options) {
|
|
12138
12183
|
if (!isAuthenticated()) {
|
|
12139
|
-
console.log(
|
|
12184
|
+
console.log(chalk15.red('Not logged in. Please run "replicas login" first.'));
|
|
12140
12185
|
process.exit(1);
|
|
12141
12186
|
}
|
|
12142
12187
|
try {
|
|
@@ -12145,7 +12190,7 @@ async function replicaCreateCommand(name, options) {
|
|
|
12145
12190
|
(env) => !env.is_global && (env.repository_id || env.repository_set_id)
|
|
12146
12191
|
);
|
|
12147
12192
|
if (environments.length === 0) {
|
|
12148
|
-
console.log(
|
|
12193
|
+
console.log(chalk15.red("No repository-bound environments found. Please add a repository or bind an environment first."));
|
|
12149
12194
|
process.exit(1);
|
|
12150
12195
|
}
|
|
12151
12196
|
let replicaName = name;
|
|
@@ -12153,7 +12198,7 @@ async function replicaCreateCommand(name, options) {
|
|
|
12153
12198
|
let selectedEnvironmentId = options.environment?.trim();
|
|
12154
12199
|
let codingAgent = options.agent;
|
|
12155
12200
|
if (replicaName && /\s/.test(replicaName)) {
|
|
12156
|
-
console.log(
|
|
12201
|
+
console.log(chalk15.red("Replica name cannot contain spaces."));
|
|
12157
12202
|
process.exit(1);
|
|
12158
12203
|
}
|
|
12159
12204
|
if (!replicaName) {
|
|
@@ -12168,7 +12213,7 @@ async function replicaCreateCommand(name, options) {
|
|
|
12168
12213
|
}
|
|
12169
12214
|
});
|
|
12170
12215
|
if (!response2.name) {
|
|
12171
|
-
console.log(
|
|
12216
|
+
console.log(chalk15.yellow("\nCancelled."));
|
|
12172
12217
|
return;
|
|
12173
12218
|
}
|
|
12174
12219
|
replicaName = response2.name;
|
|
@@ -12185,7 +12230,7 @@ async function replicaCreateCommand(name, options) {
|
|
|
12185
12230
|
}))
|
|
12186
12231
|
});
|
|
12187
12232
|
if (!response2.environment) {
|
|
12188
|
-
console.log(
|
|
12233
|
+
console.log(chalk15.yellow("\nCancelled."));
|
|
12189
12234
|
return;
|
|
12190
12235
|
}
|
|
12191
12236
|
selectedEnvironmentId = response2.environment;
|
|
@@ -12198,7 +12243,7 @@ async function replicaCreateCommand(name, options) {
|
|
|
12198
12243
|
validate: (value) => value.trim() ? true : "Message is required"
|
|
12199
12244
|
});
|
|
12200
12245
|
if (!response2.message) {
|
|
12201
|
-
console.log(
|
|
12246
|
+
console.log(chalk15.yellow("\nCancelled."));
|
|
12202
12247
|
return;
|
|
12203
12248
|
}
|
|
12204
12249
|
message = response2.message;
|
|
@@ -12215,13 +12260,13 @@ async function replicaCreateCommand(name, options) {
|
|
|
12215
12260
|
initial: 0
|
|
12216
12261
|
});
|
|
12217
12262
|
if (!response2.agent) {
|
|
12218
|
-
console.log(
|
|
12263
|
+
console.log(chalk15.yellow("\nCancelled."));
|
|
12219
12264
|
return;
|
|
12220
12265
|
}
|
|
12221
12266
|
codingAgent = response2.agent;
|
|
12222
12267
|
}
|
|
12223
12268
|
if (!codingAgent || !["claude", "codex"].includes(codingAgent)) {
|
|
12224
|
-
console.log(
|
|
12269
|
+
console.log(chalk15.red(`Invalid coding agent: ${codingAgent}. Must be one of: claude, codex`));
|
|
12225
12270
|
process.exit(1);
|
|
12226
12271
|
}
|
|
12227
12272
|
const body = {
|
|
@@ -12230,28 +12275,28 @@ async function replicaCreateCommand(name, options) {
|
|
|
12230
12275
|
environment_id: selectedEnvironmentId,
|
|
12231
12276
|
coding_agent: codingAgent
|
|
12232
12277
|
};
|
|
12233
|
-
console.log(
|
|
12278
|
+
console.log(chalk15.gray("\nCreating replica..."));
|
|
12234
12279
|
const response = await orgAuthenticatedFetch("/v1/replica", {
|
|
12235
12280
|
method: "POST",
|
|
12236
12281
|
body
|
|
12237
12282
|
});
|
|
12238
12283
|
const replica = response.replica;
|
|
12239
|
-
console.log(
|
|
12284
|
+
console.log(chalk15.green(`
|
|
12240
12285
|
Created replica: ${replica.name}`));
|
|
12241
|
-
console.log(
|
|
12242
|
-
console.log(
|
|
12286
|
+
console.log(chalk15.gray(` ID: ${replica.id}`));
|
|
12287
|
+
console.log(chalk15.gray(` Status: ${formatStatus(replica.status)}`));
|
|
12243
12288
|
if (replica.repositories.length > 0) {
|
|
12244
|
-
console.log(
|
|
12289
|
+
console.log(chalk15.gray(` Repositories: ${replica.repositories.map((repository) => repository.name).join(", ")}`));
|
|
12245
12290
|
}
|
|
12246
12291
|
console.log();
|
|
12247
12292
|
} catch (error) {
|
|
12248
|
-
console.error(
|
|
12293
|
+
console.error(chalk15.red(`Error: ${error instanceof Error ? error.message : "Unknown error"}`));
|
|
12249
12294
|
process.exit(1);
|
|
12250
12295
|
}
|
|
12251
12296
|
}
|
|
12252
12297
|
async function replicaSendCommand(id, options) {
|
|
12253
12298
|
if (!isAuthenticated()) {
|
|
12254
|
-
console.log(
|
|
12299
|
+
console.log(chalk15.red('Not logged in. Please run "replicas login" first.'));
|
|
12255
12300
|
process.exit(1);
|
|
12256
12301
|
}
|
|
12257
12302
|
try {
|
|
@@ -12264,7 +12309,7 @@ async function replicaSendCommand(id, options) {
|
|
|
12264
12309
|
validate: (value) => value.trim() ? true : "Message is required"
|
|
12265
12310
|
});
|
|
12266
12311
|
if (!response2.message) {
|
|
12267
|
-
console.log(
|
|
12312
|
+
console.log(chalk15.yellow("\nCancelled."));
|
|
12268
12313
|
return;
|
|
12269
12314
|
}
|
|
12270
12315
|
message = response2.message;
|
|
@@ -12274,7 +12319,7 @@ async function replicaSendCommand(id, options) {
|
|
|
12274
12319
|
};
|
|
12275
12320
|
if (options.agent) {
|
|
12276
12321
|
if (!["claude", "codex"].includes(options.agent)) {
|
|
12277
|
-
console.log(
|
|
12322
|
+
console.log(chalk15.red(`Invalid coding agent: ${options.agent}. Must be one of: claude, codex`));
|
|
12278
12323
|
process.exit(1);
|
|
12279
12324
|
}
|
|
12280
12325
|
body.coding_agent = options.agent;
|
|
@@ -12286,21 +12331,21 @@ async function replicaSendCommand(id, options) {
|
|
|
12286
12331
|
body
|
|
12287
12332
|
}
|
|
12288
12333
|
);
|
|
12289
|
-
const statusColor = response.status === "sent" ?
|
|
12334
|
+
const statusColor = response.status === "sent" ? chalk15.green : chalk15.yellow;
|
|
12290
12335
|
console.log(statusColor(`
|
|
12291
12336
|
Message ${response.status}`));
|
|
12292
12337
|
if (response.position !== void 0 && response.position > 0) {
|
|
12293
|
-
console.log(
|
|
12338
|
+
console.log(chalk15.gray(` Queue position: ${response.position}`));
|
|
12294
12339
|
}
|
|
12295
12340
|
console.log();
|
|
12296
12341
|
} catch (error) {
|
|
12297
|
-
console.error(
|
|
12342
|
+
console.error(chalk15.red(`Error: ${error instanceof Error ? error.message : "Unknown error"}`));
|
|
12298
12343
|
process.exit(1);
|
|
12299
12344
|
}
|
|
12300
12345
|
}
|
|
12301
12346
|
async function replicaDeleteCommand(id, options) {
|
|
12302
12347
|
if (!isAuthenticated()) {
|
|
12303
|
-
console.log(
|
|
12348
|
+
console.log(chalk15.red('Not logged in. Please run "replicas login" first.'));
|
|
12304
12349
|
process.exit(1);
|
|
12305
12350
|
}
|
|
12306
12351
|
try {
|
|
@@ -12312,24 +12357,24 @@ async function replicaDeleteCommand(id, options) {
|
|
|
12312
12357
|
initial: false
|
|
12313
12358
|
});
|
|
12314
12359
|
if (!response.confirm) {
|
|
12315
|
-
console.log(
|
|
12360
|
+
console.log(chalk15.yellow("\nCancelled."));
|
|
12316
12361
|
return;
|
|
12317
12362
|
}
|
|
12318
12363
|
}
|
|
12319
12364
|
await orgAuthenticatedFetch(`/v1/replica/${id}`, {
|
|
12320
12365
|
method: "DELETE"
|
|
12321
12366
|
});
|
|
12322
|
-
console.log(
|
|
12367
|
+
console.log(chalk15.green(`
|
|
12323
12368
|
Replica ${id} deleted.
|
|
12324
12369
|
`));
|
|
12325
12370
|
} catch (error) {
|
|
12326
|
-
console.error(
|
|
12371
|
+
console.error(chalk15.red(`Error: ${error instanceof Error ? error.message : "Unknown error"}`));
|
|
12327
12372
|
process.exit(1);
|
|
12328
12373
|
}
|
|
12329
12374
|
}
|
|
12330
12375
|
async function replicaReadCommand(id, options) {
|
|
12331
12376
|
if (!isAuthenticated()) {
|
|
12332
|
-
console.log(
|
|
12377
|
+
console.log(chalk15.red('Not logged in. Please run "replicas login" first.'));
|
|
12333
12378
|
process.exit(1);
|
|
12334
12379
|
}
|
|
12335
12380
|
try {
|
|
@@ -12341,53 +12386,53 @@ async function replicaReadCommand(id, options) {
|
|
|
12341
12386
|
`/v1/replica/${id}/read${query ? "?" + query : ""}`
|
|
12342
12387
|
);
|
|
12343
12388
|
if (response.waking) {
|
|
12344
|
-
console.log(
|
|
12389
|
+
console.log(chalk15.yellow("\nWorkspace is waking from sleep. Retry in 30-90 seconds.\n"));
|
|
12345
12390
|
return;
|
|
12346
12391
|
}
|
|
12347
|
-
console.log(
|
|
12392
|
+
console.log(chalk15.green(`
|
|
12348
12393
|
Conversation History
|
|
12349
12394
|
`));
|
|
12350
12395
|
if (response.coding_agent) {
|
|
12351
|
-
console.log(
|
|
12396
|
+
console.log(chalk15.gray(` Agent: ${response.coding_agent}`));
|
|
12352
12397
|
}
|
|
12353
12398
|
if (response.thread_id) {
|
|
12354
|
-
console.log(
|
|
12399
|
+
console.log(chalk15.gray(` Thread ID: ${response.thread_id}`));
|
|
12355
12400
|
}
|
|
12356
|
-
console.log(
|
|
12357
|
-
console.log(
|
|
12401
|
+
console.log(chalk15.gray(` Total Events: ${response.total}`));
|
|
12402
|
+
console.log(chalk15.gray(` Showing: ${response.events.length} events`));
|
|
12358
12403
|
if (response.has_more) {
|
|
12359
|
-
console.log(
|
|
12404
|
+
console.log(chalk15.gray(` Has More: yes (use --offset to paginate)`));
|
|
12360
12405
|
}
|
|
12361
12406
|
console.log();
|
|
12362
12407
|
if (response.events.length === 0) {
|
|
12363
|
-
console.log(
|
|
12408
|
+
console.log(chalk15.yellow(" No events found.\n"));
|
|
12364
12409
|
return;
|
|
12365
12410
|
}
|
|
12366
|
-
console.log(
|
|
12411
|
+
console.log(chalk15.gray("-".repeat(60)));
|
|
12367
12412
|
const agentType = response.coding_agent || "claude";
|
|
12368
12413
|
const displayMessages = parseAgentEvents(response.events, agentType);
|
|
12369
12414
|
for (const message of displayMessages) {
|
|
12370
12415
|
formatDisplayMessage(message);
|
|
12371
12416
|
}
|
|
12372
|
-
console.log(
|
|
12417
|
+
console.log(chalk15.gray("\n" + "-".repeat(60)));
|
|
12373
12418
|
console.log();
|
|
12374
12419
|
} catch (error) {
|
|
12375
|
-
console.error(
|
|
12420
|
+
console.error(chalk15.red(`Error: ${error instanceof Error ? error.message : "Unknown error"}`));
|
|
12376
12421
|
process.exit(1);
|
|
12377
12422
|
}
|
|
12378
12423
|
}
|
|
12379
12424
|
|
|
12380
12425
|
// src/commands/repositories.ts
|
|
12381
|
-
import
|
|
12426
|
+
import chalk17 from "chalk";
|
|
12382
12427
|
|
|
12383
12428
|
// src/lib/command-utils.ts
|
|
12384
|
-
import
|
|
12429
|
+
import chalk16 from "chalk";
|
|
12385
12430
|
function formatDate2(dateString) {
|
|
12386
12431
|
return new Date(dateString).toLocaleString();
|
|
12387
12432
|
}
|
|
12388
12433
|
function ensureOrgApiAuthenticated() {
|
|
12389
12434
|
if (!canCallOrgApi()) {
|
|
12390
|
-
console.log(
|
|
12435
|
+
console.log(chalk16.red('Not logged in. Please run "replicas login" first.'));
|
|
12391
12436
|
process.exit(1);
|
|
12392
12437
|
}
|
|
12393
12438
|
}
|
|
@@ -12398,30 +12443,30 @@ async function repositoriesListCommand() {
|
|
|
12398
12443
|
try {
|
|
12399
12444
|
const response = await orgAuthenticatedFetch("/v1/repositories");
|
|
12400
12445
|
if (response.repositories.length === 0) {
|
|
12401
|
-
console.log(
|
|
12446
|
+
console.log(chalk17.yellow("\nNo repositories found.\n"));
|
|
12402
12447
|
return;
|
|
12403
12448
|
}
|
|
12404
|
-
console.log(
|
|
12449
|
+
console.log(chalk17.green(`
|
|
12405
12450
|
Repositories (${response.repositories.length}):
|
|
12406
12451
|
`));
|
|
12407
12452
|
for (const repo of response.repositories) {
|
|
12408
|
-
console.log(
|
|
12409
|
-
console.log(
|
|
12410
|
-
console.log(
|
|
12411
|
-
console.log(
|
|
12453
|
+
console.log(chalk17.white(` ${repo.name}`));
|
|
12454
|
+
console.log(chalk17.gray(` URL: ${repo.url}`));
|
|
12455
|
+
console.log(chalk17.gray(` Default Branch: ${repo.default_branch}`));
|
|
12456
|
+
console.log(chalk17.gray(` Created: ${formatDate2(repo.created_at)}`));
|
|
12412
12457
|
if (repo.github_repository_id) {
|
|
12413
|
-
console.log(
|
|
12458
|
+
console.log(chalk17.gray(` GitHub ID: ${repo.github_repository_id}`));
|
|
12414
12459
|
}
|
|
12415
12460
|
console.log();
|
|
12416
12461
|
}
|
|
12417
12462
|
} catch (error) {
|
|
12418
|
-
console.error(
|
|
12463
|
+
console.error(chalk17.red(`Error: ${error instanceof Error ? error.message : "Unknown error"}`));
|
|
12419
12464
|
process.exit(1);
|
|
12420
12465
|
}
|
|
12421
12466
|
}
|
|
12422
12467
|
|
|
12423
12468
|
// src/commands/automation.ts
|
|
12424
|
-
import
|
|
12469
|
+
import chalk18 from "chalk";
|
|
12425
12470
|
import prompts4 from "prompts";
|
|
12426
12471
|
function parseAgentProviderOption(value) {
|
|
12427
12472
|
if (value === void 0) return void 0;
|
|
@@ -12429,8 +12474,8 @@ function parseAgentProviderOption(value) {
|
|
|
12429
12474
|
if (trimmed === "" || trimmed.toLowerCase() === "none") return null;
|
|
12430
12475
|
const lower = trimmed.toLowerCase();
|
|
12431
12476
|
if (!isValidAgentProvider(lower)) {
|
|
12432
|
-
console.log(
|
|
12433
|
-
console.log(
|
|
12477
|
+
console.log(chalk18.red(`Invalid --agent-provider: ${value}`));
|
|
12478
|
+
console.log(chalk18.gray(`Valid options: ${VALID_AGENT_PROVIDERS.join(", ")}, none`));
|
|
12434
12479
|
process.exit(1);
|
|
12435
12480
|
}
|
|
12436
12481
|
return lower;
|
|
@@ -12441,8 +12486,8 @@ function parseThinkingLevelOption(value) {
|
|
|
12441
12486
|
if (trimmed === "" || trimmed.toLowerCase() === "none") return null;
|
|
12442
12487
|
const lower = trimmed.toLowerCase();
|
|
12443
12488
|
if (!isValidThinkingLevel(lower)) {
|
|
12444
|
-
console.log(
|
|
12445
|
-
console.log(
|
|
12489
|
+
console.log(chalk18.red(`Invalid --thinking-level: ${value}`));
|
|
12490
|
+
console.log(chalk18.gray(`Valid options: ${VALID_THINKING_LEVELS.join(", ")}, none`));
|
|
12446
12491
|
process.exit(1);
|
|
12447
12492
|
}
|
|
12448
12493
|
return lower;
|
|
@@ -12456,7 +12501,7 @@ function parseModelOption(value) {
|
|
|
12456
12501
|
function applyAgentSelection(body, existing) {
|
|
12457
12502
|
const result = validateAgentSelection(body, existing);
|
|
12458
12503
|
if (!result.ok) {
|
|
12459
|
-
console.log(
|
|
12504
|
+
console.log(chalk18.red(result.error));
|
|
12460
12505
|
process.exit(1);
|
|
12461
12506
|
}
|
|
12462
12507
|
const out = {};
|
|
@@ -12496,37 +12541,37 @@ function formatAgentSummary(automation2) {
|
|
|
12496
12541
|
function resolveSelectableEnvironmentId(envInput, selectableEnvs) {
|
|
12497
12542
|
const env = selectableEnvs.find((e) => e.name === envInput || e.id === envInput);
|
|
12498
12543
|
if (!env) {
|
|
12499
|
-
console.log(
|
|
12544
|
+
console.log(chalk18.red(`Environment not found: ${envInput}`));
|
|
12500
12545
|
const available = selectableEnvs.map((e) => e.name).join(", ");
|
|
12501
|
-
console.log(
|
|
12546
|
+
console.log(chalk18.gray(`Available: ${available || "(none)"}`));
|
|
12502
12547
|
process.exit(1);
|
|
12503
12548
|
}
|
|
12504
12549
|
return env.id;
|
|
12505
12550
|
}
|
|
12506
12551
|
function printAutomation(automation2) {
|
|
12507
|
-
console.log(
|
|
12508
|
-
console.log(
|
|
12552
|
+
console.log(chalk18.white(` ${automation2.name}`));
|
|
12553
|
+
console.log(chalk18.gray(` ID: ${automation2.id}`));
|
|
12509
12554
|
if (automation2.description) {
|
|
12510
|
-
console.log(
|
|
12555
|
+
console.log(chalk18.gray(` Description: ${automation2.description}`));
|
|
12511
12556
|
}
|
|
12512
|
-
console.log(
|
|
12557
|
+
console.log(chalk18.gray(` Enabled: ${automation2.enabled ? chalk18.green("yes") : chalk18.red("no")}`));
|
|
12513
12558
|
if (automation2.triggers.length > 0) {
|
|
12514
|
-
console.log(
|
|
12559
|
+
console.log(chalk18.gray(` Triggers: ${automation2.triggers.map(formatTrigger).join(", ")}`));
|
|
12515
12560
|
}
|
|
12516
|
-
console.log(
|
|
12561
|
+
console.log(chalk18.gray(` Prompt: ${truncate2(automation2.prompt, 80)}`));
|
|
12517
12562
|
if (automation2.cron_next_fire_at) {
|
|
12518
|
-
console.log(
|
|
12563
|
+
console.log(chalk18.gray(` Next Run: ${formatDate2(automation2.cron_next_fire_at)}`));
|
|
12519
12564
|
}
|
|
12520
12565
|
if (automation2.workspace_lifecycle_policy && automation2.workspace_lifecycle_policy !== "default") {
|
|
12521
12566
|
const lifecycle = automation2.workspace_lifecycle_policy === "delete_after_inactivity" ? `delete_after_inactivity (${automation2.workspace_auto_stop_minutes ?? 30}m)` : automation2.workspace_lifecycle_policy;
|
|
12522
|
-
console.log(
|
|
12567
|
+
console.log(chalk18.gray(` Lifecycle: ${lifecycle}`));
|
|
12523
12568
|
}
|
|
12524
12569
|
if (automation2.agent_provider || automation2.model || automation2.thinking_level) {
|
|
12525
|
-
console.log(
|
|
12570
|
+
console.log(chalk18.gray(` Agent: ${formatAgentSummary(automation2)}`));
|
|
12526
12571
|
}
|
|
12527
|
-
console.log(
|
|
12528
|
-
console.log(
|
|
12529
|
-
console.log(
|
|
12572
|
+
console.log(chalk18.gray(` PR Follow-ups: ${automation2.config.capabilities?.pr_followups === true ? chalk18.green("managed") : "read-only"}`));
|
|
12573
|
+
console.log(chalk18.gray(` Created: ${formatDate2(automation2.created_at)}`));
|
|
12574
|
+
console.log(chalk18.gray(` Updated: ${formatDate2(automation2.updated_at)}`));
|
|
12530
12575
|
console.log();
|
|
12531
12576
|
}
|
|
12532
12577
|
async function automationListCommand(options) {
|
|
@@ -12540,17 +12585,17 @@ async function automationListCommand(options) {
|
|
|
12540
12585
|
`/v1/automations${query ? "?" + query : ""}`
|
|
12541
12586
|
);
|
|
12542
12587
|
if (response.automations.length === 0) {
|
|
12543
|
-
console.log(
|
|
12588
|
+
console.log(chalk18.yellow("\nNo automations found.\n"));
|
|
12544
12589
|
return;
|
|
12545
12590
|
}
|
|
12546
|
-
console.log(
|
|
12591
|
+
console.log(chalk18.green(`
|
|
12547
12592
|
Automations (Page ${response.page} of ${response.totalPages}, Total: ${response.total}):
|
|
12548
12593
|
`));
|
|
12549
12594
|
for (const automation2 of response.automations) {
|
|
12550
12595
|
printAutomation(automation2);
|
|
12551
12596
|
}
|
|
12552
12597
|
} catch (error) {
|
|
12553
|
-
console.error(
|
|
12598
|
+
console.error(chalk18.red(`Error: ${error instanceof Error ? error.message : "Unknown error"}`));
|
|
12554
12599
|
process.exit(1);
|
|
12555
12600
|
}
|
|
12556
12601
|
}
|
|
@@ -12559,46 +12604,46 @@ async function automationGetCommand(id) {
|
|
|
12559
12604
|
try {
|
|
12560
12605
|
const response = await orgAuthenticatedFetch(`/v1/automations/${id}`);
|
|
12561
12606
|
const automation2 = response.automation;
|
|
12562
|
-
console.log(
|
|
12607
|
+
console.log(chalk18.green(`
|
|
12563
12608
|
Automation: ${automation2.name}
|
|
12564
12609
|
`));
|
|
12565
|
-
console.log(
|
|
12610
|
+
console.log(chalk18.gray(` ID: ${automation2.id}`));
|
|
12566
12611
|
if (automation2.description) {
|
|
12567
|
-
console.log(
|
|
12612
|
+
console.log(chalk18.gray(` Description: ${automation2.description}`));
|
|
12568
12613
|
}
|
|
12569
|
-
console.log(
|
|
12614
|
+
console.log(chalk18.gray(` Enabled: ${automation2.enabled ? chalk18.green("yes") : chalk18.red("no")}`));
|
|
12570
12615
|
if (automation2.triggers.length > 0) {
|
|
12571
|
-
console.log(
|
|
12616
|
+
console.log(chalk18.gray(` Triggers:`));
|
|
12572
12617
|
for (const trigger of automation2.triggers) {
|
|
12573
|
-
console.log(
|
|
12618
|
+
console.log(chalk18.gray(` - ${formatTrigger(trigger)}`));
|
|
12574
12619
|
}
|
|
12575
12620
|
}
|
|
12576
|
-
console.log(
|
|
12577
|
-
console.log(
|
|
12621
|
+
console.log(chalk18.gray(` Prompt: ${automation2.prompt}`));
|
|
12622
|
+
console.log(chalk18.gray(` Environment: ${automation2.environment_id}`));
|
|
12578
12623
|
if (automation2.cron_expression) {
|
|
12579
|
-
console.log(
|
|
12624
|
+
console.log(chalk18.gray(` Cron: ${automation2.cron_expression}`));
|
|
12580
12625
|
}
|
|
12581
12626
|
if (automation2.cron_timezone) {
|
|
12582
|
-
console.log(
|
|
12627
|
+
console.log(chalk18.gray(` Timezone: ${automation2.cron_timezone}`));
|
|
12583
12628
|
}
|
|
12584
12629
|
if (automation2.cron_next_fire_at) {
|
|
12585
|
-
console.log(
|
|
12630
|
+
console.log(chalk18.gray(` Next Run: ${formatDate2(automation2.cron_next_fire_at)}`));
|
|
12586
12631
|
}
|
|
12587
12632
|
if (automation2.workspace_lifecycle_policy) {
|
|
12588
|
-
console.log(
|
|
12633
|
+
console.log(chalk18.gray(` Lifecycle Policy: ${automation2.workspace_lifecycle_policy}`));
|
|
12589
12634
|
}
|
|
12590
12635
|
if (automation2.workspace_auto_stop_minutes) {
|
|
12591
|
-
console.log(
|
|
12592
|
-
}
|
|
12593
|
-
console.log(
|
|
12594
|
-
console.log(
|
|
12595
|
-
console.log(
|
|
12596
|
-
console.log(
|
|
12597
|
-
console.log(
|
|
12598
|
-
console.log(
|
|
12636
|
+
console.log(chalk18.gray(` Auto-stop: ${automation2.workspace_auto_stop_minutes} minutes`));
|
|
12637
|
+
}
|
|
12638
|
+
console.log(chalk18.gray(` Agent: ${automation2.agent_provider ? getProviderDisplayName(automation2.agent_provider) : "organization default"}`));
|
|
12639
|
+
console.log(chalk18.gray(` Model: ${automation2.model ? MODEL_LABELS[automation2.model] ?? automation2.model : "agent default"}`));
|
|
12640
|
+
console.log(chalk18.gray(` Thinking Level: ${automation2.thinking_level ?? "agent default"}`));
|
|
12641
|
+
console.log(chalk18.gray(` PR Follow-ups: ${automation2.config.capabilities?.pr_followups === true ? "managed" : "read-only"}`));
|
|
12642
|
+
console.log(chalk18.gray(` Created: ${formatDate2(automation2.created_at)}`));
|
|
12643
|
+
console.log(chalk18.gray(` Updated: ${formatDate2(automation2.updated_at)}`));
|
|
12599
12644
|
console.log();
|
|
12600
12645
|
} catch (error) {
|
|
12601
|
-
console.error(
|
|
12646
|
+
console.error(chalk18.red(`Error: ${error instanceof Error ? error.message : "Unknown error"}`));
|
|
12602
12647
|
process.exit(1);
|
|
12603
12648
|
}
|
|
12604
12649
|
}
|
|
@@ -12679,18 +12724,18 @@ async function automationCreateCommand(name, options) {
|
|
|
12679
12724
|
ensureOrgApiAuthenticated();
|
|
12680
12725
|
const validLifecycles = ["default", "delete_when_done", "delete_after_inactivity"];
|
|
12681
12726
|
if (options.lifecycle && !validLifecycles.includes(options.lifecycle)) {
|
|
12682
|
-
console.log(
|
|
12683
|
-
console.log(
|
|
12727
|
+
console.log(chalk18.red(`Invalid lifecycle policy: ${options.lifecycle}`));
|
|
12728
|
+
console.log(chalk18.gray(`Valid options: ${validLifecycles.join(", ")}`));
|
|
12684
12729
|
process.exit(1);
|
|
12685
12730
|
}
|
|
12686
12731
|
if (options.autoStopMinutes && options.lifecycle !== "delete_after_inactivity") {
|
|
12687
|
-
console.log(
|
|
12732
|
+
console.log(chalk18.red("--auto-stop-minutes requires --lifecycle delete_after_inactivity"));
|
|
12688
12733
|
process.exit(1);
|
|
12689
12734
|
}
|
|
12690
12735
|
if (options.autoStopMinutes) {
|
|
12691
12736
|
const minutes = parseInt(options.autoStopMinutes, 10);
|
|
12692
12737
|
if (isNaN(minutes) || minutes < 3 || minutes > 1440) {
|
|
12693
|
-
console.log(
|
|
12738
|
+
console.log(chalk18.red("--auto-stop-minutes must be between 3 and 1440"));
|
|
12694
12739
|
process.exit(1);
|
|
12695
12740
|
}
|
|
12696
12741
|
}
|
|
@@ -12707,7 +12752,7 @@ async function automationCreateCommand(name, options) {
|
|
|
12707
12752
|
const allEnvs = envResponse.environments;
|
|
12708
12753
|
const selectableEnvs = allEnvs.filter((env) => !env.is_global);
|
|
12709
12754
|
if (selectableEnvs.length === 0) {
|
|
12710
|
-
console.log(
|
|
12755
|
+
console.log(chalk18.red("No environments found. Please create an environment first."));
|
|
12711
12756
|
process.exit(1);
|
|
12712
12757
|
}
|
|
12713
12758
|
const repoResponse = await orgAuthenticatedFetch("/v1/repositories");
|
|
@@ -12721,7 +12766,7 @@ async function automationCreateCommand(name, options) {
|
|
|
12721
12766
|
validate: (value) => value.trim() ? true : "Name is required"
|
|
12722
12767
|
});
|
|
12723
12768
|
if (!response2.name) {
|
|
12724
|
-
console.log(
|
|
12769
|
+
console.log(chalk18.yellow("\nCancelled."));
|
|
12725
12770
|
return;
|
|
12726
12771
|
}
|
|
12727
12772
|
automationName = response2.name;
|
|
@@ -12735,7 +12780,7 @@ async function automationCreateCommand(name, options) {
|
|
|
12735
12780
|
validate: (value) => value.trim() ? true : "Prompt is required"
|
|
12736
12781
|
});
|
|
12737
12782
|
if (!response2.prompt) {
|
|
12738
|
-
console.log(
|
|
12783
|
+
console.log(chalk18.yellow("\nCancelled."));
|
|
12739
12784
|
return;
|
|
12740
12785
|
}
|
|
12741
12786
|
automationPrompt = response2.prompt;
|
|
@@ -12755,7 +12800,7 @@ async function automationCreateCommand(name, options) {
|
|
|
12755
12800
|
}))
|
|
12756
12801
|
});
|
|
12757
12802
|
if (!envResponse2.env) {
|
|
12758
|
-
console.log(
|
|
12803
|
+
console.log(chalk18.yellow("\nCancelled."));
|
|
12759
12804
|
return;
|
|
12760
12805
|
}
|
|
12761
12806
|
selectedEnvironmentId = envResponse2.env;
|
|
@@ -12778,8 +12823,8 @@ async function automationCreateCommand(name, options) {
|
|
|
12778
12823
|
for (const repoName of repoNames) {
|
|
12779
12824
|
const repo = repositories.find((r) => r.name === repoName);
|
|
12780
12825
|
if (!repo) {
|
|
12781
|
-
console.log(
|
|
12782
|
-
console.log(
|
|
12826
|
+
console.log(chalk18.red(`Repository not found for trigger filter: ${repoName}`));
|
|
12827
|
+
console.log(chalk18.gray(`Available: ${repositories.map((r) => r.name).join(", ")}`));
|
|
12783
12828
|
process.exit(1);
|
|
12784
12829
|
}
|
|
12785
12830
|
githubRepoIds.push(repo.id);
|
|
@@ -12796,7 +12841,7 @@ async function automationCreateCommand(name, options) {
|
|
|
12796
12841
|
if (triggers.length === 0) {
|
|
12797
12842
|
triggers = await promptForTriggers(repositories.map((r) => ({ id: r.id, name: r.name })));
|
|
12798
12843
|
if (triggers.length === 0) {
|
|
12799
|
-
console.log(
|
|
12844
|
+
console.log(chalk18.red("At least one trigger is required."));
|
|
12800
12845
|
process.exit(1);
|
|
12801
12846
|
}
|
|
12802
12847
|
}
|
|
@@ -12821,25 +12866,25 @@ async function automationCreateCommand(name, options) {
|
|
|
12821
12866
|
...options.autoStopMinutes ? { workspace_auto_stop_minutes: parseInt(options.autoStopMinutes, 10) } : {},
|
|
12822
12867
|
...agentSelection
|
|
12823
12868
|
};
|
|
12824
|
-
console.log(
|
|
12869
|
+
console.log(chalk18.gray("\nCreating automation..."));
|
|
12825
12870
|
const response = await orgAuthenticatedFetch("/v1/automations", {
|
|
12826
12871
|
method: "POST",
|
|
12827
12872
|
body
|
|
12828
12873
|
});
|
|
12829
12874
|
const automation2 = response.automation;
|
|
12830
|
-
console.log(
|
|
12875
|
+
console.log(chalk18.green(`
|
|
12831
12876
|
Created automation: ${automation2.name}`));
|
|
12832
|
-
console.log(
|
|
12833
|
-
console.log(
|
|
12877
|
+
console.log(chalk18.gray(` ID: ${automation2.id}`));
|
|
12878
|
+
console.log(chalk18.gray(` Enabled: ${automation2.enabled ? "yes" : "no"}`));
|
|
12834
12879
|
if (automation2.triggers.length > 0) {
|
|
12835
|
-
console.log(
|
|
12880
|
+
console.log(chalk18.gray(` Triggers: ${automation2.triggers.map(formatTrigger).join(", ")}`));
|
|
12836
12881
|
}
|
|
12837
12882
|
if (automation2.cron_next_fire_at) {
|
|
12838
|
-
console.log(
|
|
12883
|
+
console.log(chalk18.gray(` Next Run: ${formatDate2(automation2.cron_next_fire_at)}`));
|
|
12839
12884
|
}
|
|
12840
12885
|
console.log();
|
|
12841
12886
|
} catch (error) {
|
|
12842
|
-
console.error(
|
|
12887
|
+
console.error(chalk18.red(`Error: ${error instanceof Error ? error.message : "Unknown error"}`));
|
|
12843
12888
|
process.exit(1);
|
|
12844
12889
|
}
|
|
12845
12890
|
}
|
|
@@ -12847,18 +12892,18 @@ async function automationEditCommand(id, options) {
|
|
|
12847
12892
|
ensureOrgApiAuthenticated();
|
|
12848
12893
|
const validLifecycles = ["default", "delete_when_done", "delete_after_inactivity"];
|
|
12849
12894
|
if (options.lifecycle && !validLifecycles.includes(options.lifecycle)) {
|
|
12850
|
-
console.log(
|
|
12851
|
-
console.log(
|
|
12895
|
+
console.log(chalk18.red(`Invalid lifecycle policy: ${options.lifecycle}`));
|
|
12896
|
+
console.log(chalk18.gray(`Valid options: ${validLifecycles.join(", ")}`));
|
|
12852
12897
|
process.exit(1);
|
|
12853
12898
|
}
|
|
12854
12899
|
if (options.autoStopMinutes && options.lifecycle !== "delete_after_inactivity") {
|
|
12855
|
-
console.log(
|
|
12900
|
+
console.log(chalk18.red("--auto-stop-minutes requires --lifecycle delete_after_inactivity"));
|
|
12856
12901
|
process.exit(1);
|
|
12857
12902
|
}
|
|
12858
12903
|
if (options.autoStopMinutes) {
|
|
12859
12904
|
const minutes = parseInt(options.autoStopMinutes, 10);
|
|
12860
12905
|
if (isNaN(minutes) || minutes < 3 || minutes > 1440) {
|
|
12861
|
-
console.log(
|
|
12906
|
+
console.log(chalk18.red("--auto-stop-minutes must be between 3 and 1440"));
|
|
12862
12907
|
process.exit(1);
|
|
12863
12908
|
}
|
|
12864
12909
|
}
|
|
@@ -12954,8 +12999,8 @@ async function automationEditCommand(id, options) {
|
|
|
12954
12999
|
for (const repoName of repoNames) {
|
|
12955
13000
|
const repo = repoResponse.repositories.find((r) => r.name === repoName);
|
|
12956
13001
|
if (!repo) {
|
|
12957
|
-
console.log(
|
|
12958
|
-
console.log(
|
|
13002
|
+
console.log(chalk18.red(`Repository not found for trigger filter: ${repoName}`));
|
|
13003
|
+
console.log(chalk18.gray(`Available: ${repoResponse.repositories.map((r) => r.name).join(", ")}`));
|
|
12959
13004
|
process.exit(1);
|
|
12960
13005
|
}
|
|
12961
13006
|
githubRepoIds.push(repo.id);
|
|
@@ -12988,25 +13033,25 @@ async function automationEditCommand(id, options) {
|
|
|
12988
13033
|
Object.assign(body, agentSelection);
|
|
12989
13034
|
}
|
|
12990
13035
|
if (Object.keys(body).length === 0) {
|
|
12991
|
-
console.log(
|
|
13036
|
+
console.log(chalk18.yellow("\nNo changes made.\n"));
|
|
12992
13037
|
return;
|
|
12993
13038
|
}
|
|
12994
|
-
console.log(
|
|
13039
|
+
console.log(chalk18.gray("\nUpdating automation..."));
|
|
12995
13040
|
const response = await orgAuthenticatedFetch(`/v1/automations/${id}`, {
|
|
12996
13041
|
method: "PATCH",
|
|
12997
13042
|
body
|
|
12998
13043
|
});
|
|
12999
13044
|
const automation2 = response.automation;
|
|
13000
|
-
console.log(
|
|
13045
|
+
console.log(chalk18.green(`
|
|
13001
13046
|
Updated automation: ${automation2.name}`));
|
|
13002
|
-
console.log(
|
|
13003
|
-
console.log(
|
|
13047
|
+
console.log(chalk18.gray(` ID: ${automation2.id}`));
|
|
13048
|
+
console.log(chalk18.gray(` Enabled: ${automation2.enabled ? "yes" : "no"}`));
|
|
13004
13049
|
if (automation2.triggers.length > 0) {
|
|
13005
|
-
console.log(
|
|
13050
|
+
console.log(chalk18.gray(` Triggers: ${automation2.triggers.map(formatTrigger).join(", ")}`));
|
|
13006
13051
|
}
|
|
13007
13052
|
console.log();
|
|
13008
13053
|
} catch (error) {
|
|
13009
|
-
console.error(
|
|
13054
|
+
console.error(chalk18.red(`Error: ${error instanceof Error ? error.message : "Unknown error"}`));
|
|
13010
13055
|
process.exit(1);
|
|
13011
13056
|
}
|
|
13012
13057
|
}
|
|
@@ -13017,12 +13062,12 @@ async function automationRunCommand(id) {
|
|
|
13017
13062
|
const automation2 = existing.automation;
|
|
13018
13063
|
const hasCronTrigger = automation2.triggers.some((t) => t.type === "cron");
|
|
13019
13064
|
if (!hasCronTrigger) {
|
|
13020
|
-
console.log(
|
|
13021
|
-
console.log(
|
|
13065
|
+
console.log(chalk18.red("\nManual run is only allowed for automations with a cron trigger."));
|
|
13066
|
+
console.log(chalk18.gray(`This automation has triggers: ${automation2.triggers.map(formatTrigger).join(", ")}`));
|
|
13022
13067
|
console.log();
|
|
13023
13068
|
process.exit(1);
|
|
13024
13069
|
}
|
|
13025
|
-
console.log(
|
|
13070
|
+
console.log(chalk18.gray(`
|
|
13026
13071
|
Triggering automation "${automation2.name}"...`));
|
|
13027
13072
|
const response = await orgAuthenticatedFetch(
|
|
13028
13073
|
`/v1/automations/${id}/trigger`,
|
|
@@ -13032,20 +13077,20 @@ Triggering automation "${automation2.name}"...`));
|
|
|
13032
13077
|
}
|
|
13033
13078
|
);
|
|
13034
13079
|
if (!response.execution_id) {
|
|
13035
|
-
console.log(
|
|
13080
|
+
console.log(chalk18.red(`
|
|
13036
13081
|
Automation trigger returned no execution ID. The automation may not have started.`));
|
|
13037
13082
|
console.log();
|
|
13038
13083
|
process.exit(1);
|
|
13039
13084
|
}
|
|
13040
|
-
console.log(
|
|
13085
|
+
console.log(chalk18.green(`
|
|
13041
13086
|
Automation triggered successfully.`));
|
|
13042
|
-
console.log(
|
|
13087
|
+
console.log(chalk18.gray(` Execution ID: ${response.execution_id}`));
|
|
13043
13088
|
if (response.workspace_id) {
|
|
13044
|
-
console.log(
|
|
13089
|
+
console.log(chalk18.gray(` Workspace ID: ${response.workspace_id}`));
|
|
13045
13090
|
}
|
|
13046
13091
|
console.log();
|
|
13047
13092
|
} catch (error) {
|
|
13048
|
-
console.error(
|
|
13093
|
+
console.error(chalk18.red(`Error: ${error instanceof Error ? error.message : "Unknown error"}`));
|
|
13049
13094
|
process.exit(1);
|
|
13050
13095
|
}
|
|
13051
13096
|
}
|
|
@@ -13062,24 +13107,24 @@ async function automationDeleteCommand(id, options) {
|
|
|
13062
13107
|
initial: false
|
|
13063
13108
|
});
|
|
13064
13109
|
if (!response.confirm) {
|
|
13065
|
-
console.log(
|
|
13110
|
+
console.log(chalk18.yellow("\nCancelled."));
|
|
13066
13111
|
return;
|
|
13067
13112
|
}
|
|
13068
13113
|
}
|
|
13069
13114
|
await orgAuthenticatedFetch(`/v1/automations/${id}`, {
|
|
13070
13115
|
method: "DELETE"
|
|
13071
13116
|
});
|
|
13072
|
-
console.log(
|
|
13117
|
+
console.log(chalk18.green(`
|
|
13073
13118
|
Automation "${automationName}" (${id}) deleted.
|
|
13074
13119
|
`));
|
|
13075
13120
|
} catch (error) {
|
|
13076
|
-
console.error(
|
|
13121
|
+
console.error(chalk18.red(`Error: ${error instanceof Error ? error.message : "Unknown error"}`));
|
|
13077
13122
|
process.exit(1);
|
|
13078
13123
|
}
|
|
13079
13124
|
}
|
|
13080
13125
|
|
|
13081
13126
|
// src/commands/preview.ts
|
|
13082
|
-
import
|
|
13127
|
+
import chalk19 from "chalk";
|
|
13083
13128
|
|
|
13084
13129
|
// src/lib/agent-api.ts
|
|
13085
13130
|
var MONOLITH_URL3 = process.env.MONOLITH_URL || process.env.REPLICAS_MONOLITH_URL || "https://api.tryreplicas.com";
|
|
@@ -13180,11 +13225,11 @@ async function previewListCommand(workspaceId) {
|
|
|
13180
13225
|
`/v1/workspaces/${workspaceId}/previews`
|
|
13181
13226
|
);
|
|
13182
13227
|
if (result.previews.length === 0) {
|
|
13183
|
-
console.log(
|
|
13228
|
+
console.log(chalk19.dim("No active previews"));
|
|
13184
13229
|
return;
|
|
13185
13230
|
}
|
|
13186
13231
|
for (const preview2 of result.previews) {
|
|
13187
|
-
console.log(` ${
|
|
13232
|
+
console.log(` ${chalk19.cyan(String(preview2.port))} \u2192 ${chalk19.underline(preview2.publicUrl)}`);
|
|
13188
13233
|
}
|
|
13189
13234
|
}
|
|
13190
13235
|
}
|
|
@@ -13197,7 +13242,7 @@ async function previewAddCommand(workspaceId, options) {
|
|
|
13197
13242
|
body: { port: portNum, authenticated: options.authenticated ?? false }
|
|
13198
13243
|
}
|
|
13199
13244
|
);
|
|
13200
|
-
console.log(
|
|
13245
|
+
console.log(chalk19.green(`Preview created: ${result.preview.publicUrl}`));
|
|
13201
13246
|
}
|
|
13202
13247
|
async function previewDeleteCommand(port) {
|
|
13203
13248
|
const portNum = parsePreviewPort(port);
|
|
@@ -13210,7 +13255,7 @@ async function previewRemoveCommand(workspaceId, options) {
|
|
|
13210
13255
|
`/v1/workspaces/${workspaceId}/previews/${portNum}`,
|
|
13211
13256
|
{ method: "DELETE" }
|
|
13212
13257
|
);
|
|
13213
|
-
console.log(
|
|
13258
|
+
console.log(chalk19.green(`Preview deleted on port ${portNum}`));
|
|
13214
13259
|
}
|
|
13215
13260
|
|
|
13216
13261
|
// src/commands/media.ts
|
|
@@ -13309,7 +13354,7 @@ async function mediaListCommand(options) {
|
|
|
13309
13354
|
import { spawn as spawn3, spawnSync } from "child_process";
|
|
13310
13355
|
import { closeSync, existsSync, mkdirSync, openSync, readFileSync, readSync, rmSync, writeFileSync } from "fs";
|
|
13311
13356
|
import { dirname, isAbsolute, resolve } from "path";
|
|
13312
|
-
import
|
|
13357
|
+
import chalk20 from "chalk";
|
|
13313
13358
|
var STATE_DIR = process.env.REPLICAS_DESKTOP_STATE_DIR || "/tmp/replicas-computer";
|
|
13314
13359
|
var DEFAULT_DISPLAY = process.env.REPLICAS_DESKTOP_DISPLAY || ":99";
|
|
13315
13360
|
var NOVNC_PORT = process.env.REPLICAS_DESKTOP_NOVNC_PORT ? parseInt(process.env.REPLICAS_DESKTOP_NOVNC_PORT, 10) : DESKTOP_NOVNC_PORT;
|
|
@@ -13375,20 +13420,20 @@ async function computerInfoCommand() {
|
|
|
13375
13420
|
);
|
|
13376
13421
|
}
|
|
13377
13422
|
console.log(viewerUrl);
|
|
13378
|
-
console.error(
|
|
13423
|
+
console.error(chalk20.dim(`Share this URL with the user to let them watch the desktop live.`));
|
|
13379
13424
|
}
|
|
13380
13425
|
async function computerStatusCommand() {
|
|
13381
13426
|
const procs = ["Xvfb", "openbox", "tint2", "x11vnc", "websockify"];
|
|
13382
13427
|
for (const p of procs) {
|
|
13383
13428
|
const r = spawnSync("pgrep", ["-af", p], { stdio: "pipe" });
|
|
13384
13429
|
const running = r.status === 0 && !!r.stdout?.toString().trim();
|
|
13385
|
-
console.log(` ${running ?
|
|
13430
|
+
console.log(` ${running ? chalk20.green("\u25CF") : chalk20.red("\u25CB")} ${p}`);
|
|
13386
13431
|
}
|
|
13387
13432
|
const viewerUrl = await lookupDesktopViewerUrl();
|
|
13388
13433
|
if (viewerUrl) {
|
|
13389
|
-
console.log(` ${
|
|
13434
|
+
console.log(` ${chalk20.cyan("preview")}: ${viewerUrl}`);
|
|
13390
13435
|
} else {
|
|
13391
|
-
console.log(` ${
|
|
13436
|
+
console.log(` ${chalk20.dim("preview: not yet registered (engine registers it at startup)")}`);
|
|
13392
13437
|
}
|
|
13393
13438
|
}
|
|
13394
13439
|
var PNG_SIGNATURE = Buffer.from([137, 80, 78, 71, 13, 10, 26, 10]);
|
|
@@ -13670,7 +13715,7 @@ async function computerRecordStopCommand() {
|
|
|
13670
13715
|
}
|
|
13671
13716
|
|
|
13672
13717
|
// src/commands/interactive.ts
|
|
13673
|
-
import
|
|
13718
|
+
import chalk21 from "chalk";
|
|
13674
13719
|
|
|
13675
13720
|
// src/interactive/index.tsx
|
|
13676
13721
|
import { createCliRenderer } from "@opentui/core";
|
|
@@ -16778,13 +16823,13 @@ async function interactiveCommand() {
|
|
|
16778
16823
|
'No organization selected. Please run "replicas org switch" to select an organization.'
|
|
16779
16824
|
);
|
|
16780
16825
|
}
|
|
16781
|
-
console.log(
|
|
16826
|
+
console.log(chalk21.gray("Starting interactive mode..."));
|
|
16782
16827
|
await launchInteractive();
|
|
16783
16828
|
}
|
|
16784
16829
|
|
|
16785
16830
|
// src/commands/environment.ts
|
|
16786
16831
|
import fs5 from "fs";
|
|
16787
|
-
import
|
|
16832
|
+
import chalk22 from "chalk";
|
|
16788
16833
|
import prompts5 from "prompts";
|
|
16789
16834
|
var UUID_RE = /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/;
|
|
16790
16835
|
function maskValue(value) {
|
|
@@ -16797,38 +16842,38 @@ async function resolveEnvironmentId(input) {
|
|
|
16797
16842
|
const response = await orgAuthenticatedFetch("/v1/environments");
|
|
16798
16843
|
const env = response.environments.find((e) => e.name === input);
|
|
16799
16844
|
if (!env) {
|
|
16800
|
-
console.log(
|
|
16845
|
+
console.log(chalk22.red(`Environment not found: ${input}`));
|
|
16801
16846
|
const available = response.environments.map((e) => e.name).join(", ");
|
|
16802
|
-
console.log(
|
|
16847
|
+
console.log(chalk22.gray(`Available: ${available || "(none)"}`));
|
|
16803
16848
|
process.exit(1);
|
|
16804
16849
|
}
|
|
16805
16850
|
return env.id;
|
|
16806
16851
|
}
|
|
16807
16852
|
function printEnvironment(env) {
|
|
16808
|
-
console.log(
|
|
16809
|
-
console.log(
|
|
16853
|
+
console.log(chalk22.white(` ${env.name}${env.is_global ? chalk22.gray(" (global)") : ""}`));
|
|
16854
|
+
console.log(chalk22.gray(` ID: ${env.id}`));
|
|
16810
16855
|
if (env.description) {
|
|
16811
|
-
console.log(
|
|
16856
|
+
console.log(chalk22.gray(` Description: ${env.description}`));
|
|
16812
16857
|
}
|
|
16813
16858
|
if (env.repository_id) {
|
|
16814
|
-
console.log(
|
|
16859
|
+
console.log(chalk22.gray(` Repository: ${env.repository_id}`));
|
|
16815
16860
|
} else if (env.repository_set_id) {
|
|
16816
|
-
console.log(
|
|
16861
|
+
console.log(chalk22.gray(` Repository Set: ${env.repository_set_id}`));
|
|
16817
16862
|
}
|
|
16818
16863
|
if (env.variable_count !== void 0) {
|
|
16819
|
-
console.log(
|
|
16864
|
+
console.log(chalk22.gray(` Variables: ${env.variable_count}, Files: ${env.file_count ?? 0}, Skills: ${env.skill_count ?? 0}, MCPs: ${env.mcp_count ?? 0}`));
|
|
16820
16865
|
}
|
|
16821
|
-
console.log(
|
|
16866
|
+
console.log(chalk22.gray(` Updated: ${formatDate2(env.updated_at)}`));
|
|
16822
16867
|
console.log();
|
|
16823
16868
|
}
|
|
16824
16869
|
async function environmentListCommand() {
|
|
16825
16870
|
ensureOrgApiAuthenticated();
|
|
16826
16871
|
const response = await orgAuthenticatedFetch("/v1/environments");
|
|
16827
16872
|
if (response.environments.length === 0) {
|
|
16828
|
-
console.log(
|
|
16873
|
+
console.log(chalk22.yellow("\nNo environments found.\n"));
|
|
16829
16874
|
return;
|
|
16830
16875
|
}
|
|
16831
|
-
console.log(
|
|
16876
|
+
console.log(chalk22.green(`
|
|
16832
16877
|
Environments (${response.environments.length}):
|
|
16833
16878
|
`));
|
|
16834
16879
|
for (const env of response.environments) {
|
|
@@ -16839,7 +16884,7 @@ async function environmentGetCommand(idOrName) {
|
|
|
16839
16884
|
ensureOrgApiAuthenticated();
|
|
16840
16885
|
const id = await resolveEnvironmentId(idOrName);
|
|
16841
16886
|
const response = await orgAuthenticatedFetch(`/v1/environments/${id}`);
|
|
16842
|
-
console.log(
|
|
16887
|
+
console.log(chalk22.green(`
|
|
16843
16888
|
Environment: ${response.environment.name}
|
|
16844
16889
|
`));
|
|
16845
16890
|
printEnvironment(response.environment);
|
|
@@ -16855,7 +16900,7 @@ async function environmentCreateCommand(name, options) {
|
|
|
16855
16900
|
validate: (v) => v.trim() ? true : "Name is required"
|
|
16856
16901
|
});
|
|
16857
16902
|
if (!r.name) {
|
|
16858
|
-
console.log(
|
|
16903
|
+
console.log(chalk22.yellow("\nCancelled."));
|
|
16859
16904
|
return;
|
|
16860
16905
|
}
|
|
16861
16906
|
envName = r.name;
|
|
@@ -16868,8 +16913,8 @@ async function environmentCreateCommand(name, options) {
|
|
|
16868
16913
|
const repos2 = await orgAuthenticatedFetch("/v1/repositories");
|
|
16869
16914
|
const repo = repos2.repositories.find((r) => r.name === options.repository);
|
|
16870
16915
|
if (!repo) {
|
|
16871
|
-
console.log(
|
|
16872
|
-
console.log(
|
|
16916
|
+
console.log(chalk22.red(`Repository not found: ${options.repository}`));
|
|
16917
|
+
console.log(chalk22.gray(`Available: ${repos2.repositories.map((r) => r.name).join(", ")}`));
|
|
16873
16918
|
process.exit(1);
|
|
16874
16919
|
}
|
|
16875
16920
|
repositoryId = repo.id;
|
|
@@ -16899,9 +16944,9 @@ async function environmentCreateCommand(name, options) {
|
|
|
16899
16944
|
method: "POST",
|
|
16900
16945
|
body
|
|
16901
16946
|
});
|
|
16902
|
-
console.log(
|
|
16947
|
+
console.log(chalk22.green(`
|
|
16903
16948
|
Created environment: ${response.environment.name}`));
|
|
16904
|
-
console.log(
|
|
16949
|
+
console.log(chalk22.gray(` ID: ${response.environment.id}
|
|
16905
16950
|
`));
|
|
16906
16951
|
}
|
|
16907
16952
|
async function environmentEditCommand(idOrName, options) {
|
|
@@ -16920,21 +16965,21 @@ async function environmentEditCommand(idOrName, options) {
|
|
|
16920
16965
|
const repos2 = await orgAuthenticatedFetch("/v1/repositories");
|
|
16921
16966
|
const repo = repos2.repositories.find((r) => r.name === options.repository);
|
|
16922
16967
|
if (!repo) {
|
|
16923
|
-
console.log(
|
|
16968
|
+
console.log(chalk22.red(`Repository not found: ${options.repository}`));
|
|
16924
16969
|
process.exit(1);
|
|
16925
16970
|
}
|
|
16926
16971
|
body.repository_id = repo.id;
|
|
16927
16972
|
}
|
|
16928
16973
|
}
|
|
16929
16974
|
if (Object.keys(body).length === 0) {
|
|
16930
|
-
console.log(
|
|
16975
|
+
console.log(chalk22.yellow("\nNo changes specified. Pass --name, --description, --repository, or --system-prompt."));
|
|
16931
16976
|
return;
|
|
16932
16977
|
}
|
|
16933
16978
|
const response = await orgAuthenticatedFetch(`/v1/environments/${id}`, {
|
|
16934
16979
|
method: "PATCH",
|
|
16935
16980
|
body
|
|
16936
16981
|
});
|
|
16937
|
-
console.log(
|
|
16982
|
+
console.log(chalk22.green(`
|
|
16938
16983
|
Updated environment: ${response.environment.name}
|
|
16939
16984
|
`));
|
|
16940
16985
|
}
|
|
@@ -16949,20 +16994,20 @@ async function environmentDeleteCommand(idOrName, options) {
|
|
|
16949
16994
|
initial: false
|
|
16950
16995
|
});
|
|
16951
16996
|
if (!r.confirm) {
|
|
16952
|
-
console.log(
|
|
16997
|
+
console.log(chalk22.yellow("\nCancelled."));
|
|
16953
16998
|
return;
|
|
16954
16999
|
}
|
|
16955
17000
|
}
|
|
16956
17001
|
await orgAuthenticatedFetch(`/v1/environments/${id}`, { method: "DELETE" });
|
|
16957
|
-
console.log(
|
|
17002
|
+
console.log(chalk22.green(`
|
|
16958
17003
|
Deleted environment ${idOrName}.
|
|
16959
17004
|
`));
|
|
16960
17005
|
}
|
|
16961
17006
|
function printVariable(v, reveal) {
|
|
16962
|
-
console.log(
|
|
16963
|
-
console.log(
|
|
16964
|
-
console.log(
|
|
16965
|
-
console.log(
|
|
17007
|
+
console.log(chalk22.white(` ${v.key}`));
|
|
17008
|
+
console.log(chalk22.gray(` ID: ${v.id}`));
|
|
17009
|
+
console.log(chalk22.gray(` Value: ${reveal ? v.value : maskValue(v.value)}`));
|
|
17010
|
+
console.log(chalk22.gray(` Updated: ${formatDate2(v.updated_at)}`));
|
|
16966
17011
|
console.log();
|
|
16967
17012
|
}
|
|
16968
17013
|
async function envVarsListCommand(envIdOrName, options) {
|
|
@@ -16972,14 +17017,14 @@ async function envVarsListCommand(envIdOrName, options) {
|
|
|
16972
17017
|
`/v1/environments/${id}/variables`
|
|
16973
17018
|
);
|
|
16974
17019
|
if (response.environment_variables.length === 0) {
|
|
16975
|
-
console.log(
|
|
17020
|
+
console.log(chalk22.yellow("\nNo variables.\n"));
|
|
16976
17021
|
return;
|
|
16977
17022
|
}
|
|
16978
|
-
console.log(
|
|
17023
|
+
console.log(chalk22.green(`
|
|
16979
17024
|
Variables (${response.environment_variables.length}):
|
|
16980
17025
|
`));
|
|
16981
17026
|
if (!options.reveal) {
|
|
16982
|
-
console.log(
|
|
17027
|
+
console.log(chalk22.gray(" Values are masked. Pass --reveal to show full values.\n"));
|
|
16983
17028
|
}
|
|
16984
17029
|
for (const v of response.environment_variables) printVariable(v, !!options.reveal);
|
|
16985
17030
|
}
|
|
@@ -16996,7 +17041,7 @@ async function envVarsSetCommand(envIdOrName, key, value) {
|
|
|
16996
17041
|
`/v1/environments/${id}/variables/${match.id}`,
|
|
16997
17042
|
{ method: "PATCH", body: body2 }
|
|
16998
17043
|
);
|
|
16999
|
-
console.log(
|
|
17044
|
+
console.log(chalk22.green(`
|
|
17000
17045
|
Updated variable ${response2.environment_variable.key}.
|
|
17001
17046
|
`));
|
|
17002
17047
|
return;
|
|
@@ -17010,7 +17055,7 @@ Updated variable ${response2.environment_variable.key}.
|
|
|
17010
17055
|
`/v1/environments/${id}/variables`,
|
|
17011
17056
|
{ method: "POST", body }
|
|
17012
17057
|
);
|
|
17013
|
-
console.log(
|
|
17058
|
+
console.log(chalk22.green(`
|
|
17014
17059
|
Created variable ${response.environment_variable.key}.
|
|
17015
17060
|
`));
|
|
17016
17061
|
}
|
|
@@ -17024,7 +17069,7 @@ async function envVarsDeleteCommand(envIdOrName, keyOrId, options) {
|
|
|
17024
17069
|
);
|
|
17025
17070
|
const match = existing.environment_variables.find((v) => v.key === keyOrId);
|
|
17026
17071
|
if (!match) {
|
|
17027
|
-
console.log(
|
|
17072
|
+
console.log(chalk22.red(`Variable not found: ${keyOrId}`));
|
|
17028
17073
|
process.exit(1);
|
|
17029
17074
|
}
|
|
17030
17075
|
variableId = match.id;
|
|
@@ -17037,23 +17082,23 @@ async function envVarsDeleteCommand(envIdOrName, keyOrId, options) {
|
|
|
17037
17082
|
initial: false
|
|
17038
17083
|
});
|
|
17039
17084
|
if (!r.confirm) {
|
|
17040
|
-
console.log(
|
|
17085
|
+
console.log(chalk22.yellow("\nCancelled."));
|
|
17041
17086
|
return;
|
|
17042
17087
|
}
|
|
17043
17088
|
}
|
|
17044
17089
|
await orgAuthenticatedFetch(`/v1/environments/${id}/variables/${variableId}`, {
|
|
17045
17090
|
method: "DELETE"
|
|
17046
17091
|
});
|
|
17047
|
-
console.log(
|
|
17092
|
+
console.log(chalk22.green(`
|
|
17048
17093
|
Deleted variable ${keyOrId}.
|
|
17049
17094
|
`));
|
|
17050
17095
|
}
|
|
17051
17096
|
function printFile(f) {
|
|
17052
|
-
console.log(
|
|
17053
|
-
console.log(
|
|
17054
|
-
console.log(
|
|
17055
|
-
console.log(
|
|
17056
|
-
console.log(
|
|
17097
|
+
console.log(chalk22.white(` ${f.path}`));
|
|
17098
|
+
console.log(chalk22.gray(` ID: ${f.id}`));
|
|
17099
|
+
console.log(chalk22.gray(` Name: ${f.name}`));
|
|
17100
|
+
console.log(chalk22.gray(` Size: ${f.content.length} bytes`));
|
|
17101
|
+
console.log(chalk22.gray(` Updated: ${formatDate2(f.updated_at)}`));
|
|
17057
17102
|
console.log();
|
|
17058
17103
|
}
|
|
17059
17104
|
async function envFilesListCommand(envIdOrName) {
|
|
@@ -17063,10 +17108,10 @@ async function envFilesListCommand(envIdOrName) {
|
|
|
17063
17108
|
`/v1/environments/${id}/files`
|
|
17064
17109
|
);
|
|
17065
17110
|
if (response.environment_files.length === 0) {
|
|
17066
|
-
console.log(
|
|
17111
|
+
console.log(chalk22.yellow("\nNo files.\n"));
|
|
17067
17112
|
return;
|
|
17068
17113
|
}
|
|
17069
|
-
console.log(
|
|
17114
|
+
console.log(chalk22.green(`
|
|
17070
17115
|
Files (${response.environment_files.length}):
|
|
17071
17116
|
`));
|
|
17072
17117
|
for (const f of response.environment_files) printFile(f);
|
|
@@ -17097,7 +17142,7 @@ async function envFilesSetCommand(envIdOrName, destinationPath, options) {
|
|
|
17097
17142
|
`/v1/environments/${id}/files/${match.id}`,
|
|
17098
17143
|
{ method: "PATCH", body: body2 }
|
|
17099
17144
|
);
|
|
17100
|
-
console.log(
|
|
17145
|
+
console.log(chalk22.green(`
|
|
17101
17146
|
Updated file ${response2.environment_file.path}.
|
|
17102
17147
|
`));
|
|
17103
17148
|
return;
|
|
@@ -17112,7 +17157,7 @@ Updated file ${response2.environment_file.path}.
|
|
|
17112
17157
|
`/v1/environments/${id}/files`,
|
|
17113
17158
|
{ method: "POST", body }
|
|
17114
17159
|
);
|
|
17115
|
-
console.log(
|
|
17160
|
+
console.log(chalk22.green(`
|
|
17116
17161
|
Created file ${response.environment_file.path}.
|
|
17117
17162
|
`));
|
|
17118
17163
|
}
|
|
@@ -17126,7 +17171,7 @@ async function envFilesDeleteCommand(envIdOrName, pathOrId, options) {
|
|
|
17126
17171
|
);
|
|
17127
17172
|
const match = existing.environment_files.find((f) => f.path === pathOrId);
|
|
17128
17173
|
if (!match) {
|
|
17129
|
-
console.log(
|
|
17174
|
+
console.log(chalk22.red(`File not found: ${pathOrId}`));
|
|
17130
17175
|
process.exit(1);
|
|
17131
17176
|
}
|
|
17132
17177
|
fileId = match.id;
|
|
@@ -17139,14 +17184,14 @@ async function envFilesDeleteCommand(envIdOrName, pathOrId, options) {
|
|
|
17139
17184
|
initial: false
|
|
17140
17185
|
});
|
|
17141
17186
|
if (!r.confirm) {
|
|
17142
|
-
console.log(
|
|
17187
|
+
console.log(chalk22.yellow("\nCancelled."));
|
|
17143
17188
|
return;
|
|
17144
17189
|
}
|
|
17145
17190
|
}
|
|
17146
17191
|
await orgAuthenticatedFetch(`/v1/environments/${id}/files/${fileId}`, {
|
|
17147
17192
|
method: "DELETE"
|
|
17148
17193
|
});
|
|
17149
|
-
console.log(
|
|
17194
|
+
console.log(chalk22.green(`
|
|
17150
17195
|
Deleted file ${pathOrId}.
|
|
17151
17196
|
`));
|
|
17152
17197
|
}
|
|
@@ -17157,15 +17202,15 @@ async function envStartHookGetCommand(envIdOrName) {
|
|
|
17157
17202
|
`/v1/environments/${id}/start-hooks`
|
|
17158
17203
|
);
|
|
17159
17204
|
if (!response.start_hook) {
|
|
17160
|
-
console.log(
|
|
17205
|
+
console.log(chalk22.yellow("\nNo start hook configured.\n"));
|
|
17161
17206
|
return;
|
|
17162
17207
|
}
|
|
17163
17208
|
const hook = response.start_hook;
|
|
17164
|
-
console.log(
|
|
17209
|
+
console.log(chalk22.green(`
|
|
17165
17210
|
Start hook (v${hook.version}, ${hook.is_active ? "active" : "inactive"}):
|
|
17166
17211
|
`));
|
|
17167
|
-
console.log(
|
|
17168
|
-
console.log(
|
|
17212
|
+
console.log(chalk22.gray(` ID: ${hook.id}`));
|
|
17213
|
+
console.log(chalk22.gray(` Created: ${formatDate2(hook.created_at)}
|
|
17169
17214
|
`));
|
|
17170
17215
|
console.log(hook.content);
|
|
17171
17216
|
console.log();
|
|
@@ -17179,7 +17224,7 @@ async function envStartHookSaveCommand(envIdOrName, options) {
|
|
|
17179
17224
|
`/v1/environments/${id}/start-hooks/save`,
|
|
17180
17225
|
{ method: "POST", body }
|
|
17181
17226
|
);
|
|
17182
|
-
console.log(
|
|
17227
|
+
console.log(chalk22.green(`
|
|
17183
17228
|
Saved start hook v${response.start_hook.version}.
|
|
17184
17229
|
`));
|
|
17185
17230
|
}
|
|
@@ -17196,7 +17241,7 @@ async function envStartHookTestCommand(envIdOrName, options) {
|
|
|
17196
17241
|
body: { content },
|
|
17197
17242
|
onEvent: (event) => {
|
|
17198
17243
|
if (event.type === "progress" && event.message) {
|
|
17199
|
-
console.log(
|
|
17244
|
+
console.log(chalk22.gray(event.message));
|
|
17200
17245
|
} else if (event.type === "output" && event.output) {
|
|
17201
17246
|
process.stdout.write(event.output);
|
|
17202
17247
|
} else if (event.type === "complete") {
|
|
@@ -17209,21 +17254,21 @@ async function envStartHookTestCommand(envIdOrName, options) {
|
|
|
17209
17254
|
}
|
|
17210
17255
|
);
|
|
17211
17256
|
if (errorMessage) {
|
|
17212
|
-
console.log(
|
|
17257
|
+
console.log(chalk22.red(`
|
|
17213
17258
|
${errorMessage}
|
|
17214
17259
|
`));
|
|
17215
17260
|
process.exit(1);
|
|
17216
17261
|
}
|
|
17217
17262
|
if (timedOut) {
|
|
17218
|
-
console.log(
|
|
17263
|
+
console.log(chalk22.yellow("\nStart hook timed out.\n"));
|
|
17219
17264
|
process.exit(1);
|
|
17220
17265
|
}
|
|
17221
17266
|
if (exitCode === 0) {
|
|
17222
|
-
console.log(
|
|
17267
|
+
console.log(chalk22.green(`
|
|
17223
17268
|
Start hook passed (exit code ${exitCode}).
|
|
17224
17269
|
`));
|
|
17225
17270
|
} else {
|
|
17226
|
-
console.log(
|
|
17271
|
+
console.log(chalk22.red(`
|
|
17227
17272
|
Start hook failed (exit code ${exitCode ?? "unknown"}).
|
|
17228
17273
|
`));
|
|
17229
17274
|
process.exit(1);
|
|
@@ -17236,24 +17281,24 @@ async function envStartHookRepositoryHooksCommand(envIdOrName) {
|
|
|
17236
17281
|
`/v1/environments/${id}/start-hooks/repository-hooks`
|
|
17237
17282
|
);
|
|
17238
17283
|
if (response.repositories.length === 0) {
|
|
17239
|
-
console.log(
|
|
17284
|
+
console.log(chalk22.yellow("\nNo repositories bound to this environment.\n"));
|
|
17240
17285
|
return;
|
|
17241
17286
|
}
|
|
17242
|
-
console.log(
|
|
17287
|
+
console.log(chalk22.green(`
|
|
17243
17288
|
Repository start hooks (${response.repositories.length}):
|
|
17244
17289
|
`));
|
|
17245
17290
|
for (const repo of response.repositories) {
|
|
17246
|
-
console.log(
|
|
17291
|
+
console.log(chalk22.white(` ${repo.repository_name} @${repo.default_branch}`));
|
|
17247
17292
|
if (repo.error) {
|
|
17248
|
-
console.log(
|
|
17293
|
+
console.log(chalk22.red(` Error: ${repo.error}`));
|
|
17249
17294
|
} else if (repo.start_hook) {
|
|
17250
|
-
console.log(
|
|
17251
|
-
console.log(
|
|
17295
|
+
console.log(chalk22.gray(` Source: ${repo.filename ?? "(unknown)"}`));
|
|
17296
|
+
console.log(chalk22.gray(` Commands (${repo.start_hook.commands.length}):`));
|
|
17252
17297
|
for (const cmd of repo.start_hook.commands) {
|
|
17253
|
-
console.log(
|
|
17298
|
+
console.log(chalk22.gray(` ${cmd}`));
|
|
17254
17299
|
}
|
|
17255
17300
|
} else {
|
|
17256
|
-
console.log(
|
|
17301
|
+
console.log(chalk22.gray(` No startHook defined.`));
|
|
17257
17302
|
}
|
|
17258
17303
|
console.log();
|
|
17259
17304
|
}
|
|
@@ -17272,7 +17317,7 @@ program.command("login").description("Authenticate with your Replicas account").
|
|
|
17272
17317
|
await loginCommand();
|
|
17273
17318
|
} catch (error) {
|
|
17274
17319
|
if (error instanceof Error) {
|
|
17275
|
-
console.error(
|
|
17320
|
+
console.error(chalk23.red(`
|
|
17276
17321
|
\u2717 ${error.message}
|
|
17277
17322
|
`));
|
|
17278
17323
|
}
|
|
@@ -17284,7 +17329,7 @@ program.command("init").description("Create a replicas.json or replicas.yaml con
|
|
|
17284
17329
|
initCommand(options);
|
|
17285
17330
|
} catch (error) {
|
|
17286
17331
|
if (error instanceof Error) {
|
|
17287
|
-
console.error(
|
|
17332
|
+
console.error(chalk23.red(`
|
|
17288
17333
|
\u2717 ${error.message}
|
|
17289
17334
|
`));
|
|
17290
17335
|
}
|
|
@@ -17296,7 +17341,7 @@ program.command("logout").description("Clear stored credentials").action(() => {
|
|
|
17296
17341
|
logoutCommand();
|
|
17297
17342
|
} catch (error) {
|
|
17298
17343
|
if (error instanceof Error) {
|
|
17299
|
-
console.error(
|
|
17344
|
+
console.error(chalk23.red(`
|
|
17300
17345
|
\u2717 ${error.message}
|
|
17301
17346
|
`));
|
|
17302
17347
|
}
|
|
@@ -17308,7 +17353,7 @@ program.command("whoami").description("Display current authenticated user").acti
|
|
|
17308
17353
|
await whoamiCommand();
|
|
17309
17354
|
} catch (error) {
|
|
17310
17355
|
if (error instanceof Error) {
|
|
17311
|
-
console.error(
|
|
17356
|
+
console.error(chalk23.red(`
|
|
17312
17357
|
\u2717 ${error.message}
|
|
17313
17358
|
`));
|
|
17314
17359
|
}
|
|
@@ -17320,7 +17365,7 @@ program.command("codex-auth").description("Authenticate Replicas with your Codex
|
|
|
17320
17365
|
await codexAuthCommand(options);
|
|
17321
17366
|
} catch (error) {
|
|
17322
17367
|
if (error instanceof Error) {
|
|
17323
|
-
console.error(
|
|
17368
|
+
console.error(chalk23.red(`
|
|
17324
17369
|
\u2717 ${error.message}
|
|
17325
17370
|
`));
|
|
17326
17371
|
}
|
|
@@ -17332,7 +17377,7 @@ program.command("claude-auth").description("Authenticate Replicas with your Clau
|
|
|
17332
17377
|
await claudeAuthCommand(options);
|
|
17333
17378
|
} catch (error) {
|
|
17334
17379
|
if (error instanceof Error) {
|
|
17335
|
-
console.error(
|
|
17380
|
+
console.error(chalk23.red(`
|
|
17336
17381
|
\u2717 ${error.message}
|
|
17337
17382
|
`));
|
|
17338
17383
|
}
|
|
@@ -17345,7 +17390,7 @@ org.command("switch").description("Switch to a different organization").action(a
|
|
|
17345
17390
|
await orgSwitchCommand();
|
|
17346
17391
|
} catch (error) {
|
|
17347
17392
|
if (error instanceof Error) {
|
|
17348
|
-
console.error(
|
|
17393
|
+
console.error(chalk23.red(`
|
|
17349
17394
|
\u2717 ${error.message}
|
|
17350
17395
|
`));
|
|
17351
17396
|
}
|
|
@@ -17357,7 +17402,7 @@ org.action(async () => {
|
|
|
17357
17402
|
await orgCommand();
|
|
17358
17403
|
} catch (error) {
|
|
17359
17404
|
if (error instanceof Error) {
|
|
17360
|
-
console.error(
|
|
17405
|
+
console.error(chalk23.red(`
|
|
17361
17406
|
\u2717 ${error.message}
|
|
17362
17407
|
`));
|
|
17363
17408
|
}
|
|
@@ -17369,7 +17414,7 @@ program.command("connect <workspace-name>").description("Connect to a workspace
|
|
|
17369
17414
|
await connectCommand(workspaceName);
|
|
17370
17415
|
} catch (error) {
|
|
17371
17416
|
if (error instanceof Error) {
|
|
17372
|
-
console.error(
|
|
17417
|
+
console.error(chalk23.red(`
|
|
17373
17418
|
\u2717 ${error.message}
|
|
17374
17419
|
`));
|
|
17375
17420
|
}
|
|
@@ -17381,7 +17426,7 @@ program.command("code <workspace-name>").description("Open a workspace in VSCode
|
|
|
17381
17426
|
await codeCommand(workspaceName);
|
|
17382
17427
|
} catch (error) {
|
|
17383
17428
|
if (error instanceof Error) {
|
|
17384
|
-
console.error(
|
|
17429
|
+
console.error(chalk23.red(`
|
|
17385
17430
|
\u2717 ${error.message}
|
|
17386
17431
|
`));
|
|
17387
17432
|
}
|
|
@@ -17394,7 +17439,7 @@ config.command("get <key>").description("Get a configuration value").action(asyn
|
|
|
17394
17439
|
await configGetCommand(key);
|
|
17395
17440
|
} catch (error) {
|
|
17396
17441
|
if (error instanceof Error) {
|
|
17397
|
-
console.error(
|
|
17442
|
+
console.error(chalk23.red(`
|
|
17398
17443
|
\u2717 ${error.message}
|
|
17399
17444
|
`));
|
|
17400
17445
|
}
|
|
@@ -17406,7 +17451,7 @@ config.command("set <key> <value>").description("Set a configuration value").act
|
|
|
17406
17451
|
await configSetCommand(key, value);
|
|
17407
17452
|
} catch (error) {
|
|
17408
17453
|
if (error instanceof Error) {
|
|
17409
|
-
console.error(
|
|
17454
|
+
console.error(chalk23.red(`
|
|
17410
17455
|
\u2717 ${error.message}
|
|
17411
17456
|
`));
|
|
17412
17457
|
}
|
|
@@ -17418,7 +17463,7 @@ config.command("list").description("List all configuration values").action(async
|
|
|
17418
17463
|
await configListCommand();
|
|
17419
17464
|
} catch (error) {
|
|
17420
17465
|
if (error instanceof Error) {
|
|
17421
|
-
console.error(
|
|
17466
|
+
console.error(chalk23.red(`
|
|
17422
17467
|
\u2717 ${error.message}
|
|
17423
17468
|
`));
|
|
17424
17469
|
}
|
|
@@ -17430,7 +17475,7 @@ program.command("list").description("List all replicas").option("-p, --page <pag
|
|
|
17430
17475
|
await replicaListCommand(options);
|
|
17431
17476
|
} catch (error) {
|
|
17432
17477
|
if (error instanceof Error) {
|
|
17433
|
-
console.error(
|
|
17478
|
+
console.error(chalk23.red(`
|
|
17434
17479
|
\u2717 ${error.message}
|
|
17435
17480
|
`));
|
|
17436
17481
|
}
|
|
@@ -17442,7 +17487,7 @@ program.command("get <id>").description("Get replica details by ID").action(asyn
|
|
|
17442
17487
|
await replicaGetCommand(id);
|
|
17443
17488
|
} catch (error) {
|
|
17444
17489
|
if (error instanceof Error) {
|
|
17445
|
-
console.error(
|
|
17490
|
+
console.error(chalk23.red(`
|
|
17446
17491
|
\u2717 ${error.message}
|
|
17447
17492
|
`));
|
|
17448
17493
|
}
|
|
@@ -17454,7 +17499,7 @@ program.command("create [name]").description("Create a new replica").option("-m,
|
|
|
17454
17499
|
await replicaCreateCommand(name, options);
|
|
17455
17500
|
} catch (error) {
|
|
17456
17501
|
if (error instanceof Error) {
|
|
17457
|
-
console.error(
|
|
17502
|
+
console.error(chalk23.red(`
|
|
17458
17503
|
\u2717 ${error.message}
|
|
17459
17504
|
`));
|
|
17460
17505
|
}
|
|
@@ -17466,7 +17511,7 @@ program.command("send <id>").description("Send a message to a replica").option("
|
|
|
17466
17511
|
await replicaSendCommand(id, options);
|
|
17467
17512
|
} catch (error) {
|
|
17468
17513
|
if (error instanceof Error) {
|
|
17469
|
-
console.error(
|
|
17514
|
+
console.error(chalk23.red(`
|
|
17470
17515
|
\u2717 ${error.message}
|
|
17471
17516
|
`));
|
|
17472
17517
|
}
|
|
@@ -17478,7 +17523,7 @@ program.command("delete <id>").description("Delete a replica").option("-f, --for
|
|
|
17478
17523
|
await replicaDeleteCommand(id, options);
|
|
17479
17524
|
} catch (error) {
|
|
17480
17525
|
if (error instanceof Error) {
|
|
17481
|
-
console.error(
|
|
17526
|
+
console.error(chalk23.red(`
|
|
17482
17527
|
\u2717 ${error.message}
|
|
17483
17528
|
`));
|
|
17484
17529
|
}
|
|
@@ -17490,7 +17535,7 @@ program.command("read <id>").description("Read conversation history of a replica
|
|
|
17490
17535
|
await replicaReadCommand(id, options);
|
|
17491
17536
|
} catch (error) {
|
|
17492
17537
|
if (error instanceof Error) {
|
|
17493
|
-
console.error(
|
|
17538
|
+
console.error(chalk23.red(`
|
|
17494
17539
|
\u2717 ${error.message}
|
|
17495
17540
|
`));
|
|
17496
17541
|
}
|
|
@@ -17503,7 +17548,7 @@ automation.command("list").description("List all automations").option("-p, --pag
|
|
|
17503
17548
|
await automationListCommand(options);
|
|
17504
17549
|
} catch (error) {
|
|
17505
17550
|
if (error instanceof Error) {
|
|
17506
|
-
console.error(
|
|
17551
|
+
console.error(chalk23.red(`
|
|
17507
17552
|
\u2717 ${error.message}
|
|
17508
17553
|
`));
|
|
17509
17554
|
}
|
|
@@ -17515,7 +17560,7 @@ automation.command("get <id>").description("Get automation details by ID").actio
|
|
|
17515
17560
|
await automationGetCommand(id);
|
|
17516
17561
|
} catch (error) {
|
|
17517
17562
|
if (error instanceof Error) {
|
|
17518
|
-
console.error(
|
|
17563
|
+
console.error(chalk23.red(`
|
|
17519
17564
|
\u2717 ${error.message}
|
|
17520
17565
|
`));
|
|
17521
17566
|
}
|
|
@@ -17530,7 +17575,7 @@ automation.command("create [name]").description("Create a new automation").optio
|
|
|
17530
17575
|
});
|
|
17531
17576
|
} catch (error) {
|
|
17532
17577
|
if (error instanceof Error) {
|
|
17533
|
-
console.error(
|
|
17578
|
+
console.error(chalk23.red(`
|
|
17534
17579
|
\u2717 ${error.message}
|
|
17535
17580
|
`));
|
|
17536
17581
|
}
|
|
@@ -17542,7 +17587,7 @@ automation.command("edit <id>").description("Edit an existing automation").optio
|
|
|
17542
17587
|
await automationEditCommand(id, options);
|
|
17543
17588
|
} catch (error) {
|
|
17544
17589
|
if (error instanceof Error) {
|
|
17545
|
-
console.error(
|
|
17590
|
+
console.error(chalk23.red(`
|
|
17546
17591
|
\u2717 ${error.message}
|
|
17547
17592
|
`));
|
|
17548
17593
|
}
|
|
@@ -17554,7 +17599,7 @@ automation.command("run <id>").description("Manually trigger an automation (cron
|
|
|
17554
17599
|
await automationRunCommand(id);
|
|
17555
17600
|
} catch (error) {
|
|
17556
17601
|
if (error instanceof Error) {
|
|
17557
|
-
console.error(
|
|
17602
|
+
console.error(chalk23.red(`
|
|
17558
17603
|
\u2717 ${error.message}
|
|
17559
17604
|
`));
|
|
17560
17605
|
}
|
|
@@ -17566,7 +17611,7 @@ automation.command("delete <id>").description("Delete an automation").option("-f
|
|
|
17566
17611
|
await automationDeleteCommand(id, options);
|
|
17567
17612
|
} catch (error) {
|
|
17568
17613
|
if (error instanceof Error) {
|
|
17569
|
-
console.error(
|
|
17614
|
+
console.error(chalk23.red(`
|
|
17570
17615
|
\u2717 ${error.message}
|
|
17571
17616
|
`));
|
|
17572
17617
|
}
|
|
@@ -17578,7 +17623,7 @@ automation.action(async () => {
|
|
|
17578
17623
|
await automationListCommand({});
|
|
17579
17624
|
} catch (error) {
|
|
17580
17625
|
if (error instanceof Error) {
|
|
17581
|
-
console.error(
|
|
17626
|
+
console.error(chalk23.red(`
|
|
17582
17627
|
\u2717 ${error.message}
|
|
17583
17628
|
`));
|
|
17584
17629
|
}
|
|
@@ -17591,7 +17636,7 @@ repos.command("list").description("List all repositories").action(async () => {
|
|
|
17591
17636
|
await repositoriesListCommand();
|
|
17592
17637
|
} catch (error) {
|
|
17593
17638
|
if (error instanceof Error) {
|
|
17594
|
-
console.error(
|
|
17639
|
+
console.error(chalk23.red(`
|
|
17595
17640
|
\u2717 ${error.message}
|
|
17596
17641
|
`));
|
|
17597
17642
|
}
|
|
@@ -17603,7 +17648,7 @@ repos.action(async () => {
|
|
|
17603
17648
|
await repositoriesListCommand();
|
|
17604
17649
|
} catch (error) {
|
|
17605
17650
|
if (error instanceof Error) {
|
|
17606
|
-
console.error(
|
|
17651
|
+
console.error(chalk23.red(`
|
|
17607
17652
|
\u2717 ${error.message}
|
|
17608
17653
|
`));
|
|
17609
17654
|
}
|
|
@@ -17616,7 +17661,7 @@ environment.command("list").description("List all environments").action(async ()
|
|
|
17616
17661
|
await environmentListCommand();
|
|
17617
17662
|
} catch (error) {
|
|
17618
17663
|
if (error instanceof Error) {
|
|
17619
|
-
console.error(
|
|
17664
|
+
console.error(chalk23.red(`
|
|
17620
17665
|
\u2717 ${error.message}
|
|
17621
17666
|
`));
|
|
17622
17667
|
}
|
|
@@ -17628,7 +17673,7 @@ environment.command("get <id-or-name>").description('Get an environment by ID or
|
|
|
17628
17673
|
await environmentGetCommand(idOrName);
|
|
17629
17674
|
} catch (error) {
|
|
17630
17675
|
if (error instanceof Error) {
|
|
17631
|
-
console.error(
|
|
17676
|
+
console.error(chalk23.red(`
|
|
17632
17677
|
\u2717 ${error.message}
|
|
17633
17678
|
`));
|
|
17634
17679
|
}
|
|
@@ -17640,7 +17685,7 @@ environment.command("create [name]").description("Create a new environment").opt
|
|
|
17640
17685
|
await environmentCreateCommand(name, options);
|
|
17641
17686
|
} catch (error) {
|
|
17642
17687
|
if (error instanceof Error) {
|
|
17643
|
-
console.error(
|
|
17688
|
+
console.error(chalk23.red(`
|
|
17644
17689
|
\u2717 ${error.message}
|
|
17645
17690
|
`));
|
|
17646
17691
|
}
|
|
@@ -17652,7 +17697,7 @@ environment.command("edit <id-or-name>").description("Edit an environment").opti
|
|
|
17652
17697
|
await environmentEditCommand(idOrName, options);
|
|
17653
17698
|
} catch (error) {
|
|
17654
17699
|
if (error instanceof Error) {
|
|
17655
|
-
console.error(
|
|
17700
|
+
console.error(chalk23.red(`
|
|
17656
17701
|
\u2717 ${error.message}
|
|
17657
17702
|
`));
|
|
17658
17703
|
}
|
|
@@ -17664,7 +17709,7 @@ environment.command("delete <id-or-name>").description("Delete an environment").
|
|
|
17664
17709
|
await environmentDeleteCommand(idOrName, options);
|
|
17665
17710
|
} catch (error) {
|
|
17666
17711
|
if (error instanceof Error) {
|
|
17667
|
-
console.error(
|
|
17712
|
+
console.error(chalk23.red(`
|
|
17668
17713
|
\u2717 ${error.message}
|
|
17669
17714
|
`));
|
|
17670
17715
|
}
|
|
@@ -17677,7 +17722,7 @@ envVars.command("list <env>").description("List variables in an environment (val
|
|
|
17677
17722
|
await envVarsListCommand(env, options);
|
|
17678
17723
|
} catch (error) {
|
|
17679
17724
|
if (error instanceof Error) {
|
|
17680
|
-
console.error(
|
|
17725
|
+
console.error(chalk23.red(`
|
|
17681
17726
|
\u2717 ${error.message}
|
|
17682
17727
|
`));
|
|
17683
17728
|
}
|
|
@@ -17689,7 +17734,7 @@ envVars.command("set <env> <key> <value>").description("Create or update a varia
|
|
|
17689
17734
|
await envVarsSetCommand(env, key, value);
|
|
17690
17735
|
} catch (error) {
|
|
17691
17736
|
if (error instanceof Error) {
|
|
17692
|
-
console.error(
|
|
17737
|
+
console.error(chalk23.red(`
|
|
17693
17738
|
\u2717 ${error.message}
|
|
17694
17739
|
`));
|
|
17695
17740
|
}
|
|
@@ -17701,7 +17746,7 @@ envVars.command("delete <env> <key-or-id>").description("Delete a variable by ke
|
|
|
17701
17746
|
await envVarsDeleteCommand(env, keyOrId, options);
|
|
17702
17747
|
} catch (error) {
|
|
17703
17748
|
if (error instanceof Error) {
|
|
17704
|
-
console.error(
|
|
17749
|
+
console.error(chalk23.red(`
|
|
17705
17750
|
\u2717 ${error.message}
|
|
17706
17751
|
`));
|
|
17707
17752
|
}
|
|
@@ -17714,7 +17759,7 @@ envFiles.command("list <env>").description("List files in an environment").actio
|
|
|
17714
17759
|
await envFilesListCommand(env);
|
|
17715
17760
|
} catch (error) {
|
|
17716
17761
|
if (error instanceof Error) {
|
|
17717
|
-
console.error(
|
|
17762
|
+
console.error(chalk23.red(`
|
|
17718
17763
|
\u2717 ${error.message}
|
|
17719
17764
|
`));
|
|
17720
17765
|
}
|
|
@@ -17726,7 +17771,7 @@ envFiles.command("set <env> <destination-path>").description("Create or update a
|
|
|
17726
17771
|
await envFilesSetCommand(env, destinationPath, options);
|
|
17727
17772
|
} catch (error) {
|
|
17728
17773
|
if (error instanceof Error) {
|
|
17729
|
-
console.error(
|
|
17774
|
+
console.error(chalk23.red(`
|
|
17730
17775
|
\u2717 ${error.message}
|
|
17731
17776
|
`));
|
|
17732
17777
|
}
|
|
@@ -17738,7 +17783,7 @@ envFiles.command("delete <env> <path-or-id>").description("Delete a file by dest
|
|
|
17738
17783
|
await envFilesDeleteCommand(env, pathOrId, options);
|
|
17739
17784
|
} catch (error) {
|
|
17740
17785
|
if (error instanceof Error) {
|
|
17741
|
-
console.error(
|
|
17786
|
+
console.error(chalk23.red(`
|
|
17742
17787
|
\u2717 ${error.message}
|
|
17743
17788
|
`));
|
|
17744
17789
|
}
|
|
@@ -17751,7 +17796,7 @@ envStartHooks.command("get <env>").description("Show the active start hook for a
|
|
|
17751
17796
|
await envStartHookGetCommand(env);
|
|
17752
17797
|
} catch (error) {
|
|
17753
17798
|
if (error instanceof Error) {
|
|
17754
|
-
console.error(
|
|
17799
|
+
console.error(chalk23.red(`
|
|
17755
17800
|
\u2717 ${error.message}
|
|
17756
17801
|
`));
|
|
17757
17802
|
}
|
|
@@ -17763,7 +17808,7 @@ envStartHooks.command("save <env>").description("Save and activate a start hook
|
|
|
17763
17808
|
await envStartHookSaveCommand(env, options);
|
|
17764
17809
|
} catch (error) {
|
|
17765
17810
|
if (error instanceof Error) {
|
|
17766
|
-
console.error(
|
|
17811
|
+
console.error(chalk23.red(`
|
|
17767
17812
|
\u2717 ${error.message}
|
|
17768
17813
|
`));
|
|
17769
17814
|
}
|
|
@@ -17775,7 +17820,7 @@ envStartHooks.command("test <env>").description("Run a start hook in an isolated
|
|
|
17775
17820
|
await envStartHookTestCommand(env, options);
|
|
17776
17821
|
} catch (error) {
|
|
17777
17822
|
if (error instanceof Error) {
|
|
17778
|
-
console.error(
|
|
17823
|
+
console.error(chalk23.red(`
|
|
17779
17824
|
\u2717 ${error.message}
|
|
17780
17825
|
`));
|
|
17781
17826
|
}
|
|
@@ -17787,7 +17832,7 @@ envStartHooks.command("repository-hooks <env>").description("List per-repo start
|
|
|
17787
17832
|
await envStartHookRepositoryHooksCommand(env);
|
|
17788
17833
|
} catch (error) {
|
|
17789
17834
|
if (error instanceof Error) {
|
|
17790
|
-
console.error(
|
|
17835
|
+
console.error(chalk23.red(`
|
|
17791
17836
|
\u2717 ${error.message}
|
|
17792
17837
|
`));
|
|
17793
17838
|
}
|
|
@@ -17799,7 +17844,7 @@ environment.action(async () => {
|
|
|
17799
17844
|
await environmentListCommand();
|
|
17800
17845
|
} catch (error) {
|
|
17801
17846
|
if (error instanceof Error) {
|
|
17802
|
-
console.error(
|
|
17847
|
+
console.error(chalk23.red(`
|
|
17803
17848
|
\u2717 ${error.message}
|
|
17804
17849
|
`));
|
|
17805
17850
|
}
|
|
@@ -17811,7 +17856,7 @@ program.command("interact").alias("i").description("Launch the interactive termi
|
|
|
17811
17856
|
await interactiveCommand();
|
|
17812
17857
|
} catch (error) {
|
|
17813
17858
|
if (error instanceof Error) {
|
|
17814
|
-
console.error(
|
|
17859
|
+
console.error(chalk23.red(`
|
|
17815
17860
|
\u2717 ${error.message}
|
|
17816
17861
|
`));
|
|
17817
17862
|
}
|
|
@@ -17862,7 +17907,7 @@ if (isAgentMode()) {
|
|
|
17862
17907
|
await previewAddCommand(workspaceId, options);
|
|
17863
17908
|
} catch (error) {
|
|
17864
17909
|
if (error instanceof Error) {
|
|
17865
|
-
console.error(
|
|
17910
|
+
console.error(chalk23.red(`
|
|
17866
17911
|
\u2717 ${error.message}
|
|
17867
17912
|
`));
|
|
17868
17913
|
}
|
|
@@ -17874,7 +17919,7 @@ if (isAgentMode()) {
|
|
|
17874
17919
|
await previewListCommand(workspaceId);
|
|
17875
17920
|
} catch (error) {
|
|
17876
17921
|
if (error instanceof Error) {
|
|
17877
|
-
console.error(
|
|
17922
|
+
console.error(chalk23.red(`
|
|
17878
17923
|
\u2717 ${error.message}
|
|
17879
17924
|
`));
|
|
17880
17925
|
}
|
|
@@ -17886,7 +17931,7 @@ if (isAgentMode()) {
|
|
|
17886
17931
|
await previewRemoveCommand(workspaceId, options);
|
|
17887
17932
|
} catch (error) {
|
|
17888
17933
|
if (error instanceof Error) {
|
|
17889
|
-
console.error(
|
|
17934
|
+
console.error(chalk23.red(`
|
|
17890
17935
|
\u2717 ${error.message}
|
|
17891
17936
|
`));
|
|
17892
17937
|
}
|
|
@@ -17901,7 +17946,7 @@ if (isAgentMode()) {
|
|
|
17901
17946
|
await mediaUploadCommand(files, options);
|
|
17902
17947
|
} catch (error) {
|
|
17903
17948
|
if (error instanceof Error) {
|
|
17904
|
-
console.error(
|
|
17949
|
+
console.error(chalk23.red(`
|
|
17905
17950
|
\u2717 ${error.message}
|
|
17906
17951
|
`));
|
|
17907
17952
|
}
|
|
@@ -17913,7 +17958,7 @@ if (isAgentMode()) {
|
|
|
17913
17958
|
await mediaListCommand(options);
|
|
17914
17959
|
} catch (error) {
|
|
17915
17960
|
if (error instanceof Error) {
|
|
17916
|
-
console.error(
|
|
17961
|
+
console.error(chalk23.red(`
|
|
17917
17962
|
\u2717 ${error.message}
|
|
17918
17963
|
`));
|
|
17919
17964
|
}
|
|
@@ -17926,7 +17971,7 @@ if (isAgentMode()) {
|
|
|
17926
17971
|
await fn(...args);
|
|
17927
17972
|
} catch (error) {
|
|
17928
17973
|
if (error instanceof Error) {
|
|
17929
|
-
console.error(
|
|
17974
|
+
console.error(chalk23.red(`
|
|
17930
17975
|
\u2717 ${error.message}
|
|
17931
17976
|
`));
|
|
17932
17977
|
}
|