@autohq/cli 0.1.363 → 0.1.365

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.
@@ -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.363",
23495
+ version: "0.1.365",
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)
@@ -26188,10 +26200,35 @@ var EncryptedSecretValueSchema = external_exports.object({
26188
26200
  dekAuthTag: SecretAesGcmAuthTagSchema
26189
26201
  });
26190
26202
  var SecretDescriptionSchema = external_exports.string().trim().max(1024);
26203
+ var SECRET_BINDING_HOST_PATTERN = /^(?=.{1,253}$)([a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z]([a-z0-9-]{0,61}[a-z0-9])?$/;
26204
+ var SECRET_BINDING_HEADER_PATTERN = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
26205
+ var SECRET_BINDING_FORBIDDEN_HEADERS = /* @__PURE__ */ new Set([
26206
+ "connection",
26207
+ "content-length",
26208
+ "host",
26209
+ "transfer-encoding"
26210
+ ]);
26211
+ var SecretBindingHostSchema = external_exports.string().trim().toLowerCase().regex(
26212
+ SECRET_BINDING_HOST_PATTERN,
26213
+ "Binding hosts must be exact lowercase hostnames (no wildcards, schemes, ports, or paths)"
26214
+ );
26215
+ var SecretBindingHeaderSchema = external_exports.string().trim().min(1).max(128).regex(SECRET_BINDING_HEADER_PATTERN, "Invalid HTTP header name").refine(
26216
+ (header) => !SECRET_BINDING_FORBIDDEN_HEADERS.has(header.toLowerCase()),
26217
+ "This header cannot carry a secret binding"
26218
+ );
26219
+ var SecretBindingSchema = external_exports.object({
26220
+ hosts: external_exports.array(SecretBindingHostSchema).min(1).max(16),
26221
+ header: SecretBindingHeaderSchema,
26222
+ format: external_exports.string().min(1).max(256).refine(
26223
+ (format) => format.includes("{value}"),
26224
+ "Binding format must contain the {value} placeholder"
26225
+ ).optional()
26226
+ });
26191
26227
  var SecretSetRequestSchema = external_exports.object({
26192
26228
  value: external_exports.string(),
26193
26229
  description: SecretDescriptionSchema.nullable().optional(),
26194
- protected: external_exports.boolean().optional()
26230
+ protected: external_exports.boolean().optional(),
26231
+ binding: SecretBindingSchema.nullable().optional()
26195
26232
  });
26196
26233
  var SecretRotateRequestSchema = external_exports.object({
26197
26234
  value: external_exports.string()
@@ -26203,6 +26240,9 @@ var SecretMetadataSchema = external_exports.object({
26203
26240
  name: ResourceNameSchema,
26204
26241
  description: external_exports.string().nullable(),
26205
26242
  protected: external_exports.boolean(),
26243
+ // Defaulted rather than required so a newer client parsing an older
26244
+ // server's metadata (deploy skew) treats an absent binding as unbound.
26245
+ binding: SecretBindingSchema.nullable().default(null),
26206
26246
  createdAt: external_exports.string().datetime(),
26207
26247
  updatedAt: external_exports.string().datetime(),
26208
26248
  lastRotatedAt: external_exports.string().datetime().nullable(),
@@ -28793,19 +28833,32 @@ var SetupOnboardingPullRequestSchema = external_exports.object({
28793
28833
  baseBranch: GithubSyncProductionBranchSchema,
28794
28834
  headSha: external_exports.string().trim().min(1)
28795
28835
  });
28796
- var SetupOnboardingPullRequestCreateResponseSchema = external_exports.object({
28797
- pullRequest: SetupOnboardingPullRequestSchema
28836
+ var SetupOnboardingSyncSchema = external_exports.object({
28837
+ branch: GithubSyncProductionBranchSchema,
28838
+ headSha: external_exports.string().trim().min(1).optional(),
28839
+ workflowStarted: external_exports.boolean()
28798
28840
  });
28841
+ var SetupOnboardingPullRequestCreateResponseSchema = external_exports.discriminatedUnion("mode", [
28842
+ external_exports.object({
28843
+ mode: external_exports.literal("pull_request"),
28844
+ pullRequest: SetupOnboardingPullRequestSchema
28845
+ }),
28846
+ external_exports.object({
28847
+ mode: external_exports.literal("sync"),
28848
+ sync: SetupOnboardingSyncSchema
28849
+ })
28850
+ ]);
28799
28851
  var SetupOnboardingPullRequestStatusRequestSchema = external_exports.object({
28800
28852
  githubConnection: external_exports.string().trim().min(1).optional(),
28801
28853
  repo: GithubSyncRepositoryFullNameSchema,
28802
- pullRequestNumber: external_exports.coerce.number().int().positive()
28854
+ // Absent in sync mode: there is no bootstrap PR, so readiness is apply-only.
28855
+ pullRequestNumber: external_exports.coerce.number().int().positive().optional()
28803
28856
  });
28804
28857
  var SetupOnboardingPullRequestStatusResponseSchema = external_exports.object({
28805
28858
  pullRequest: external_exports.object({
28806
28859
  merged: external_exports.boolean(),
28807
28860
  state: external_exports.string().trim().min(1)
28808
- }),
28861
+ }).optional(),
28809
28862
  apply: external_exports.object({
28810
28863
  applied: external_exports.boolean()
28811
28864
  }),
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)
@@ -17587,7 +17599,7 @@ var init_mounts = __esm({
17587
17599
  });
17588
17600
 
17589
17601
  // ../../packages/schemas/src/secrets.ts
17590
- var SECRET_ENCRYPTION_ALGORITHM, SecretEnvNameSchema, SecretCiphertextFieldSchema, SecretAesGcmIvSchema, SecretAesGcmAuthTagSchema, SecretEnvValueSchema, SecretEnvSchema, EncryptedSecretValueSchema, SecretDescriptionSchema, SecretSetRequestSchema, SecretRotateRequestSchema, SecretMetadataSchema, SecretSetResponseSchema, SecretListResponseSchema, SecretDeleteResponseSchema, SecretRevealResponseSchema;
17602
+ var SECRET_ENCRYPTION_ALGORITHM, SecretEnvNameSchema, SecretCiphertextFieldSchema, SecretAesGcmIvSchema, SecretAesGcmAuthTagSchema, SecretEnvValueSchema, SecretEnvSchema, EncryptedSecretValueSchema, SecretDescriptionSchema, SECRET_BINDING_HOST_PATTERN, SECRET_BINDING_HEADER_PATTERN, SECRET_BINDING_FORBIDDEN_HEADERS, SecretBindingHostSchema, SecretBindingHeaderSchema, SecretBindingSchema, SecretSetRequestSchema, SecretRotateRequestSchema, SecretMetadataSchema, SecretSetResponseSchema, SecretListResponseSchema, SecretDeleteResponseSchema, SecretRevealResponseSchema;
17591
17603
  var init_secrets = __esm({
17592
17604
  "../../packages/schemas/src/secrets.ts"() {
17593
17605
  "use strict";
@@ -17620,10 +17632,35 @@ var init_secrets = __esm({
17620
17632
  dekAuthTag: SecretAesGcmAuthTagSchema
17621
17633
  });
17622
17634
  SecretDescriptionSchema = external_exports.string().trim().max(1024);
17635
+ SECRET_BINDING_HOST_PATTERN = /^(?=.{1,253}$)([a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z]([a-z0-9-]{0,61}[a-z0-9])?$/;
17636
+ SECRET_BINDING_HEADER_PATTERN = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
17637
+ SECRET_BINDING_FORBIDDEN_HEADERS = /* @__PURE__ */ new Set([
17638
+ "connection",
17639
+ "content-length",
17640
+ "host",
17641
+ "transfer-encoding"
17642
+ ]);
17643
+ SecretBindingHostSchema = external_exports.string().trim().toLowerCase().regex(
17644
+ SECRET_BINDING_HOST_PATTERN,
17645
+ "Binding hosts must be exact lowercase hostnames (no wildcards, schemes, ports, or paths)"
17646
+ );
17647
+ SecretBindingHeaderSchema = external_exports.string().trim().min(1).max(128).regex(SECRET_BINDING_HEADER_PATTERN, "Invalid HTTP header name").refine(
17648
+ (header) => !SECRET_BINDING_FORBIDDEN_HEADERS.has(header.toLowerCase()),
17649
+ "This header cannot carry a secret binding"
17650
+ );
17651
+ SecretBindingSchema = external_exports.object({
17652
+ hosts: external_exports.array(SecretBindingHostSchema).min(1).max(16),
17653
+ header: SecretBindingHeaderSchema,
17654
+ format: external_exports.string().min(1).max(256).refine(
17655
+ (format) => format.includes("{value}"),
17656
+ "Binding format must contain the {value} placeholder"
17657
+ ).optional()
17658
+ });
17623
17659
  SecretSetRequestSchema = external_exports.object({
17624
17660
  value: external_exports.string(),
17625
17661
  description: SecretDescriptionSchema.nullable().optional(),
17626
- protected: external_exports.boolean().optional()
17662
+ protected: external_exports.boolean().optional(),
17663
+ binding: SecretBindingSchema.nullable().optional()
17627
17664
  });
17628
17665
  SecretRotateRequestSchema = external_exports.object({
17629
17666
  value: external_exports.string()
@@ -17635,6 +17672,9 @@ var init_secrets = __esm({
17635
17672
  name: ResourceNameSchema,
17636
17673
  description: external_exports.string().nullable(),
17637
17674
  protected: external_exports.boolean(),
17675
+ // Defaulted rather than required so a newer client parsing an older
17676
+ // server's metadata (deploy skew) treats an absent binding as unbound.
17677
+ binding: SecretBindingSchema.nullable().default(null),
17638
17678
  createdAt: external_exports.string().datetime(),
17639
17679
  updatedAt: external_exports.string().datetime(),
17640
17680
  lastRotatedAt: external_exports.string().datetime().nullable(),
@@ -20507,7 +20547,7 @@ var init_session_turns = __esm({
20507
20547
  });
20508
20548
 
20509
20549
  // ../../packages/schemas/src/setup.ts
20510
- var SetupOnboardingPullRequestCreateRequestSchema, SetupOnboardingPullRequestSchema, SetupOnboardingPullRequestCreateResponseSchema, SetupOnboardingPullRequestStatusRequestSchema, SetupOnboardingPullRequestStatusResponseSchema;
20550
+ var SetupOnboardingPullRequestCreateRequestSchema, SetupOnboardingPullRequestSchema, SetupOnboardingSyncSchema, SetupOnboardingPullRequestCreateResponseSchema, SetupOnboardingPullRequestStatusRequestSchema, SetupOnboardingPullRequestStatusResponseSchema;
20511
20551
  var init_setup = __esm({
20512
20552
  "../../packages/schemas/src/setup.ts"() {
20513
20553
  "use strict";
@@ -20526,19 +20566,32 @@ var init_setup = __esm({
20526
20566
  baseBranch: GithubSyncProductionBranchSchema,
20527
20567
  headSha: external_exports.string().trim().min(1)
20528
20568
  });
20529
- SetupOnboardingPullRequestCreateResponseSchema = external_exports.object({
20530
- pullRequest: SetupOnboardingPullRequestSchema
20569
+ SetupOnboardingSyncSchema = external_exports.object({
20570
+ branch: GithubSyncProductionBranchSchema,
20571
+ headSha: external_exports.string().trim().min(1).optional(),
20572
+ workflowStarted: external_exports.boolean()
20531
20573
  });
20574
+ SetupOnboardingPullRequestCreateResponseSchema = external_exports.discriminatedUnion("mode", [
20575
+ external_exports.object({
20576
+ mode: external_exports.literal("pull_request"),
20577
+ pullRequest: SetupOnboardingPullRequestSchema
20578
+ }),
20579
+ external_exports.object({
20580
+ mode: external_exports.literal("sync"),
20581
+ sync: SetupOnboardingSyncSchema
20582
+ })
20583
+ ]);
20532
20584
  SetupOnboardingPullRequestStatusRequestSchema = external_exports.object({
20533
20585
  githubConnection: external_exports.string().trim().min(1).optional(),
20534
20586
  repo: GithubSyncRepositoryFullNameSchema,
20535
- pullRequestNumber: external_exports.coerce.number().int().positive()
20587
+ // Absent in sync mode: there is no bootstrap PR, so readiness is apply-only.
20588
+ pullRequestNumber: external_exports.coerce.number().int().positive().optional()
20536
20589
  });
20537
20590
  SetupOnboardingPullRequestStatusResponseSchema = external_exports.object({
20538
20591
  pullRequest: external_exports.object({
20539
20592
  merged: external_exports.boolean(),
20540
20593
  state: external_exports.string().trim().min(1)
20541
- }),
20594
+ }).optional(),
20542
20595
  apply: external_exports.object({
20543
20596
  applied: external_exports.boolean()
20544
20597
  }),
@@ -30415,10 +30468,13 @@ function createApiClient(input) {
30415
30468
  },
30416
30469
  async getSetupOnboardingPullRequestStatus(request, options = {}) {
30417
30470
  const project = await activeProject();
30418
- const searchParams = [
30419
- ["repo", request.repo],
30420
- ["pullRequestNumber", String(request.pullRequestNumber)]
30421
- ];
30471
+ const searchParams = [["repo", request.repo]];
30472
+ if (request.pullRequestNumber !== void 0) {
30473
+ searchParams.push([
30474
+ "pullRequestNumber",
30475
+ String(request.pullRequestNumber)
30476
+ ]);
30477
+ }
30422
30478
  if (request.githubConnection) {
30423
30479
  searchParams.push(["githubConnection", request.githubConnection]);
30424
30480
  }
@@ -31549,7 +31605,7 @@ var init_package = __esm({
31549
31605
  "package.json"() {
31550
31606
  package_default = {
31551
31607
  name: "@autohq/cli",
31552
- version: "0.1.363",
31608
+ version: "0.1.365",
31553
31609
  license: "SEE LICENSE IN README.md",
31554
31610
  publishConfig: {
31555
31611
  access: "public"
@@ -33347,9 +33403,14 @@ var init_template_variables = __esm({
33347
33403
  });
33348
33404
 
33349
33405
  // ../../packages/schemas/src/project-apply-files/agent-authoring.ts
33350
- function readApplyDocument(path2, document, fileIndex) {
33406
+ function readApplyDocument(path2, document, fileIndex, contextVariables) {
33351
33407
  assertAgentAuthoringDocument(document, path2);
33352
- const result = compileAgentDocumentValue(document, path2, fileIndex);
33408
+ const result = compileAgentDocumentValue(
33409
+ document,
33410
+ path2,
33411
+ fileIndex,
33412
+ contextVariables
33413
+ );
33353
33414
  return result.resources.map((resource) => ({
33354
33415
  resource,
33355
33416
  generatedFromAgent: resource !== result.resource
@@ -33407,12 +33468,13 @@ function dedupeGeneratedResources(records) {
33407
33468
  }
33408
33469
  return deduped.map((record2) => record2.resource);
33409
33470
  }
33410
- function compileAgentDocumentValue(document, path2, fileIndex) {
33471
+ function compileAgentDocumentValue(document, path2, fileIndex, contextVariables) {
33411
33472
  return compileAgentDraftResources(
33412
33473
  compileAgentDocument2(document, path2, {
33413
33474
  fileIndex,
33414
33475
  stack: [],
33415
- variables: /* @__PURE__ */ new Map()
33476
+ variables: /* @__PURE__ */ new Map(),
33477
+ ...contextVariables && Object.keys(contextVariables).length > 0 ? { contextVariables: new Map(Object.entries(contextVariables)) } : {}
33416
33478
  }),
33417
33479
  path2
33418
33480
  );
@@ -33427,7 +33489,10 @@ function compileAgentDocument2(document, path2, context) {
33427
33489
  if (!isRecord2(document)) {
33428
33490
  throw new Error(`Invalid agent authoring file ${path2}: expected object`);
33429
33491
  }
33430
- const variables = context.stack.length === 0 ? readVariableScope(document, normalizedPath) : context.variables;
33492
+ const variables = context.stack.length === 0 ? new Map([
33493
+ ...context.contextVariables ?? /* @__PURE__ */ new Map(),
33494
+ ...readVariableScope(document, normalizedPath)
33495
+ ]) : context.variables;
33431
33496
  let merged = emptyAgentDraft();
33432
33497
  for (const importPath of importPaths2(document)) {
33433
33498
  const imported = resolveImportPath2(
@@ -33757,7 +33822,10 @@ function readProjectApplyDirectorySource(input) {
33757
33822
  ).sort((left, right) => left.path.localeCompare(right.path));
33758
33823
  const resourceRecords = [];
33759
33824
  for (const file2 of agentFiles) {
33760
- const request = readProjectApplyDocumentSourceFile(file2, { fileIndex });
33825
+ const request = readProjectApplyDocumentSourceFile(file2, {
33826
+ fileIndex,
33827
+ ...input.contextVariables ? { contextVariables: input.contextVariables } : {}
33828
+ });
33761
33829
  resourceRecords.push(
33762
33830
  ...request.resources.map((resource) => ({
33763
33831
  resource,
@@ -33808,7 +33876,7 @@ function readProjectApplyDocumentSourceFile(file2, options = {}) {
33808
33876
  }
33809
33877
  }
33810
33878
  const resourceRecords = documents.flatMap(
33811
- (document) => readApplyDocument(file2.path, document, fileIndex)
33879
+ (document) => readApplyDocument(file2.path, document, fileIndex, options.contextVariables)
33812
33880
  );
33813
33881
  return ProjectApplyRequestSchema.parse({
33814
33882
  delete: [],
@@ -49990,7 +50058,8 @@ async function setSecret(input) {
49990
50058
  {
49991
50059
  value,
49992
50060
  ...input.commandOptions.description === void 0 ? {} : { description: input.commandOptions.description },
49993
- ...resolveProtectedFlag(input.commandOptions)
50061
+ ...resolveProtectedFlag(input.commandOptions),
50062
+ ...resolveBindingFlags(input.commandOptions)
49994
50063
  },
49995
50064
  {
49996
50065
  projectId: await secretProjectId(input),
@@ -50054,6 +50123,30 @@ function resolveProtectedFlag(options) {
50054
50123
  }
50055
50124
  return {};
50056
50125
  }
50126
+ function resolveBindingFlags(options) {
50127
+ const hasBindingFlags = (options.bindHost?.length ?? 0) > 0 || options.bindHeader !== void 0 || options.bindFormat !== void 0;
50128
+ if (options.unbind) {
50129
+ if (hasBindingFlags) {
50130
+ throw new Error("Use either --unbind or the --bind-* flags, not both.");
50131
+ }
50132
+ return { binding: null };
50133
+ }
50134
+ if (!hasBindingFlags) {
50135
+ return {};
50136
+ }
50137
+ if (!options.bindHost?.length || options.bindHeader === void 0) {
50138
+ throw new Error(
50139
+ "Binding a secret requires at least one --bind-host and a --bind-header."
50140
+ );
50141
+ }
50142
+ return {
50143
+ binding: {
50144
+ hosts: options.bindHost,
50145
+ header: options.bindHeader,
50146
+ ...options.bindFormat === void 0 ? {} : { format: options.bindFormat }
50147
+ }
50148
+ };
50149
+ }
50057
50150
  async function removeSecret(input) {
50058
50151
  await confirmDestructiveAction(input.context, {
50059
50152
  message: `This will remove secret "${input.name}".`,
@@ -50208,7 +50301,18 @@ function registerSecretCommands(program, context) {
50208
50301
  secrets.command("set").description("Create or update a secret without printing its value.").argument("<name>", "secret name").option("--project <project>", "project id; defaults to organization scope").option("--stdin", "read the secret value from stdin").option("--value <value>", "secret value").option(
50209
50302
  "--from-env <name>",
50210
50303
  "read the secret value from an environment variable"
50211
- ).option("--description <text>", "human-readable description for the secret").option("--protected", "mark write-only: refuse plaintext reveal (default)").option(
50304
+ ).option("--description <text>", "human-readable description for the secret").option(
50305
+ "--bind-host <host>",
50306
+ "bind the secret to an exact destination host (repeatable); bound secrets are injected at the sandbox edge instead of entering the sandbox",
50307
+ (host, hosts) => [...hosts, host],
50308
+ []
50309
+ ).option(
50310
+ "--bind-header <header>",
50311
+ "HTTP header the bound secret is injected into (e.g. Authorization)"
50312
+ ).option(
50313
+ "--bind-format <format>",
50314
+ 'header value template around the secret, e.g. "Bearer {value}"'
50315
+ ).option("--unbind", "clear an existing destination binding").option("--protected", "mark write-only: refuse plaintext reveal (default)").option(
50212
50316
  "--unprotected",
50213
50317
  "allow scope-gated plaintext reveal of this secret"
50214
50318
  ).option("--raw", "allow empty values and preserve stdin exactly").option("--json", "print the updated secret metadata as JSON").option("--api-url <url>", "Auto API base URL").option("--api-base-url <url>", "Auto API base URL").action(async (name, commandOptions) => {
@@ -51575,7 +51679,7 @@ async function setupAction(rawContext, options) {
51575
51679
  "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."
51576
51680
  );
51577
51681
  context.writeOutput("");
51578
- context.writeOutput("Opening the onboarding PR...");
51682
+ context.writeOutput("Preparing the onboarding agent...");
51579
51683
  const response = await client.createSetupOnboardingPullRequest(
51580
51684
  {
51581
51685
  githubConnection: github.name,
@@ -51584,32 +51688,42 @@ async function setupAction(rawContext, options) {
51584
51688
  },
51585
51689
  { apiBaseUrl }
51586
51690
  );
51587
- context.writeOutput("");
51588
- context.writeOutput(`Opened PR #${response.pullRequest.number}.`);
51589
- if (response.pullRequest.url) {
51590
- await explainBrowserStep(context, {
51591
- browser: options.browser,
51592
- heading: "Review the onboarding PR",
51593
- body: [
51594
- "Auto will open the pull request it just created.",
51595
- "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."
51596
- ],
51597
- prompt: "Press Enter to open the PR."
51598
- });
51599
- if (options.browser !== false) {
51600
- (options.openBrowser ?? openBrowser)(response.pullRequest.url);
51691
+ if (response.mode === "sync") {
51692
+ context.writeOutput("");
51693
+ context.writeOutput(
51694
+ `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.`
51695
+ );
51696
+ context.writeOutput(
51697
+ "Auto will wait here and detect when the onboarding agent has been applied."
51698
+ );
51699
+ } else {
51700
+ context.writeOutput("");
51701
+ context.writeOutput(`Opened PR #${response.pullRequest.number}.`);
51702
+ if (response.pullRequest.url) {
51703
+ await explainBrowserStep(context, {
51704
+ browser: options.browser,
51705
+ heading: "Review the onboarding PR",
51706
+ body: [
51707
+ "Auto will open the pull request it just created.",
51708
+ "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."
51709
+ ],
51710
+ prompt: "Press Enter to open the PR."
51711
+ });
51712
+ if (options.browser !== false) {
51713
+ (options.openBrowser ?? openBrowser)(response.pullRequest.url);
51714
+ }
51715
+ context.writeOutput(response.pullRequest.url);
51601
51716
  }
51602
- context.writeOutput(response.pullRequest.url);
51717
+ context.writeOutput("");
51718
+ context.writeOutput(
51719
+ "Review and merge the PR. Auto will wait here and detect when the onboarding agent has been applied."
51720
+ );
51603
51721
  }
51604
- context.writeOutput("");
51605
- context.writeOutput(
51606
- "Review and merge the PR. Auto will wait here and detect when the onboarding agent has been applied."
51607
- );
51608
51722
  await waitForOnboardingReady(context, client, {
51609
51723
  apiBaseUrl,
51610
51724
  githubConnection: github.name,
51611
51725
  repo,
51612
- pullRequestNumber: response.pullRequest.number,
51726
+ ...response.mode === "pull_request" ? { pullRequestNumber: response.pullRequest.number } : {},
51613
51727
  pollIntervalMs: options.statusPollIntervalMs,
51614
51728
  sleep: options.sleep
51615
51729
  });
@@ -52053,13 +52167,13 @@ async function waitForOnboardingReady(context, client, input) {
52053
52167
  {
52054
52168
  githubConnection: input.githubConnection,
52055
52169
  repo: input.repo,
52056
- pullRequestNumber: input.pullRequestNumber
52170
+ ...input.pullRequestNumber !== void 0 ? { pullRequestNumber: input.pullRequestNumber } : {}
52057
52171
  },
52058
52172
  { apiBaseUrl: input.apiBaseUrl }
52059
52173
  ).catch((error51) => {
52060
52174
  consecutiveStatusErrors += 1;
52061
52175
  if (consecutiveStatusErrors === 1) {
52062
- context.writeOutput("Waiting for PR to be merged...");
52176
+ context.writeOutput("Waiting for onboarding to be ready...");
52063
52177
  }
52064
52178
  if (consecutiveStatusErrors >= SETUP_STATUS_MAX_CONSECUTIVE_ERRORS) {
52065
52179
  throw error51;
@@ -52071,17 +52185,18 @@ async function waitForOnboardingReady(context, client, input) {
52071
52185
  continue;
52072
52186
  }
52073
52187
  consecutiveStatusErrors = 0;
52074
- if (!status.pullRequest.merged && status.pullRequest.state === "closed") {
52188
+ const pullRequest = status.pullRequest;
52189
+ if (pullRequest && !pullRequest.merged && pullRequest.state === "closed") {
52075
52190
  throw new Error(
52076
52191
  "The onboarding PR was closed without being merged. Re-run `auto setup` to open it again."
52077
52192
  );
52078
52193
  }
52079
- if (!status.pullRequest.merged && status.pullRequest.state !== "open") {
52194
+ if (pullRequest && !pullRequest.merged && pullRequest.state !== "open") {
52080
52195
  throw new Error(
52081
- `The onboarding PR is in unexpected state "${status.pullRequest.state}". Check the PR, then rerun \`auto setup\` if needed.`
52196
+ `The onboarding PR is in unexpected state "${pullRequest.state}". Check the PR, then rerun \`auto setup\` if needed.`
52082
52197
  );
52083
52198
  }
52084
- if (status.pullRequest.merged && !reportedMerged) {
52199
+ if (pullRequest?.merged && !reportedMerged) {
52085
52200
  context.writeOutput("Detected PR merge.");
52086
52201
  reportedMerged = true;
52087
52202
  }
@@ -52094,7 +52209,7 @@ async function waitForOnboardingReady(context, client, input) {
52094
52209
  }
52095
52210
  if (pollCount % SETUP_STATUS_HINT_EVERY_POLLS === 0) {
52096
52211
  context.writeOutput(
52097
- status.pullRequest.merged ? "Still waiting for GitHub Sync to apply the onboarding agent..." : "Still waiting for the onboarding PR to be merged..."
52212
+ !pullRequest || pullRequest.merged ? "Still waiting for GitHub Sync to apply the onboarding agent..." : "Still waiting for the onboarding PR to be merged..."
52098
52213
  );
52099
52214
  }
52100
52215
  await sleep5(pollIntervalMs);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autohq/cli",
3
- "version": "0.1.363",
3
+ "version": "0.1.365",
4
4
  "license": "SEE LICENSE IN README.md",
5
5
  "publishConfig": {
6
6
  "access": "public"