replicas-cli 0.3.654 → 0.3.655
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.cjs +54 -10
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -28471,7 +28471,7 @@ The user gets a form above the chat composer in Replicas, where they can paste a
|
|
|
28471
28471
|
|
|
28472
28472
|
In workspaces started from Slack, Linear, or an automation, nobody may be watching Replicas, so the command returns right away with a link to the form; share it where you are talking with the user. If the values don't arrive in time, the request stays open. Either way you get a message when the user saves; run the same command again then. If a saved value is wrong, for example the service rejects it, add \`--replace\` to ask for a new one.
|
|
28473
28473
|
|
|
28474
|
-
A value that starts with \`replicas_ph_\` is a proxied secret. Use it as the real key: Replicas swaps in the real value on HTTPS requests to the hosts the user bound it to, and it works nowhere else, including inside Docker containers.
|
|
28474
|
+
A value that starts with \`replicas_ph_\` is a proxied secret. Use it as the real key: Replicas swaps in the real value on HTTPS requests to the hosts the user bound it to, and it works nowhere else, including inside Docker containers. To proxy a variable or change its hosts, run \`replicas environment vars proxy <env> <key> <host...>\`: the user approves it above the chat, and you get a message with their answer.
|
|
28475
28475
|
|
|
28476
28476
|
### Environment files
|
|
28477
28477
|
|
|
@@ -43370,7 +43370,7 @@ var CLI_VERSION;
|
|
|
43370
43370
|
var init_cli_version = __esm({
|
|
43371
43371
|
"../shared/src/cli-version.ts"() {
|
|
43372
43372
|
"use strict";
|
|
43373
|
-
CLI_VERSION = "0.3.
|
|
43373
|
+
CLI_VERSION = "0.3.655";
|
|
43374
43374
|
}
|
|
43375
43375
|
});
|
|
43376
43376
|
|
|
@@ -44129,6 +44129,11 @@ var init_workspace_events = __esm({
|
|
|
44129
44129
|
workspaceId: external_exports.string(),
|
|
44130
44130
|
ts: external_exports.string()
|
|
44131
44131
|
}),
|
|
44132
|
+
external_exports.object({
|
|
44133
|
+
type: external_exports.literal("approval-request.changed"),
|
|
44134
|
+
workspaceId: external_exports.string(),
|
|
44135
|
+
ts: external_exports.string()
|
|
44136
|
+
}),
|
|
44132
44137
|
external_exports.object({
|
|
44133
44138
|
type: external_exports.literal("pull-request.changed"),
|
|
44134
44139
|
prUrl: external_exports.string(),
|
|
@@ -54507,6 +54512,29 @@ var init_local_control_requests = __esm({
|
|
|
54507
54512
|
}
|
|
54508
54513
|
});
|
|
54509
54514
|
|
|
54515
|
+
// ../shared/src/routes/approval-requests.ts
|
|
54516
|
+
var approvalChangeSchema, approvalRequestSchema, respondApprovalRequestSchema;
|
|
54517
|
+
var init_approval_requests = __esm({
|
|
54518
|
+
"../shared/src/routes/approval-requests.ts"() {
|
|
54519
|
+
"use strict";
|
|
54520
|
+
init_zod();
|
|
54521
|
+
approvalChangeSchema = external_exports.object({
|
|
54522
|
+
kind: external_exports.literal("variable_proxy_hosts"),
|
|
54523
|
+
environment_id: external_exports.string(),
|
|
54524
|
+
environment_name: external_exports.string(),
|
|
54525
|
+
variable_id: external_exports.string(),
|
|
54526
|
+
key: external_exports.string(),
|
|
54527
|
+
proxy_hosts: external_exports.array(external_exports.string())
|
|
54528
|
+
});
|
|
54529
|
+
approvalRequestSchema = external_exports.object({
|
|
54530
|
+
/** Changes whenever the request does, so an answer only counts for the changes the person saw. */
|
|
54531
|
+
id: external_exports.string(),
|
|
54532
|
+
changes: external_exports.array(approvalChangeSchema)
|
|
54533
|
+
});
|
|
54534
|
+
respondApprovalRequestSchema = external_exports.object({ id: external_exports.string(), action: external_exports.enum(["approved", "declined"]) });
|
|
54535
|
+
}
|
|
54536
|
+
});
|
|
54537
|
+
|
|
54510
54538
|
// ../shared/src/websocket-liveness.ts
|
|
54511
54539
|
function trackWebSocketLiveness(socket) {
|
|
54512
54540
|
let answered = true;
|
|
@@ -54754,6 +54782,7 @@ var init_src = __esm({
|
|
|
54754
54782
|
init_security_app_stand_ins();
|
|
54755
54783
|
init_variable_requests();
|
|
54756
54784
|
init_local_control_requests();
|
|
54785
|
+
init_approval_requests();
|
|
54757
54786
|
init_api_casing();
|
|
54758
54787
|
init_websocket_liveness();
|
|
54759
54788
|
init_workspace_target();
|
|
@@ -57572,13 +57601,30 @@ Variables (${environment_variables.length}):
|
|
|
57572
57601
|
for (const v2 of environment_variables) printVariable(v2);
|
|
57573
57602
|
});
|
|
57574
57603
|
}
|
|
57575
|
-
async function
|
|
57604
|
+
async function findVariableByKey(environmentId, key2) {
|
|
57605
|
+
const { environment_variables } = await orgAuthenticatedFetch(`/v1/environments/${environmentId}/variables`);
|
|
57606
|
+
return environment_variables.find((v2) => v2.key === key2);
|
|
57607
|
+
}
|
|
57608
|
+
async function envVarsProxyCommand(envIdOrName, key2, hosts) {
|
|
57576
57609
|
ensureOrgApiAuthenticated();
|
|
57577
57610
|
const id = await resolveEnvironmentId(envIdOrName);
|
|
57578
|
-
const
|
|
57579
|
-
|
|
57611
|
+
const match = await findVariableByKey(id, key2);
|
|
57612
|
+
if (!match) throw new Error(`No variable named ${key2} in this environment`);
|
|
57613
|
+
const body2 = { proxy_hosts: hosts };
|
|
57614
|
+
const response = await orgAuthenticatedFetch(
|
|
57615
|
+
`/v1/environments/${id}/variables/${match.id}`,
|
|
57616
|
+
{ method: "PATCH", body: body2 }
|
|
57580
57617
|
);
|
|
57581
|
-
|
|
57618
|
+
output2(response, (result) => console.log("message" in result ? import_chalk21.default.yellow(`
|
|
57619
|
+
${result.message}
|
|
57620
|
+
`) : import_chalk21.default.green(`
|
|
57621
|
+
${key2} is ${result.environment_variable.proxy_hosts.length > 0 ? `sent only to ${result.environment_variable.proxy_hosts.join(", ")}` : "no longer proxied"}.
|
|
57622
|
+
`)));
|
|
57623
|
+
}
|
|
57624
|
+
async function envVarsSetCommand(envIdOrName, key2, value, options) {
|
|
57625
|
+
ensureOrgApiAuthenticated();
|
|
57626
|
+
const id = await resolveEnvironmentId(envIdOrName);
|
|
57627
|
+
const match = await findVariableByKey(id, key2);
|
|
57582
57628
|
if (match) {
|
|
57583
57629
|
const body3 = { value, proxy_hosts: options.proxyHost };
|
|
57584
57630
|
const response2 = await orgAuthenticatedFetch(
|
|
@@ -57609,10 +57655,7 @@ async function envVarsDeleteCommand(envIdOrName, keyOrId, options) {
|
|
|
57609
57655
|
const id = await resolveEnvironmentId(envIdOrName);
|
|
57610
57656
|
let variableId = keyOrId;
|
|
57611
57657
|
if (!UUID_RE.test(keyOrId)) {
|
|
57612
|
-
const
|
|
57613
|
-
`/v1/environments/${id}/variables`
|
|
57614
|
-
);
|
|
57615
|
-
const match = existing.environment_variables.find((v2) => v2.key === keyOrId);
|
|
57658
|
+
const match = await findVariableByKey(id, keyOrId);
|
|
57616
57659
|
if (!match) throw new Error(`Variable not found: ${keyOrId}`);
|
|
57617
57660
|
variableId = match.id;
|
|
57618
57661
|
}
|
|
@@ -62664,6 +62707,7 @@ var init_src2 = __esm({
|
|
|
62664
62707
|
envConfig.command("disconnect <env>").description("Disconnect Git configuration and preserve current settings").option("-y, --yes", "Disconnect without a confirmation prompt").action(run(environmentConfigDisconnectCommand));
|
|
62665
62708
|
envVars = environment.command("vars").description("Manage environment variables");
|
|
62666
62709
|
envVars.command("list <env>").description("List variables in an environment (values masked by default)").option("--reveal", "Show full variable values instead of masking them").action(run(envVarsListCommand));
|
|
62710
|
+
envVars.command("proxy <env> <key> [hosts...]").description("Send an existing variable only to these hosts, keeping its value out of workspaces; no hosts stops proxying it. From a workspace, the user has to approve it").action(run(envVarsProxyCommand));
|
|
62667
62711
|
envVars.command("set <env> <key> <value>").description("Create or update a variable").option("--proxy-host <hosts...>", "Keep the value out of workspaces: they get a placeholder, swapped for the value only on HTTPS requests to these hosts").action(run(envVarsSetCommand));
|
|
62668
62712
|
envVars.command("delete <env> <key-or-id>").description("Delete a variable by key or ID").option("-f, --force", "Skip confirmation prompt").action(run(envVarsDeleteCommand));
|
|
62669
62713
|
if (isAgentMode()) {
|