@autohq/cli 0.1.164 → 0.1.165
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/agent-bridge.js +28 -1
- package/dist/index.js +297 -34
- package/package.json +1 -1
package/dist/agent-bridge.js
CHANGED
|
@@ -19666,6 +19666,33 @@ var RuntimeBridgeOutputAckSchema = external_exports.object({
|
|
|
19666
19666
|
at: external_exports.string().datetime()
|
|
19667
19667
|
}).strict();
|
|
19668
19668
|
|
|
19669
|
+
// ../../packages/schemas/src/account.ts
|
|
19670
|
+
var AccountDeleteRequestSchema = external_exports.object({
|
|
19671
|
+
deleteAdminOrganizations: external_exports.boolean().default(false),
|
|
19672
|
+
confirmation: external_exports.string().trim().min(1)
|
|
19673
|
+
});
|
|
19674
|
+
var AccountDeleteOrganizationSchema = external_exports.object({
|
|
19675
|
+
organizationId: external_exports.string().trim().min(1),
|
|
19676
|
+
organizationSlug: external_exports.string().trim().min(1),
|
|
19677
|
+
organizationName: external_exports.string().trim().min(1),
|
|
19678
|
+
role: external_exports.enum(["admin", "member"]),
|
|
19679
|
+
adminCount: external_exports.number().int().nonnegative(),
|
|
19680
|
+
projectCount: external_exports.number().int().nonnegative()
|
|
19681
|
+
});
|
|
19682
|
+
var AccountDeleteDeletedOrganizationSchema = AccountDeleteOrganizationSchema.extend({
|
|
19683
|
+
deleteReason: external_exports.enum(["last_admin", "delete_admin_orgs"])
|
|
19684
|
+
});
|
|
19685
|
+
var AccountDeleteResponseSchema = external_exports.object({
|
|
19686
|
+
user: external_exports.object({
|
|
19687
|
+
userId: external_exports.string().trim().min(1),
|
|
19688
|
+
primaryEmail: external_exports.string().trim().min(1)
|
|
19689
|
+
}),
|
|
19690
|
+
deletedOrganizations: external_exports.array(AccountDeleteDeletedOrganizationSchema),
|
|
19691
|
+
removedOrganizations: external_exports.array(AccountDeleteOrganizationSchema),
|
|
19692
|
+
deletedProjectCount: external_exports.number().int().nonnegative(),
|
|
19693
|
+
removedProjectMembershipCount: external_exports.number().int().nonnegative()
|
|
19694
|
+
});
|
|
19695
|
+
|
|
19669
19696
|
// ../../packages/schemas/src/ids.ts
|
|
19670
19697
|
var OpaqueIdSchema2 = external_exports.string().trim().min(1);
|
|
19671
19698
|
var ProfileIdSchema = OpaqueIdSchema2.brand();
|
|
@@ -26440,7 +26467,7 @@ Object.assign(lookup, {
|
|
|
26440
26467
|
// package.json
|
|
26441
26468
|
var package_default = {
|
|
26442
26469
|
name: "@autohq/cli",
|
|
26443
|
-
version: "0.1.
|
|
26470
|
+
version: "0.1.165",
|
|
26444
26471
|
license: "SEE LICENSE IN README.md",
|
|
26445
26472
|
publishConfig: {
|
|
26446
26473
|
access: "public"
|
package/dist/index.js
CHANGED
|
@@ -363,23 +363,25 @@ async function createOAuthLoopbackCallback(input) {
|
|
|
363
363
|
);
|
|
364
364
|
return;
|
|
365
365
|
}
|
|
366
|
-
const code = url2.searchParams.get("code");
|
|
367
|
-
|
|
366
|
+
const code = url2.searchParams.get("code") ?? "";
|
|
367
|
+
const sensitiveActionToken = url2.searchParams.get("sensitive_action_token") ?? void 0;
|
|
368
|
+
if (!code && !sensitiveActionToken) {
|
|
368
369
|
response.writeHead(400, { "content-type": "text/html; charset=utf-8" });
|
|
369
370
|
endThenSettle(
|
|
370
371
|
response,
|
|
371
372
|
renderOAuthLoopbackPage({
|
|
372
373
|
status: "failure",
|
|
373
374
|
eyebrow: "Auto",
|
|
374
|
-
title: "Missing authorization
|
|
375
|
+
title: "Missing authorization result",
|
|
375
376
|
message: "Return to your terminal to retry the authorization flow."
|
|
376
377
|
}),
|
|
377
|
-
() => rejectResult(new Error("Missing authorization
|
|
378
|
+
() => rejectResult(new Error("Missing authorization result"))
|
|
378
379
|
);
|
|
379
380
|
return;
|
|
380
381
|
}
|
|
381
382
|
const result2 = {
|
|
382
383
|
code,
|
|
384
|
+
sensitiveActionToken,
|
|
383
385
|
organizationName: url2.searchParams.get("organization_name") ?? void 0,
|
|
384
386
|
projectName: url2.searchParams.get("project_name") ?? void 0,
|
|
385
387
|
state: url2.searchParams.get("state") ?? void 0
|
|
@@ -16060,6 +16062,40 @@ var init_zod = __esm({
|
|
|
16060
16062
|
}
|
|
16061
16063
|
});
|
|
16062
16064
|
|
|
16065
|
+
// ../../packages/schemas/src/account.ts
|
|
16066
|
+
var AccountDeleteRequestSchema, AccountDeleteOrganizationSchema, AccountDeleteDeletedOrganizationSchema, AccountDeleteResponseSchema;
|
|
16067
|
+
var init_account = __esm({
|
|
16068
|
+
"../../packages/schemas/src/account.ts"() {
|
|
16069
|
+
"use strict";
|
|
16070
|
+
init_zod();
|
|
16071
|
+
AccountDeleteRequestSchema = external_exports.object({
|
|
16072
|
+
deleteAdminOrganizations: external_exports.boolean().default(false),
|
|
16073
|
+
confirmation: external_exports.string().trim().min(1)
|
|
16074
|
+
});
|
|
16075
|
+
AccountDeleteOrganizationSchema = external_exports.object({
|
|
16076
|
+
organizationId: external_exports.string().trim().min(1),
|
|
16077
|
+
organizationSlug: external_exports.string().trim().min(1),
|
|
16078
|
+
organizationName: external_exports.string().trim().min(1),
|
|
16079
|
+
role: external_exports.enum(["admin", "member"]),
|
|
16080
|
+
adminCount: external_exports.number().int().nonnegative(),
|
|
16081
|
+
projectCount: external_exports.number().int().nonnegative()
|
|
16082
|
+
});
|
|
16083
|
+
AccountDeleteDeletedOrganizationSchema = AccountDeleteOrganizationSchema.extend({
|
|
16084
|
+
deleteReason: external_exports.enum(["last_admin", "delete_admin_orgs"])
|
|
16085
|
+
});
|
|
16086
|
+
AccountDeleteResponseSchema = external_exports.object({
|
|
16087
|
+
user: external_exports.object({
|
|
16088
|
+
userId: external_exports.string().trim().min(1),
|
|
16089
|
+
primaryEmail: external_exports.string().trim().min(1)
|
|
16090
|
+
}),
|
|
16091
|
+
deletedOrganizations: external_exports.array(AccountDeleteDeletedOrganizationSchema),
|
|
16092
|
+
removedOrganizations: external_exports.array(AccountDeleteOrganizationSchema),
|
|
16093
|
+
deletedProjectCount: external_exports.number().int().nonnegative(),
|
|
16094
|
+
removedProjectMembershipCount: external_exports.number().int().nonnegative()
|
|
16095
|
+
});
|
|
16096
|
+
}
|
|
16097
|
+
});
|
|
16098
|
+
|
|
16063
16099
|
// ../../packages/schemas/src/ids.ts
|
|
16064
16100
|
var OpaqueIdSchema, ProfileIdSchema, EnvironmentIdSchema, IdentityIdSchema, ConnectionIdSchema, ExternalAccountIdSchema, OrganizationIdSchema, ProjectIdSchema, ProviderGrantIdSchema, ServiceAccountIdSchema, AgentIdSchema, SessionIdSchema, SessionCommandIdSchema, RuntimeIdSchema, RuntimeBridgeLeaseIdSchema, EnvironmentSetupTemplateIdSchema, UserIdSchema;
|
|
16065
16101
|
var init_ids = __esm({
|
|
@@ -19619,6 +19655,7 @@ var init_temporal = __esm({
|
|
|
19619
19655
|
var init_src = __esm({
|
|
19620
19656
|
"../../packages/schemas/src/index.ts"() {
|
|
19621
19657
|
"use strict";
|
|
19658
|
+
init_account();
|
|
19622
19659
|
init_auth();
|
|
19623
19660
|
init_chat();
|
|
19624
19661
|
init_claude_code();
|
|
@@ -20603,6 +20640,26 @@ function createApiClient(input) {
|
|
|
20603
20640
|
}
|
|
20604
20641
|
return AuthWhoamiResponseSchema.parse(await response.json());
|
|
20605
20642
|
},
|
|
20643
|
+
async deleteAccount(inputOptions) {
|
|
20644
|
+
const response = await bootstrapFetch(
|
|
20645
|
+
apiUrl(apiPath("/account"), inputOptions.apiBaseUrl),
|
|
20646
|
+
{
|
|
20647
|
+
method: "DELETE",
|
|
20648
|
+
headers: {
|
|
20649
|
+
"content-type": "application/json",
|
|
20650
|
+
"x-auto-sensitive-action-token": inputOptions.sensitiveActionToken
|
|
20651
|
+
},
|
|
20652
|
+
body: JSON.stringify({
|
|
20653
|
+
deleteAdminOrganizations: inputOptions.deleteAdminOrganizations,
|
|
20654
|
+
confirmation: inputOptions.confirmation
|
|
20655
|
+
})
|
|
20656
|
+
}
|
|
20657
|
+
);
|
|
20658
|
+
if (!response.ok) {
|
|
20659
|
+
throw new Error(await responseErrorMessage(response));
|
|
20660
|
+
}
|
|
20661
|
+
return AccountDeleteResponseSchema.parse(await response.json());
|
|
20662
|
+
},
|
|
20606
20663
|
async listProjects(options = {}) {
|
|
20607
20664
|
return fetchProjects2(options.apiBaseUrl);
|
|
20608
20665
|
},
|
|
@@ -21492,7 +21549,7 @@ var init_package = __esm({
|
|
|
21492
21549
|
"package.json"() {
|
|
21493
21550
|
package_default = {
|
|
21494
21551
|
name: "@autohq/cli",
|
|
21495
|
-
version: "0.1.
|
|
21552
|
+
version: "0.1.165",
|
|
21496
21553
|
license: "SEE LICENSE IN README.md",
|
|
21497
21554
|
publishConfig: {
|
|
21498
21555
|
access: "public"
|
|
@@ -25334,10 +25391,10 @@ function ConversationView({
|
|
|
25334
25391
|
return;
|
|
25335
25392
|
}
|
|
25336
25393
|
setStatus("failed");
|
|
25337
|
-
await
|
|
25394
|
+
await sleep3(1e3, abort.signal);
|
|
25338
25395
|
continue;
|
|
25339
25396
|
}
|
|
25340
|
-
await
|
|
25397
|
+
await sleep3(250, abort.signal);
|
|
25341
25398
|
}
|
|
25342
25399
|
})();
|
|
25343
25400
|
void client.getSession(sessionId, { apiBaseUrl: apiUrl }).then(applyRunSnapshot).catch(() => void 0);
|
|
@@ -25390,10 +25447,10 @@ function ConversationView({
|
|
|
25390
25447
|
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
25391
25448
|
})
|
|
25392
25449
|
);
|
|
25393
|
-
await
|
|
25450
|
+
await sleep3(1e3, abort.signal);
|
|
25394
25451
|
continue;
|
|
25395
25452
|
}
|
|
25396
|
-
await
|
|
25453
|
+
await sleep3(250, abort.signal);
|
|
25397
25454
|
}
|
|
25398
25455
|
})();
|
|
25399
25456
|
return () => {
|
|
@@ -25861,7 +25918,7 @@ function formatDuration(event) {
|
|
|
25861
25918
|
}
|
|
25862
25919
|
return `${(event.durationMs / 1e3).toFixed(1)}s`;
|
|
25863
25920
|
}
|
|
25864
|
-
function
|
|
25921
|
+
function sleep3(ms, signal) {
|
|
25865
25922
|
if (signal.aborted) {
|
|
25866
25923
|
return Promise.resolve();
|
|
25867
25924
|
}
|
|
@@ -29449,11 +29506,12 @@ var init_launcher = __esm({
|
|
|
29449
29506
|
|
|
29450
29507
|
// src/cli/program.ts
|
|
29451
29508
|
import { existsSync as existsSync4 } from "fs";
|
|
29452
|
-
import { Command, Option as
|
|
29509
|
+
import { Command, Option as Option4 } from "commander";
|
|
29453
29510
|
|
|
29454
29511
|
// src/commands/account/commands.ts
|
|
29455
29512
|
init_base_url();
|
|
29456
29513
|
init_login();
|
|
29514
|
+
import { Option } from "commander";
|
|
29457
29515
|
|
|
29458
29516
|
// src/commands/auth/profile.ts
|
|
29459
29517
|
import { existsSync, rmSync } from "fs";
|
|
@@ -29754,6 +29812,210 @@ function formatScopeActions(actions) {
|
|
|
29754
29812
|
return ordered.join("+");
|
|
29755
29813
|
}
|
|
29756
29814
|
|
|
29815
|
+
// src/commands/account/delete.ts
|
|
29816
|
+
init_base_url();
|
|
29817
|
+
init_http();
|
|
29818
|
+
init_browser();
|
|
29819
|
+
init_file();
|
|
29820
|
+
init_loopback();
|
|
29821
|
+
|
|
29822
|
+
// src/lib/stdio/readline.ts
|
|
29823
|
+
import { createInterface } from "readline/promises";
|
|
29824
|
+
function createCliReadline(input) {
|
|
29825
|
+
return createInterface({
|
|
29826
|
+
input: input.stdin,
|
|
29827
|
+
output: input.stdout,
|
|
29828
|
+
terminal: Boolean(input.stdin.isTTY)
|
|
29829
|
+
});
|
|
29830
|
+
}
|
|
29831
|
+
|
|
29832
|
+
// src/commands/account/delete.ts
|
|
29833
|
+
async function deleteAccount(input) {
|
|
29834
|
+
const { context, options } = input;
|
|
29835
|
+
const config2 = readConfig(context.configPath);
|
|
29836
|
+
const confirmationTarget = config2.userEmail ?? options.confirm;
|
|
29837
|
+
if (!confirmationTarget) {
|
|
29838
|
+
throw new Error(
|
|
29839
|
+
"Cannot determine the account email. Re-run with --confirm <email>."
|
|
29840
|
+
);
|
|
29841
|
+
}
|
|
29842
|
+
const confirmation = await accountDeletionConfirmation({
|
|
29843
|
+
context,
|
|
29844
|
+
email: confirmationTarget,
|
|
29845
|
+
options
|
|
29846
|
+
});
|
|
29847
|
+
const apiBaseUrl = resolveApiBaseUrl({
|
|
29848
|
+
explicit: [options.apiUrl, context.globalApiUrl?.()],
|
|
29849
|
+
env: context.env,
|
|
29850
|
+
configServerUrl: config2.serverUrl
|
|
29851
|
+
});
|
|
29852
|
+
const sensitiveActionToken = options.sensitiveActionToken ?? (options.device ? await authorizeSensitiveActionDevice({
|
|
29853
|
+
context,
|
|
29854
|
+
apiBaseUrl
|
|
29855
|
+
}) : await authorizeSensitiveActionLoopback({
|
|
29856
|
+
context,
|
|
29857
|
+
apiBaseUrl,
|
|
29858
|
+
email: confirmationTarget
|
|
29859
|
+
}));
|
|
29860
|
+
const client = createContextApiClient(context);
|
|
29861
|
+
const deleted = await client.deleteAccount({
|
|
29862
|
+
deleteAdminOrganizations: Boolean(options.deleteAdminOrgs),
|
|
29863
|
+
confirmation,
|
|
29864
|
+
sensitiveActionToken,
|
|
29865
|
+
apiBaseUrl
|
|
29866
|
+
});
|
|
29867
|
+
context.writeOutput(
|
|
29868
|
+
context.io.style.success(`Deleted account ${deleted.user.primaryEmail}.`)
|
|
29869
|
+
);
|
|
29870
|
+
if (deleted.deletedOrganizations.length > 0) {
|
|
29871
|
+
context.writeOutput(
|
|
29872
|
+
`Deleted ${deleted.deletedOrganizations.length} organization(s) and ${deleted.deletedProjectCount} project(s).`
|
|
29873
|
+
);
|
|
29874
|
+
}
|
|
29875
|
+
if (deleted.removedOrganizations.length > 0) {
|
|
29876
|
+
context.writeOutput(
|
|
29877
|
+
`Removed account memberships from ${deleted.removedOrganizations.length} organization(s).`
|
|
29878
|
+
);
|
|
29879
|
+
}
|
|
29880
|
+
if (deleted.removedProjectMembershipCount > 0) {
|
|
29881
|
+
context.writeOutput(
|
|
29882
|
+
`Removed ${deleted.removedProjectMembershipCount} project membership(s).`
|
|
29883
|
+
);
|
|
29884
|
+
}
|
|
29885
|
+
logout(context);
|
|
29886
|
+
}
|
|
29887
|
+
async function accountDeletionConfirmation(input) {
|
|
29888
|
+
if (input.options.yes) {
|
|
29889
|
+
if (!input.options.confirm) {
|
|
29890
|
+
throw new Error(
|
|
29891
|
+
"Pass --confirm <email> with --yes to delete an account non-interactively."
|
|
29892
|
+
);
|
|
29893
|
+
}
|
|
29894
|
+
return input.options.confirm;
|
|
29895
|
+
}
|
|
29896
|
+
if (!input.context.stdin.isTTY) {
|
|
29897
|
+
throw new Error(
|
|
29898
|
+
"Account deletion requires an interactive terminal, or --yes --confirm <email>."
|
|
29899
|
+
);
|
|
29900
|
+
}
|
|
29901
|
+
const rl = createCliReadline({
|
|
29902
|
+
stdin: input.context.stdin,
|
|
29903
|
+
stdout: input.context.stdout
|
|
29904
|
+
});
|
|
29905
|
+
try {
|
|
29906
|
+
input.context.writeOutput(
|
|
29907
|
+
`This will permanently delete the Auto account ${input.email}.`
|
|
29908
|
+
);
|
|
29909
|
+
input.context.writeOutput(
|
|
29910
|
+
input.options.deleteAdminOrgs ? "Organizations where this account is an admin will be deleted, including their projects and resources." : "Organizations where this account is the last admin will be deleted; other organizations will keep their data."
|
|
29911
|
+
);
|
|
29912
|
+
input.context.writeOutput(
|
|
29913
|
+
"Connections, tokens, identities, and account-scoped access will be removed."
|
|
29914
|
+
);
|
|
29915
|
+
await requireYes(rl, "Delete this Auto account? Type yes to continue: ");
|
|
29916
|
+
await requireYes(rl, "This cannot be undone. Type yes to continue: ");
|
|
29917
|
+
const confirmation = input.options.confirm ?? await rl.question(`Type ${input.email} to permanently delete: `);
|
|
29918
|
+
if (confirmation.trim() !== input.email) {
|
|
29919
|
+
throw new Error(
|
|
29920
|
+
"Account deletion cancelled: confirmation did not match."
|
|
29921
|
+
);
|
|
29922
|
+
}
|
|
29923
|
+
return confirmation.trim();
|
|
29924
|
+
} finally {
|
|
29925
|
+
rl.close();
|
|
29926
|
+
}
|
|
29927
|
+
}
|
|
29928
|
+
async function authorizeSensitiveActionLoopback(input) {
|
|
29929
|
+
const callback = await createOAuthLoopbackCallback({
|
|
29930
|
+
successHtml: () => renderOAuthLoopbackPage({
|
|
29931
|
+
status: "success",
|
|
29932
|
+
eyebrow: "Auto CLI",
|
|
29933
|
+
title: "Account deletion confirmed",
|
|
29934
|
+
message: "Auto received the fresh browser authorization. The CLI will finish deleting the account from your terminal.",
|
|
29935
|
+
details: [{ label: "Account", value: input.email }]
|
|
29936
|
+
}),
|
|
29937
|
+
failureHtml: () => renderOAuthLoopbackPage({
|
|
29938
|
+
status: "failure",
|
|
29939
|
+
eyebrow: "Auto CLI",
|
|
29940
|
+
title: "Account deletion confirmation failed",
|
|
29941
|
+
message: "The browser authorization did not complete. Return to your terminal to retry or inspect the error.",
|
|
29942
|
+
details: [{ label: "Account", value: input.email }]
|
|
29943
|
+
})
|
|
29944
|
+
});
|
|
29945
|
+
try {
|
|
29946
|
+
const authorizeUrl = new URL("/auth/cli", input.apiBaseUrl);
|
|
29947
|
+
authorizeUrl.searchParams.set("purpose", "sensitive_action");
|
|
29948
|
+
authorizeUrl.searchParams.set("redirect_uri", callback.redirectUri);
|
|
29949
|
+
input.context.writeOutput(
|
|
29950
|
+
`Opening ${input.context.io.style.url(authorizeUrl.toString())}`
|
|
29951
|
+
);
|
|
29952
|
+
input.context.writeOutput(
|
|
29953
|
+
input.context.io.style.dim(
|
|
29954
|
+
"Log in in your browser to confirm account deletion."
|
|
29955
|
+
)
|
|
29956
|
+
);
|
|
29957
|
+
openBrowser(authorizeUrl.toString());
|
|
29958
|
+
const result = await callback.result;
|
|
29959
|
+
if (!result.sensitiveActionToken) {
|
|
29960
|
+
throw new Error("Missing sensitive action authorization token");
|
|
29961
|
+
}
|
|
29962
|
+
return result.sensitiveActionToken;
|
|
29963
|
+
} finally {
|
|
29964
|
+
callback.close();
|
|
29965
|
+
}
|
|
29966
|
+
}
|
|
29967
|
+
async function authorizeSensitiveActionDevice(input) {
|
|
29968
|
+
const device = await postJson(
|
|
29969
|
+
input.context.fetch,
|
|
29970
|
+
`${input.apiBaseUrl}/api/v1/auth/device/code`,
|
|
29971
|
+
{
|
|
29972
|
+
purpose: "sensitive_action",
|
|
29973
|
+
action: "account_delete"
|
|
29974
|
+
}
|
|
29975
|
+
);
|
|
29976
|
+
input.context.writeOutput(
|
|
29977
|
+
`Open ${input.context.io.style.url(device.verification_uri)} and enter ${input.context.io.style.label(
|
|
29978
|
+
device.user_code
|
|
29979
|
+
)}`
|
|
29980
|
+
);
|
|
29981
|
+
input.context.writeOutput(
|
|
29982
|
+
`${input.context.io.style.label("Device code:")} ${input.context.io.style.id(
|
|
29983
|
+
device.device_code
|
|
29984
|
+
)}`
|
|
29985
|
+
);
|
|
29986
|
+
const deadline = Date.now() + device.expires_in * 1e3;
|
|
29987
|
+
let firstAttempt = true;
|
|
29988
|
+
while (Date.now() < deadline) {
|
|
29989
|
+
if (!firstAttempt) {
|
|
29990
|
+
await sleep2(Math.max(0, device.interval) * 1e3);
|
|
29991
|
+
}
|
|
29992
|
+
firstAttempt = false;
|
|
29993
|
+
try {
|
|
29994
|
+
const token2 = await postJson(input.context.fetch, `${input.apiBaseUrl}/api/v1/auth/cli/token`, {
|
|
29995
|
+
grant_type: "urn:auto:params:oauth:grant-type:sensitive_action_device_code",
|
|
29996
|
+
action: "account_delete",
|
|
29997
|
+
device_code: device.device_code
|
|
29998
|
+
});
|
|
29999
|
+
return token2.sensitive_action_token;
|
|
30000
|
+
} catch (error51) {
|
|
30001
|
+
if (error51 instanceof Error && error51.message === "authorization_pending") {
|
|
30002
|
+
continue;
|
|
30003
|
+
}
|
|
30004
|
+
throw error51;
|
|
30005
|
+
}
|
|
30006
|
+
}
|
|
30007
|
+
throw new Error("Device authorization expired before approval.");
|
|
30008
|
+
}
|
|
30009
|
+
async function requireYes(rl, prompt) {
|
|
30010
|
+
const answer = await rl.question(prompt);
|
|
30011
|
+
if (answer.trim() !== "yes") {
|
|
30012
|
+
throw new Error("Account deletion cancelled.");
|
|
30013
|
+
}
|
|
30014
|
+
}
|
|
30015
|
+
async function sleep2(ms) {
|
|
30016
|
+
await new Promise((resolve3) => setTimeout(resolve3, ms));
|
|
30017
|
+
}
|
|
30018
|
+
|
|
29757
30019
|
// src/commands/account/commands.ts
|
|
29758
30020
|
function registerAccountCommands(program, context) {
|
|
29759
30021
|
const account = program.command("account").description("Manage stored account profiles.");
|
|
@@ -29783,6 +30045,17 @@ function registerAccountCommands(program, context) {
|
|
|
29783
30045
|
(accountRef, options) => switchAccount(context, accountRef, options)
|
|
29784
30046
|
);
|
|
29785
30047
|
account.command("remove").description("Remove a stored account profile.").argument("<name>", "Profile name to remove").action((name) => removeProfile(context, name));
|
|
30048
|
+
account.command("delete").description("Permanently delete the signed-in Auto account.").option("--api-url <url>", "Auto web server URL").option(
|
|
30049
|
+
"--delete-admin-orgs",
|
|
30050
|
+
"delete organizations where this account is an admin"
|
|
30051
|
+
).option("--device", "use device authorization for fresh confirmation").option("--yes", "skip interactive yes/no prompts").option("--confirm <email>", "account email required for deletion").addOption(
|
|
30052
|
+
new Option(
|
|
30053
|
+
"--sensitive-action-token <token>",
|
|
30054
|
+
"fresh sensitive action authorization token"
|
|
30055
|
+
).hideHelp()
|
|
30056
|
+
).action(
|
|
30057
|
+
(options) => deleteAccount({ context, options })
|
|
30058
|
+
);
|
|
29786
30059
|
}
|
|
29787
30060
|
|
|
29788
30061
|
// src/commands/agent-bridge/git-credentials.ts
|
|
@@ -31766,16 +32039,6 @@ import { existsSync as existsSync3, mkdtempSync, writeFileSync as writeFileSync3
|
|
|
31766
32039
|
import { homedir as homedir3, tmpdir } from "os";
|
|
31767
32040
|
import { join as join4 } from "path";
|
|
31768
32041
|
|
|
31769
|
-
// src/lib/stdio/readline.ts
|
|
31770
|
-
import { createInterface } from "readline/promises";
|
|
31771
|
-
function createCliReadline(input) {
|
|
31772
|
-
return createInterface({
|
|
31773
|
-
input: input.stdin,
|
|
31774
|
-
output: input.stdout,
|
|
31775
|
-
terminal: Boolean(input.stdin.isTTY)
|
|
31776
|
-
});
|
|
31777
|
-
}
|
|
31778
|
-
|
|
31779
32042
|
// src/lib/stdio/secret.ts
|
|
31780
32043
|
async function questionSecret(context, prompt) {
|
|
31781
32044
|
const readline = createCliReadline(context);
|
|
@@ -31846,7 +32109,7 @@ async function connectAgentPresence2(input) {
|
|
|
31846
32109
|
);
|
|
31847
32110
|
return;
|
|
31848
32111
|
}
|
|
31849
|
-
const
|
|
32112
|
+
const sleep4 = input.sleep ?? ((ms) => new Promise((resolve3) => setTimeout(resolve3, ms)));
|
|
31850
32113
|
const openBrowser2 = input.openBrowser ?? openBrowser;
|
|
31851
32114
|
const now3 = input.now ?? Date.now;
|
|
31852
32115
|
const pollIntervalMs = input.pollIntervalMs ?? POLL_INTERVAL_MS;
|
|
@@ -31860,7 +32123,7 @@ async function connectAgentPresence2(input) {
|
|
|
31860
32123
|
const deadline = now3() + pollTimeoutMs;
|
|
31861
32124
|
let realized = false;
|
|
31862
32125
|
while (now3() < deadline) {
|
|
31863
|
-
await
|
|
32126
|
+
await sleep4(pollIntervalMs);
|
|
31864
32127
|
const presence = await input.client.getAgentPresence(
|
|
31865
32128
|
{ name: input.agent },
|
|
31866
32129
|
options
|
|
@@ -32613,11 +32876,11 @@ async function activeGrantIds(input) {
|
|
|
32613
32876
|
);
|
|
32614
32877
|
}
|
|
32615
32878
|
async function waitForNewGrant(input, knownGrantIds) {
|
|
32616
|
-
const
|
|
32879
|
+
const sleep4 = input.sleep ?? ((ms) => new Promise((resolve3) => setTimeout(resolve3, ms)));
|
|
32617
32880
|
const now3 = input.now ?? Date.now;
|
|
32618
32881
|
const deadline = now3() + (input.pollTimeoutMs ?? POLL_TIMEOUT_MS2);
|
|
32619
32882
|
while (now3() < deadline) {
|
|
32620
|
-
await
|
|
32883
|
+
await sleep4(input.pollIntervalMs ?? POLL_INTERVAL_MS2);
|
|
32621
32884
|
const result = await input.client.listConnections({
|
|
32622
32885
|
provider: input.provider,
|
|
32623
32886
|
apiBaseUrl: input.apiBaseUrl
|
|
@@ -33463,7 +33726,7 @@ function registerOnboardCommands(program, context) {
|
|
|
33463
33726
|
}
|
|
33464
33727
|
|
|
33465
33728
|
// src/commands/orgs/commands.ts
|
|
33466
|
-
import { Option } from "commander";
|
|
33729
|
+
import { Option as Option2 } from "commander";
|
|
33467
33730
|
function registerOrganizationCommands(program, context) {
|
|
33468
33731
|
const orgs = program.command("orgs").description("Manage the active organization.");
|
|
33469
33732
|
orgs.command("use").argument("<organization>").option("--api-url <url>", "Auto API base URL").option("--server <url>", "Auto web server URL").description("Set the active organization.").action(
|
|
@@ -33535,7 +33798,7 @@ function registerOrganizationCommands(program, context) {
|
|
|
33535
33798
|
}
|
|
33536
33799
|
});
|
|
33537
33800
|
orgs.command("invite").description("Invite a user to the active organization by email.").requiredOption("--email <email>", "Email address to invite").addOption(
|
|
33538
|
-
new
|
|
33801
|
+
new Option2("--role <role>", "Membership role").choices(["admin", "member"]).default("member")
|
|
33539
33802
|
).option("--api-url <url>", "Auto API base URL").option("--server <url>", "Auto web server URL").action(async (options) => {
|
|
33540
33803
|
const response = await createDirectoryClient(
|
|
33541
33804
|
context
|
|
@@ -33570,7 +33833,7 @@ function registerOrganizationCommands(program, context) {
|
|
|
33570
33833
|
}
|
|
33571
33834
|
});
|
|
33572
33835
|
members.command("add").description("Invite a user to the active organization by email.").requiredOption("--email <email>", "Email address to invite").addOption(
|
|
33573
|
-
new
|
|
33836
|
+
new Option2("--role <role>", "Membership role").choices(["admin", "member"]).default("member")
|
|
33574
33837
|
).option("--api-url <url>", "Auto API base URL").option("--server <url>", "Auto web server URL").action(async (options) => {
|
|
33575
33838
|
const response = await createDirectoryClient(
|
|
33576
33839
|
context
|
|
@@ -33588,7 +33851,7 @@ function registerOrganizationCommands(program, context) {
|
|
|
33588
33851
|
);
|
|
33589
33852
|
});
|
|
33590
33853
|
members.command("set-role").description("Set an existing active organization member's role.").requiredOption("--email <email>", "Email address of an existing member").addOption(
|
|
33591
|
-
new
|
|
33854
|
+
new Option2("--role <role>", "Membership role").choices(["admin", "member"]).makeOptionMandatory()
|
|
33592
33855
|
).option("--api-url <url>", "Auto API base URL").option("--server <url>", "Auto web server URL").action(async (options) => {
|
|
33593
33856
|
const response = await createDirectoryClient(
|
|
33594
33857
|
context
|
|
@@ -33634,7 +33897,7 @@ function memberLine(member, style) {
|
|
|
33634
33897
|
}
|
|
33635
33898
|
|
|
33636
33899
|
// src/commands/projects/commands.ts
|
|
33637
|
-
import { Option as
|
|
33900
|
+
import { Option as Option3 } from "commander";
|
|
33638
33901
|
init_active_project();
|
|
33639
33902
|
init_file();
|
|
33640
33903
|
|
|
@@ -33721,7 +33984,7 @@ function registerProjectCommands(program, context) {
|
|
|
33721
33984
|
}
|
|
33722
33985
|
});
|
|
33723
33986
|
projects.command("invite").description("Invite a user to the active project by email.").requiredOption("--email <email>", "Email address to invite").addOption(
|
|
33724
|
-
new
|
|
33987
|
+
new Option3("--role <role>", "Membership role").choices(["admin", "member"]).default("member")
|
|
33725
33988
|
).option("--api-url <url>", "Auto API base URL").option("--server <url>", "Auto web server URL").action(async (options) => {
|
|
33726
33989
|
const response = await createDirectoryClient(context).inviteProjectMember(
|
|
33727
33990
|
{
|
|
@@ -33752,7 +34015,7 @@ function registerProjectCommands(program, context) {
|
|
|
33752
34015
|
}
|
|
33753
34016
|
});
|
|
33754
34017
|
members.command("add").description("Invite a user to the active project by email.").requiredOption("--email <email>", "Email address to invite").addOption(
|
|
33755
|
-
new
|
|
34018
|
+
new Option3("--role <role>", "Membership role").choices(["admin", "member"]).default("member")
|
|
33756
34019
|
).option("--api-url <url>", "Auto API base URL").option("--server <url>", "Auto web server URL").action(async (options) => {
|
|
33757
34020
|
const response = await createDirectoryClient(context).addProjectMember({
|
|
33758
34021
|
email: options.email,
|
|
@@ -33768,7 +34031,7 @@ function registerProjectCommands(program, context) {
|
|
|
33768
34031
|
);
|
|
33769
34032
|
});
|
|
33770
34033
|
members.command("set-role").description("Set an existing active project member's role.").requiredOption("--email <email>", "Email address of an existing member").addOption(
|
|
33771
|
-
new
|
|
34034
|
+
new Option3("--role <role>", "Membership role").choices(["admin", "member"]).makeOptionMandatory()
|
|
33772
34035
|
).option("--api-url <url>", "Auto API base URL").option("--server <url>", "Auto web server URL").action(async (options) => {
|
|
33773
34036
|
const response = await createDirectoryClient(
|
|
33774
34037
|
context
|
|
@@ -35770,7 +36033,7 @@ function createProgram(options = {}) {
|
|
|
35770
36033
|
const program = new Command();
|
|
35771
36034
|
context.globalApiUrl = () => program.opts().apiUrl;
|
|
35772
36035
|
program.name("auto").description("Auto CLI.").version(cliVersion).addOption(
|
|
35773
|
-
new
|
|
36036
|
+
new Option4("--format <format>", "output format").choices([
|
|
35774
36037
|
"text",
|
|
35775
36038
|
"json",
|
|
35776
36039
|
"stream-json",
|