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