@autohq/cli 0.1.362 → 0.1.364
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent-bridge.js +32 -13
- package/dist/index.js +99 -54
- package/package.json +1 -1
package/dist/agent-bridge.js
CHANGED
|
@@ -23492,7 +23492,7 @@ Object.assign(lookup, {
|
|
|
23492
23492
|
// package.json
|
|
23493
23493
|
var package_default = {
|
|
23494
23494
|
name: "@autohq/cli",
|
|
23495
|
-
version: "0.1.
|
|
23495
|
+
version: "0.1.364",
|
|
23496
23496
|
license: "SEE LICENSE IN README.md",
|
|
23497
23497
|
publishConfig: {
|
|
23498
23498
|
access: "public"
|
|
@@ -25876,9 +25876,21 @@ var GithubSyncBindingCreateRequestSchema = external_exports.object({
|
|
|
25876
25876
|
branch: GithubSyncProductionBranchSchema.optional(),
|
|
25877
25877
|
ciWatchdog: GithubSyncCiWatchdogSchema.optional()
|
|
25878
25878
|
});
|
|
25879
|
+
var GithubSyncInitialSyncSchema = external_exports.object({
|
|
25880
|
+
started: external_exports.boolean(),
|
|
25881
|
+
headSha: external_exports.string().trim().min(1).optional(),
|
|
25882
|
+
workflowId: external_exports.string().trim().min(1).optional(),
|
|
25883
|
+
reason: external_exports.enum([
|
|
25884
|
+
"no_auto_directory",
|
|
25885
|
+
"already_applied",
|
|
25886
|
+
"probe_failed",
|
|
25887
|
+
"start_failed"
|
|
25888
|
+
]).optional()
|
|
25889
|
+
});
|
|
25879
25890
|
var GithubSyncBindingCreateResponseSchema = external_exports.object({
|
|
25880
25891
|
binding: GithubSyncBindingSchema,
|
|
25881
|
-
created: external_exports.boolean()
|
|
25892
|
+
created: external_exports.boolean(),
|
|
25893
|
+
initialSync: GithubSyncInitialSyncSchema.optional()
|
|
25882
25894
|
});
|
|
25883
25895
|
var GithubSyncBindingListResponseSchema = external_exports.object({
|
|
25884
25896
|
bindings: external_exports.array(GithubSyncBindingSchema)
|
|
@@ -27978,20 +27990,16 @@ var CreditEventRecordSchema = external_exports.object({
|
|
|
27978
27990
|
createdByUserId: external_exports.string().trim().min(1).nullable(),
|
|
27979
27991
|
createdAt: external_exports.string().datetime()
|
|
27980
27992
|
});
|
|
27981
|
-
var SPENDING_LIMIT_WINDOWS = ["
|
|
27993
|
+
var SPENDING_LIMIT_WINDOWS = ["day", "month"];
|
|
27982
27994
|
var SpendingLimitWindowSchema = external_exports.enum(SPENDING_LIMIT_WINDOWS);
|
|
27983
27995
|
var BilledSpendWindowsSchema = external_exports.object({
|
|
27984
|
-
hourUsd: NonNegativeUsdSchema,
|
|
27985
27996
|
dayUsd: NonNegativeUsdSchema,
|
|
27986
|
-
weekUsd: NonNegativeUsdSchema,
|
|
27987
27997
|
monthUsd: NonNegativeUsdSchema
|
|
27988
27998
|
});
|
|
27989
27999
|
var OrganizationBillingSettingsSchema = external_exports.object({
|
|
27990
28000
|
organizationId: OrganizationIdSchema,
|
|
27991
28001
|
// Null means no limit for that window.
|
|
27992
|
-
spendLimitHourUsd: PositiveUsdSchema.nullable(),
|
|
27993
28002
|
spendLimitDayUsd: PositiveUsdSchema.nullable(),
|
|
27994
|
-
spendLimitWeekUsd: PositiveUsdSchema.nullable(),
|
|
27995
28003
|
spendLimitMonthUsd: PositiveUsdSchema.nullable(),
|
|
27996
28004
|
autoTopUpEnabled: external_exports.boolean(),
|
|
27997
28005
|
// Balance at or below the threshold triggers a top-up of the configured
|
|
@@ -28000,9 +28008,7 @@ var OrganizationBillingSettingsSchema = external_exports.object({
|
|
|
28000
28008
|
autoTopUpAmountUsd: PositiveUsdSchema.nullable()
|
|
28001
28009
|
});
|
|
28002
28010
|
var UpdateOrganizationBillingSettingsRequestSchema = external_exports.object({
|
|
28003
|
-
spendLimitHourUsd: PositiveUsdSchema.nullable().optional(),
|
|
28004
28011
|
spendLimitDayUsd: PositiveUsdSchema.nullable().optional(),
|
|
28005
|
-
spendLimitWeekUsd: PositiveUsdSchema.nullable().optional(),
|
|
28006
28012
|
spendLimitMonthUsd: PositiveUsdSchema.nullable().optional(),
|
|
28007
28013
|
autoTopUpEnabled: external_exports.boolean().optional(),
|
|
28008
28014
|
autoTopUpThresholdUsd: NonNegativeUsdSchema.nullable().optional(),
|
|
@@ -28799,19 +28805,32 @@ var SetupOnboardingPullRequestSchema = external_exports.object({
|
|
|
28799
28805
|
baseBranch: GithubSyncProductionBranchSchema,
|
|
28800
28806
|
headSha: external_exports.string().trim().min(1)
|
|
28801
28807
|
});
|
|
28802
|
-
var
|
|
28803
|
-
|
|
28808
|
+
var SetupOnboardingSyncSchema = external_exports.object({
|
|
28809
|
+
branch: GithubSyncProductionBranchSchema,
|
|
28810
|
+
headSha: external_exports.string().trim().min(1).optional(),
|
|
28811
|
+
workflowStarted: external_exports.boolean()
|
|
28804
28812
|
});
|
|
28813
|
+
var SetupOnboardingPullRequestCreateResponseSchema = external_exports.discriminatedUnion("mode", [
|
|
28814
|
+
external_exports.object({
|
|
28815
|
+
mode: external_exports.literal("pull_request"),
|
|
28816
|
+
pullRequest: SetupOnboardingPullRequestSchema
|
|
28817
|
+
}),
|
|
28818
|
+
external_exports.object({
|
|
28819
|
+
mode: external_exports.literal("sync"),
|
|
28820
|
+
sync: SetupOnboardingSyncSchema
|
|
28821
|
+
})
|
|
28822
|
+
]);
|
|
28805
28823
|
var SetupOnboardingPullRequestStatusRequestSchema = external_exports.object({
|
|
28806
28824
|
githubConnection: external_exports.string().trim().min(1).optional(),
|
|
28807
28825
|
repo: GithubSyncRepositoryFullNameSchema,
|
|
28808
|
-
|
|
28826
|
+
// Absent in sync mode: there is no bootstrap PR, so readiness is apply-only.
|
|
28827
|
+
pullRequestNumber: external_exports.coerce.number().int().positive().optional()
|
|
28809
28828
|
});
|
|
28810
28829
|
var SetupOnboardingPullRequestStatusResponseSchema = external_exports.object({
|
|
28811
28830
|
pullRequest: external_exports.object({
|
|
28812
28831
|
merged: external_exports.boolean(),
|
|
28813
28832
|
state: external_exports.string().trim().min(1)
|
|
28814
|
-
}),
|
|
28833
|
+
}).optional(),
|
|
28815
28834
|
apply: external_exports.object({
|
|
28816
28835
|
applied: external_exports.boolean()
|
|
28817
28836
|
}),
|
package/dist/index.js
CHANGED
|
@@ -17234,7 +17234,7 @@ var init_connections = __esm({
|
|
|
17234
17234
|
});
|
|
17235
17235
|
|
|
17236
17236
|
// ../../packages/schemas/src/github-sync.ts
|
|
17237
|
-
var GITHUB_SYNC_AUTO_PATH, GITHUB_SYNC_CI_WATCHDOG_DEFAULT_DELAY_MS, GithubSyncRepositoryFullNameSchema, GithubSyncProductionBranchSchema, GithubSyncCiWatchdogWorkflowSchema, GithubSyncCiWatchdogSchema, GithubSyncBindingSchema, GithubSyncBindingCreateRequestSchema, GithubSyncBindingCreateResponseSchema, GithubSyncBindingListResponseSchema, GithubSyncTriggerArtifactSchema, GithubSyncWorkflowInputSchema, GithubSyncWorkflowResultSchema;
|
|
17237
|
+
var GITHUB_SYNC_AUTO_PATH, GITHUB_SYNC_CI_WATCHDOG_DEFAULT_DELAY_MS, GithubSyncRepositoryFullNameSchema, GithubSyncProductionBranchSchema, GithubSyncCiWatchdogWorkflowSchema, GithubSyncCiWatchdogSchema, GithubSyncBindingSchema, GithubSyncBindingCreateRequestSchema, GithubSyncInitialSyncSchema, GithubSyncBindingCreateResponseSchema, GithubSyncBindingListResponseSchema, GithubSyncTriggerArtifactSchema, GithubSyncWorkflowInputSchema, GithubSyncWorkflowResultSchema;
|
|
17238
17238
|
var init_github_sync = __esm({
|
|
17239
17239
|
"../../packages/schemas/src/github-sync.ts"() {
|
|
17240
17240
|
"use strict";
|
|
@@ -17280,9 +17280,21 @@ var init_github_sync = __esm({
|
|
|
17280
17280
|
branch: GithubSyncProductionBranchSchema.optional(),
|
|
17281
17281
|
ciWatchdog: GithubSyncCiWatchdogSchema.optional()
|
|
17282
17282
|
});
|
|
17283
|
+
GithubSyncInitialSyncSchema = external_exports.object({
|
|
17284
|
+
started: external_exports.boolean(),
|
|
17285
|
+
headSha: external_exports.string().trim().min(1).optional(),
|
|
17286
|
+
workflowId: external_exports.string().trim().min(1).optional(),
|
|
17287
|
+
reason: external_exports.enum([
|
|
17288
|
+
"no_auto_directory",
|
|
17289
|
+
"already_applied",
|
|
17290
|
+
"probe_failed",
|
|
17291
|
+
"start_failed"
|
|
17292
|
+
]).optional()
|
|
17293
|
+
});
|
|
17283
17294
|
GithubSyncBindingCreateResponseSchema = external_exports.object({
|
|
17284
17295
|
binding: GithubSyncBindingSchema,
|
|
17285
|
-
created: external_exports.boolean()
|
|
17296
|
+
created: external_exports.boolean(),
|
|
17297
|
+
initialSync: GithubSyncInitialSyncSchema.optional()
|
|
17286
17298
|
});
|
|
17287
17299
|
GithubSyncBindingListResponseSchema = external_exports.object({
|
|
17288
17300
|
bindings: external_exports.array(GithubSyncBindingSchema)
|
|
@@ -19609,20 +19621,16 @@ var init_billing = __esm({
|
|
|
19609
19621
|
createdByUserId: external_exports.string().trim().min(1).nullable(),
|
|
19610
19622
|
createdAt: external_exports.string().datetime()
|
|
19611
19623
|
});
|
|
19612
|
-
SPENDING_LIMIT_WINDOWS = ["
|
|
19624
|
+
SPENDING_LIMIT_WINDOWS = ["day", "month"];
|
|
19613
19625
|
SpendingLimitWindowSchema = external_exports.enum(SPENDING_LIMIT_WINDOWS);
|
|
19614
19626
|
BilledSpendWindowsSchema = external_exports.object({
|
|
19615
|
-
hourUsd: NonNegativeUsdSchema,
|
|
19616
19627
|
dayUsd: NonNegativeUsdSchema,
|
|
19617
|
-
weekUsd: NonNegativeUsdSchema,
|
|
19618
19628
|
monthUsd: NonNegativeUsdSchema
|
|
19619
19629
|
});
|
|
19620
19630
|
OrganizationBillingSettingsSchema = external_exports.object({
|
|
19621
19631
|
organizationId: OrganizationIdSchema,
|
|
19622
19632
|
// Null means no limit for that window.
|
|
19623
|
-
spendLimitHourUsd: PositiveUsdSchema.nullable(),
|
|
19624
19633
|
spendLimitDayUsd: PositiveUsdSchema.nullable(),
|
|
19625
|
-
spendLimitWeekUsd: PositiveUsdSchema.nullable(),
|
|
19626
19634
|
spendLimitMonthUsd: PositiveUsdSchema.nullable(),
|
|
19627
19635
|
autoTopUpEnabled: external_exports.boolean(),
|
|
19628
19636
|
// Balance at or below the threshold triggers a top-up of the configured
|
|
@@ -19631,9 +19639,7 @@ var init_billing = __esm({
|
|
|
19631
19639
|
autoTopUpAmountUsd: PositiveUsdSchema.nullable()
|
|
19632
19640
|
});
|
|
19633
19641
|
UpdateOrganizationBillingSettingsRequestSchema = external_exports.object({
|
|
19634
|
-
spendLimitHourUsd: PositiveUsdSchema.nullable().optional(),
|
|
19635
19642
|
spendLimitDayUsd: PositiveUsdSchema.nullable().optional(),
|
|
19636
|
-
spendLimitWeekUsd: PositiveUsdSchema.nullable().optional(),
|
|
19637
19643
|
spendLimitMonthUsd: PositiveUsdSchema.nullable().optional(),
|
|
19638
19644
|
autoTopUpEnabled: external_exports.boolean().optional(),
|
|
19639
19645
|
autoTopUpThresholdUsd: NonNegativeUsdSchema.nullable().optional(),
|
|
@@ -20513,7 +20519,7 @@ var init_session_turns = __esm({
|
|
|
20513
20519
|
});
|
|
20514
20520
|
|
|
20515
20521
|
// ../../packages/schemas/src/setup.ts
|
|
20516
|
-
var SetupOnboardingPullRequestCreateRequestSchema, SetupOnboardingPullRequestSchema, SetupOnboardingPullRequestCreateResponseSchema, SetupOnboardingPullRequestStatusRequestSchema, SetupOnboardingPullRequestStatusResponseSchema;
|
|
20522
|
+
var SetupOnboardingPullRequestCreateRequestSchema, SetupOnboardingPullRequestSchema, SetupOnboardingSyncSchema, SetupOnboardingPullRequestCreateResponseSchema, SetupOnboardingPullRequestStatusRequestSchema, SetupOnboardingPullRequestStatusResponseSchema;
|
|
20517
20523
|
var init_setup = __esm({
|
|
20518
20524
|
"../../packages/schemas/src/setup.ts"() {
|
|
20519
20525
|
"use strict";
|
|
@@ -20532,19 +20538,32 @@ var init_setup = __esm({
|
|
|
20532
20538
|
baseBranch: GithubSyncProductionBranchSchema,
|
|
20533
20539
|
headSha: external_exports.string().trim().min(1)
|
|
20534
20540
|
});
|
|
20535
|
-
|
|
20536
|
-
|
|
20541
|
+
SetupOnboardingSyncSchema = external_exports.object({
|
|
20542
|
+
branch: GithubSyncProductionBranchSchema,
|
|
20543
|
+
headSha: external_exports.string().trim().min(1).optional(),
|
|
20544
|
+
workflowStarted: external_exports.boolean()
|
|
20537
20545
|
});
|
|
20546
|
+
SetupOnboardingPullRequestCreateResponseSchema = external_exports.discriminatedUnion("mode", [
|
|
20547
|
+
external_exports.object({
|
|
20548
|
+
mode: external_exports.literal("pull_request"),
|
|
20549
|
+
pullRequest: SetupOnboardingPullRequestSchema
|
|
20550
|
+
}),
|
|
20551
|
+
external_exports.object({
|
|
20552
|
+
mode: external_exports.literal("sync"),
|
|
20553
|
+
sync: SetupOnboardingSyncSchema
|
|
20554
|
+
})
|
|
20555
|
+
]);
|
|
20538
20556
|
SetupOnboardingPullRequestStatusRequestSchema = external_exports.object({
|
|
20539
20557
|
githubConnection: external_exports.string().trim().min(1).optional(),
|
|
20540
20558
|
repo: GithubSyncRepositoryFullNameSchema,
|
|
20541
|
-
|
|
20559
|
+
// Absent in sync mode: there is no bootstrap PR, so readiness is apply-only.
|
|
20560
|
+
pullRequestNumber: external_exports.coerce.number().int().positive().optional()
|
|
20542
20561
|
});
|
|
20543
20562
|
SetupOnboardingPullRequestStatusResponseSchema = external_exports.object({
|
|
20544
20563
|
pullRequest: external_exports.object({
|
|
20545
20564
|
merged: external_exports.boolean(),
|
|
20546
20565
|
state: external_exports.string().trim().min(1)
|
|
20547
|
-
}),
|
|
20566
|
+
}).optional(),
|
|
20548
20567
|
apply: external_exports.object({
|
|
20549
20568
|
applied: external_exports.boolean()
|
|
20550
20569
|
}),
|
|
@@ -30421,10 +30440,13 @@ function createApiClient(input) {
|
|
|
30421
30440
|
},
|
|
30422
30441
|
async getSetupOnboardingPullRequestStatus(request, options = {}) {
|
|
30423
30442
|
const project = await activeProject();
|
|
30424
|
-
const searchParams = [
|
|
30425
|
-
|
|
30426
|
-
[
|
|
30427
|
-
|
|
30443
|
+
const searchParams = [["repo", request.repo]];
|
|
30444
|
+
if (request.pullRequestNumber !== void 0) {
|
|
30445
|
+
searchParams.push([
|
|
30446
|
+
"pullRequestNumber",
|
|
30447
|
+
String(request.pullRequestNumber)
|
|
30448
|
+
]);
|
|
30449
|
+
}
|
|
30428
30450
|
if (request.githubConnection) {
|
|
30429
30451
|
searchParams.push(["githubConnection", request.githubConnection]);
|
|
30430
30452
|
}
|
|
@@ -31555,7 +31577,7 @@ var init_package = __esm({
|
|
|
31555
31577
|
"package.json"() {
|
|
31556
31578
|
package_default = {
|
|
31557
31579
|
name: "@autohq/cli",
|
|
31558
|
-
version: "0.1.
|
|
31580
|
+
version: "0.1.364",
|
|
31559
31581
|
license: "SEE LICENSE IN README.md",
|
|
31560
31582
|
publishConfig: {
|
|
31561
31583
|
access: "public"
|
|
@@ -33353,9 +33375,14 @@ var init_template_variables = __esm({
|
|
|
33353
33375
|
});
|
|
33354
33376
|
|
|
33355
33377
|
// ../../packages/schemas/src/project-apply-files/agent-authoring.ts
|
|
33356
|
-
function readApplyDocument(path2, document, fileIndex) {
|
|
33378
|
+
function readApplyDocument(path2, document, fileIndex, contextVariables) {
|
|
33357
33379
|
assertAgentAuthoringDocument(document, path2);
|
|
33358
|
-
const result = compileAgentDocumentValue(
|
|
33380
|
+
const result = compileAgentDocumentValue(
|
|
33381
|
+
document,
|
|
33382
|
+
path2,
|
|
33383
|
+
fileIndex,
|
|
33384
|
+
contextVariables
|
|
33385
|
+
);
|
|
33359
33386
|
return result.resources.map((resource) => ({
|
|
33360
33387
|
resource,
|
|
33361
33388
|
generatedFromAgent: resource !== result.resource
|
|
@@ -33413,12 +33440,13 @@ function dedupeGeneratedResources(records) {
|
|
|
33413
33440
|
}
|
|
33414
33441
|
return deduped.map((record2) => record2.resource);
|
|
33415
33442
|
}
|
|
33416
|
-
function compileAgentDocumentValue(document, path2, fileIndex) {
|
|
33443
|
+
function compileAgentDocumentValue(document, path2, fileIndex, contextVariables) {
|
|
33417
33444
|
return compileAgentDraftResources(
|
|
33418
33445
|
compileAgentDocument2(document, path2, {
|
|
33419
33446
|
fileIndex,
|
|
33420
33447
|
stack: [],
|
|
33421
|
-
variables: /* @__PURE__ */ new Map()
|
|
33448
|
+
variables: /* @__PURE__ */ new Map(),
|
|
33449
|
+
...contextVariables && Object.keys(contextVariables).length > 0 ? { contextVariables: new Map(Object.entries(contextVariables)) } : {}
|
|
33422
33450
|
}),
|
|
33423
33451
|
path2
|
|
33424
33452
|
);
|
|
@@ -33433,7 +33461,10 @@ function compileAgentDocument2(document, path2, context) {
|
|
|
33433
33461
|
if (!isRecord2(document)) {
|
|
33434
33462
|
throw new Error(`Invalid agent authoring file ${path2}: expected object`);
|
|
33435
33463
|
}
|
|
33436
|
-
const variables = context.stack.length === 0 ?
|
|
33464
|
+
const variables = context.stack.length === 0 ? new Map([
|
|
33465
|
+
...context.contextVariables ?? /* @__PURE__ */ new Map(),
|
|
33466
|
+
...readVariableScope(document, normalizedPath)
|
|
33467
|
+
]) : context.variables;
|
|
33437
33468
|
let merged = emptyAgentDraft();
|
|
33438
33469
|
for (const importPath of importPaths2(document)) {
|
|
33439
33470
|
const imported = resolveImportPath2(
|
|
@@ -33763,7 +33794,10 @@ function readProjectApplyDirectorySource(input) {
|
|
|
33763
33794
|
).sort((left, right) => left.path.localeCompare(right.path));
|
|
33764
33795
|
const resourceRecords = [];
|
|
33765
33796
|
for (const file2 of agentFiles) {
|
|
33766
|
-
const request = readProjectApplyDocumentSourceFile(file2, {
|
|
33797
|
+
const request = readProjectApplyDocumentSourceFile(file2, {
|
|
33798
|
+
fileIndex,
|
|
33799
|
+
...input.contextVariables ? { contextVariables: input.contextVariables } : {}
|
|
33800
|
+
});
|
|
33767
33801
|
resourceRecords.push(
|
|
33768
33802
|
...request.resources.map((resource) => ({
|
|
33769
33803
|
resource,
|
|
@@ -33814,7 +33848,7 @@ function readProjectApplyDocumentSourceFile(file2, options = {}) {
|
|
|
33814
33848
|
}
|
|
33815
33849
|
}
|
|
33816
33850
|
const resourceRecords = documents.flatMap(
|
|
33817
|
-
(document) => readApplyDocument(file2.path, document, fileIndex)
|
|
33851
|
+
(document) => readApplyDocument(file2.path, document, fileIndex, options.contextVariables)
|
|
33818
33852
|
);
|
|
33819
33853
|
return ProjectApplyRequestSchema.parse({
|
|
33820
33854
|
delete: [],
|
|
@@ -51581,7 +51615,7 @@ async function setupAction(rawContext, options) {
|
|
|
51581
51615
|
"To kick things off, Auto will open a PR adding an onboarding agent that walks you through the rest of the process. Once you merge the PR, add `@auto` to a Slack channel, tag `@auto.onboarding` in a message, and that agent will take it from there."
|
|
51582
51616
|
);
|
|
51583
51617
|
context.writeOutput("");
|
|
51584
|
-
context.writeOutput("
|
|
51618
|
+
context.writeOutput("Preparing the onboarding agent...");
|
|
51585
51619
|
const response = await client.createSetupOnboardingPullRequest(
|
|
51586
51620
|
{
|
|
51587
51621
|
githubConnection: github.name,
|
|
@@ -51590,32 +51624,42 @@ async function setupAction(rawContext, options) {
|
|
|
51590
51624
|
},
|
|
51591
51625
|
{ apiBaseUrl }
|
|
51592
51626
|
);
|
|
51593
|
-
|
|
51594
|
-
|
|
51595
|
-
|
|
51596
|
-
|
|
51597
|
-
|
|
51598
|
-
|
|
51599
|
-
|
|
51600
|
-
|
|
51601
|
-
|
|
51602
|
-
|
|
51603
|
-
|
|
51604
|
-
|
|
51605
|
-
|
|
51606
|
-
|
|
51627
|
+
if (response.mode === "sync") {
|
|
51628
|
+
context.writeOutput("");
|
|
51629
|
+
context.writeOutput(
|
|
51630
|
+
`This repo already has Auto set up: found an onboarding agent under \`.auto/agents/\` on ${response.sync.branch}. Syncing its resources instead of opening a PR.`
|
|
51631
|
+
);
|
|
51632
|
+
context.writeOutput(
|
|
51633
|
+
"Auto will wait here and detect when the onboarding agent has been applied."
|
|
51634
|
+
);
|
|
51635
|
+
} else {
|
|
51636
|
+
context.writeOutput("");
|
|
51637
|
+
context.writeOutput(`Opened PR #${response.pullRequest.number}.`);
|
|
51638
|
+
if (response.pullRequest.url) {
|
|
51639
|
+
await explainBrowserStep(context, {
|
|
51640
|
+
browser: options.browser,
|
|
51641
|
+
heading: "Review the onboarding PR",
|
|
51642
|
+
body: [
|
|
51643
|
+
"Auto will open the pull request it just created.",
|
|
51644
|
+
"Reviewing and merging this PR adds the onboarding agent to `.auto/`. GitHub Sync applies it after merge; then add `@auto` to a Slack channel and tag `@auto.onboarding` to start."
|
|
51645
|
+
],
|
|
51646
|
+
prompt: "Press Enter to open the PR."
|
|
51647
|
+
});
|
|
51648
|
+
if (options.browser !== false) {
|
|
51649
|
+
(options.openBrowser ?? openBrowser)(response.pullRequest.url);
|
|
51650
|
+
}
|
|
51651
|
+
context.writeOutput(response.pullRequest.url);
|
|
51607
51652
|
}
|
|
51608
|
-
context.writeOutput(
|
|
51653
|
+
context.writeOutput("");
|
|
51654
|
+
context.writeOutput(
|
|
51655
|
+
"Review and merge the PR. Auto will wait here and detect when the onboarding agent has been applied."
|
|
51656
|
+
);
|
|
51609
51657
|
}
|
|
51610
|
-
context.writeOutput("");
|
|
51611
|
-
context.writeOutput(
|
|
51612
|
-
"Review and merge the PR. Auto will wait here and detect when the onboarding agent has been applied."
|
|
51613
|
-
);
|
|
51614
51658
|
await waitForOnboardingReady(context, client, {
|
|
51615
51659
|
apiBaseUrl,
|
|
51616
51660
|
githubConnection: github.name,
|
|
51617
51661
|
repo,
|
|
51618
|
-
pullRequestNumber: response.pullRequest.number,
|
|
51662
|
+
...response.mode === "pull_request" ? { pullRequestNumber: response.pullRequest.number } : {},
|
|
51619
51663
|
pollIntervalMs: options.statusPollIntervalMs,
|
|
51620
51664
|
sleep: options.sleep
|
|
51621
51665
|
});
|
|
@@ -52059,13 +52103,13 @@ async function waitForOnboardingReady(context, client, input) {
|
|
|
52059
52103
|
{
|
|
52060
52104
|
githubConnection: input.githubConnection,
|
|
52061
52105
|
repo: input.repo,
|
|
52062
|
-
pullRequestNumber: input.pullRequestNumber
|
|
52106
|
+
...input.pullRequestNumber !== void 0 ? { pullRequestNumber: input.pullRequestNumber } : {}
|
|
52063
52107
|
},
|
|
52064
52108
|
{ apiBaseUrl: input.apiBaseUrl }
|
|
52065
52109
|
).catch((error51) => {
|
|
52066
52110
|
consecutiveStatusErrors += 1;
|
|
52067
52111
|
if (consecutiveStatusErrors === 1) {
|
|
52068
|
-
context.writeOutput("Waiting for
|
|
52112
|
+
context.writeOutput("Waiting for onboarding to be ready...");
|
|
52069
52113
|
}
|
|
52070
52114
|
if (consecutiveStatusErrors >= SETUP_STATUS_MAX_CONSECUTIVE_ERRORS) {
|
|
52071
52115
|
throw error51;
|
|
@@ -52077,17 +52121,18 @@ async function waitForOnboardingReady(context, client, input) {
|
|
|
52077
52121
|
continue;
|
|
52078
52122
|
}
|
|
52079
52123
|
consecutiveStatusErrors = 0;
|
|
52080
|
-
|
|
52124
|
+
const pullRequest = status.pullRequest;
|
|
52125
|
+
if (pullRequest && !pullRequest.merged && pullRequest.state === "closed") {
|
|
52081
52126
|
throw new Error(
|
|
52082
52127
|
"The onboarding PR was closed without being merged. Re-run `auto setup` to open it again."
|
|
52083
52128
|
);
|
|
52084
52129
|
}
|
|
52085
|
-
if (!
|
|
52130
|
+
if (pullRequest && !pullRequest.merged && pullRequest.state !== "open") {
|
|
52086
52131
|
throw new Error(
|
|
52087
|
-
`The onboarding PR is in unexpected state "${
|
|
52132
|
+
`The onboarding PR is in unexpected state "${pullRequest.state}". Check the PR, then rerun \`auto setup\` if needed.`
|
|
52088
52133
|
);
|
|
52089
52134
|
}
|
|
52090
|
-
if (
|
|
52135
|
+
if (pullRequest?.merged && !reportedMerged) {
|
|
52091
52136
|
context.writeOutput("Detected PR merge.");
|
|
52092
52137
|
reportedMerged = true;
|
|
52093
52138
|
}
|
|
@@ -52100,7 +52145,7 @@ async function waitForOnboardingReady(context, client, input) {
|
|
|
52100
52145
|
}
|
|
52101
52146
|
if (pollCount % SETUP_STATUS_HINT_EVERY_POLLS === 0) {
|
|
52102
52147
|
context.writeOutput(
|
|
52103
|
-
|
|
52148
|
+
!pullRequest || pullRequest.merged ? "Still waiting for GitHub Sync to apply the onboarding agent..." : "Still waiting for the onboarding PR to be merged..."
|
|
52104
52149
|
);
|
|
52105
52150
|
}
|
|
52106
52151
|
await sleep5(pollIntervalMs);
|