@autohq/cli 0.1.131 → 0.1.133

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.
@@ -19683,7 +19683,6 @@ var SessionRunCommandIdSchema2 = OpaqueIdSchema2.brand();
19683
19683
  var RuntimeIdSchema2 = OpaqueIdSchema2.brand();
19684
19684
  var RuntimeBridgeLeaseIdSchema2 = OpaqueIdSchema2.brand();
19685
19685
  var EnvironmentSetupSnapshotIdSchema = OpaqueIdSchema2.brand();
19686
- var ToolIdSchema = OpaqueIdSchema2.brand();
19687
19686
  var UserIdSchema = OpaqueIdSchema2.brand();
19688
19687
 
19689
19688
  // ../../packages/schemas/src/auth.ts
@@ -21092,9 +21091,7 @@ var ToolSpecSchema = external_exports.discriminatedUnion("kind", [
21092
21091
  RemoteMcpToolSchema,
21093
21092
  LocalToolSchema
21094
21093
  ]);
21095
- var ToolResourceSchema = resourceEnvelopeSchema(ToolSpecSchema);
21096
- var ToolApplyRequestSchema = resourceApplySchema(ToolSpecSchema);
21097
- var ToolConnectRequestSchema = external_exports.object({
21094
+ var SessionToolConnectRequestSchema = external_exports.object({
21098
21095
  redirectUri: external_exports.string().trim().url().refine(
21099
21096
  (value2) => {
21100
21097
  const url3 = new URL(value2);
@@ -21104,21 +21101,23 @@ var ToolConnectRequestSchema = external_exports.object({
21104
21101
  return url3.protocol === "http:" && (url3.hostname === "localhost" || url3.hostname === "127.0.0.1");
21105
21102
  },
21106
21103
  {
21107
- message: "Tool OAuth redirect URIs must use https, except localhost loopback callbacks may use http"
21104
+ message: "Session tool OAuth redirect URIs must use https, except localhost loopback callbacks may use http"
21108
21105
  }
21109
21106
  ).optional()
21110
21107
  });
21111
- var ToolConnectResponseSchema = external_exports.discriminatedUnion("status", [
21108
+ var SessionToolConnectResponseSchema = external_exports.discriminatedUnion("status", [
21112
21109
  external_exports.object({
21113
21110
  status: external_exports.literal("authorization_required"),
21111
+ session: ResourceNameSchema,
21114
21112
  tool: ResourceNameSchema,
21115
21113
  connection: ResourceNameSchema,
21116
21114
  authorizationUrl: external_exports.string().trim().url(),
21117
21115
  message: external_exports.string().trim().min(1)
21118
21116
  })
21119
21117
  ]);
21120
- var ToolConnectCompleteResponseSchema = external_exports.object({
21118
+ var SessionToolConnectCompleteResponseSchema = external_exports.object({
21121
21119
  status: external_exports.literal("connected"),
21120
+ session: ResourceNameSchema.optional(),
21122
21121
  tool: ResourceNameSchema,
21123
21122
  connection: ResourceNameSchema,
21124
21123
  projectId: ProjectIdSchema
@@ -21975,22 +21974,14 @@ var ProjectApplyResponseSchema = external_exports.object({
21975
21974
  plan: external_exports.array(
21976
21975
  external_exports.object({
21977
21976
  action: external_exports.enum(["create", "update", "unchanged", "archive"]),
21978
- kind: external_exports.enum([
21979
- RESOURCE_KIND_ENVIRONMENT,
21980
- RESOURCE_KIND_IDENTITY,
21981
- RESOURCE_KIND_SESSION
21982
- ]),
21977
+ kind: external_exports.enum(PROJECT_RESOURCE_KINDS),
21983
21978
  name: external_exports.string().min(1),
21984
21979
  uid: external_exports.string().min(1).optional()
21985
21980
  })
21986
21981
  ).default([]),
21987
21982
  pruned: external_exports.array(
21988
21983
  external_exports.object({
21989
- kind: external_exports.enum([
21990
- RESOURCE_KIND_ENVIRONMENT,
21991
- RESOURCE_KIND_IDENTITY,
21992
- RESOURCE_KIND_SESSION
21993
- ]),
21984
+ kind: external_exports.enum(PROJECT_RESOURCE_KINDS),
21994
21985
  name: external_exports.string().min(1),
21995
21986
  uid: external_exports.string().min(1)
21996
21987
  })
@@ -22101,18 +22092,11 @@ var SessionRunRecordSchema = external_exports.object({
22101
22092
  sessionSnapshot: SessionResourceSchema,
22102
22093
  environmentSnapshot: EnvironmentResourceSchema,
22103
22094
  toolSnapshots: external_exports.array(
22104
- external_exports.discriminatedUnion("source", [
22105
- external_exports.object({
22106
- source: external_exports.literal("inline"),
22107
- alias: ToolAliasSchema,
22108
- spec: RemoteMcpToolSchema.or(LocalToolSchema).or(GithubToolSchema)
22109
- }),
22110
- external_exports.object({
22111
- source: external_exports.literal("resource"),
22112
- alias: ToolAliasSchema,
22113
- resource: ToolResourceSchema
22114
- })
22115
- ])
22095
+ external_exports.object({
22096
+ source: external_exports.literal("inline"),
22097
+ alias: ToolAliasSchema,
22098
+ spec: RemoteMcpToolSchema.or(LocalToolSchema).or(GithubToolSchema)
22099
+ })
22116
22100
  ),
22117
22101
  input: JsonValueSchema2,
22118
22102
  createdAt: external_exports.string().datetime(),
@@ -26264,7 +26248,7 @@ Object.assign(lookup, {
26264
26248
  // package.json
26265
26249
  var package_default = {
26266
26250
  name: "@autohq/cli",
26267
- version: "0.1.131",
26251
+ version: "0.1.133",
26268
26252
  license: "SEE LICENSE IN README.md",
26269
26253
  publishConfig: {
26270
26254
  access: "public"
package/dist/index.js CHANGED
@@ -16052,7 +16052,7 @@ var init_zod = __esm({
16052
16052
  });
16053
16053
 
16054
16054
  // ../../packages/schemas/src/ids.ts
16055
- var OpaqueIdSchema, ProfileIdSchema, EnvironmentIdSchema, IdentityIdSchema, ConnectionIdSchema, ExternalAccountIdSchema, OrganizationIdSchema, ProjectIdSchema, ProviderGrantIdSchema, ServiceAccountIdSchema, SessionIdSchema, SessionRunIdSchema, SessionRunCommandIdSchema, RuntimeIdSchema, RuntimeBridgeLeaseIdSchema, EnvironmentSetupSnapshotIdSchema, ToolIdSchema, UserIdSchema;
16055
+ var OpaqueIdSchema, ProfileIdSchema, EnvironmentIdSchema, IdentityIdSchema, ConnectionIdSchema, ExternalAccountIdSchema, OrganizationIdSchema, ProjectIdSchema, ProviderGrantIdSchema, ServiceAccountIdSchema, SessionIdSchema, SessionRunIdSchema, SessionRunCommandIdSchema, RuntimeIdSchema, RuntimeBridgeLeaseIdSchema, EnvironmentSetupSnapshotIdSchema, UserIdSchema;
16056
16056
  var init_ids = __esm({
16057
16057
  "../../packages/schemas/src/ids.ts"() {
16058
16058
  "use strict";
@@ -16073,7 +16073,6 @@ var init_ids = __esm({
16073
16073
  RuntimeIdSchema = OpaqueIdSchema.brand();
16074
16074
  RuntimeBridgeLeaseIdSchema = OpaqueIdSchema.brand();
16075
16075
  EnvironmentSetupSnapshotIdSchema = OpaqueIdSchema.brand();
16076
- ToolIdSchema = OpaqueIdSchema.brand();
16077
16076
  UserIdSchema = OpaqueIdSchema.brand();
16078
16077
  }
16079
16078
  });
@@ -17603,7 +17602,7 @@ function remoteMcpToolSchema(input) {
17603
17602
  ]).default({ kind: "none" })
17604
17603
  });
17605
17604
  }
17606
- var REMOTE_MCP_TRANSPORTS, LOCAL_TOOL_IMPLEMENTATIONS, SecretReferenceSchema, NoToolAuthSchema, McpOAuthToolAuthSchema, ConnectionToolAuthSchema, ConnectionsToolAuthSchema, ToolAliasSchema, RemoteMcpToolSchema, LocalAutoToolSchema, LocalPingToolSchema, LocalChatToolSchema, LocalToolSchema, GithubToolSchema, ToolSpecSchema, ToolResourceSchema, ToolApplyRequestSchema, ToolConnectRequestSchema, ToolConnectResponseSchema, ToolConnectCompleteResponseSchema, InlineSessionToolSchema, SessionToolRefSchema, SessionToolsSchema;
17605
+ var REMOTE_MCP_TRANSPORTS, LOCAL_TOOL_IMPLEMENTATIONS, SecretReferenceSchema, NoToolAuthSchema, McpOAuthToolAuthSchema, ConnectionToolAuthSchema, ConnectionsToolAuthSchema, ToolAliasSchema, RemoteMcpToolSchema, LocalAutoToolSchema, LocalPingToolSchema, LocalChatToolSchema, LocalToolSchema, GithubToolSchema, ToolSpecSchema, SessionToolConnectRequestSchema, SessionToolConnectResponseSchema, SessionToolConnectCompleteResponseSchema, InlineSessionToolSchema, SessionToolRefSchema, SessionToolsSchema;
17607
17606
  var init_tools = __esm({
17608
17607
  "../../packages/schemas/src/tools.ts"() {
17609
17608
  "use strict";
@@ -17675,9 +17674,7 @@ var init_tools = __esm({
17675
17674
  RemoteMcpToolSchema,
17676
17675
  LocalToolSchema
17677
17676
  ]);
17678
- ToolResourceSchema = resourceEnvelopeSchema(ToolSpecSchema);
17679
- ToolApplyRequestSchema = resourceApplySchema(ToolSpecSchema);
17680
- ToolConnectRequestSchema = external_exports.object({
17677
+ SessionToolConnectRequestSchema = external_exports.object({
17681
17678
  redirectUri: external_exports.string().trim().url().refine(
17682
17679
  (value) => {
17683
17680
  const url2 = new URL(value);
@@ -17687,21 +17684,23 @@ var init_tools = __esm({
17687
17684
  return url2.protocol === "http:" && (url2.hostname === "localhost" || url2.hostname === "127.0.0.1");
17688
17685
  },
17689
17686
  {
17690
- message: "Tool OAuth redirect URIs must use https, except localhost loopback callbacks may use http"
17687
+ message: "Session tool OAuth redirect URIs must use https, except localhost loopback callbacks may use http"
17691
17688
  }
17692
17689
  ).optional()
17693
17690
  });
17694
- ToolConnectResponseSchema = external_exports.discriminatedUnion("status", [
17691
+ SessionToolConnectResponseSchema = external_exports.discriminatedUnion("status", [
17695
17692
  external_exports.object({
17696
17693
  status: external_exports.literal("authorization_required"),
17694
+ session: ResourceNameSchema,
17697
17695
  tool: ResourceNameSchema,
17698
17696
  connection: ResourceNameSchema,
17699
17697
  authorizationUrl: external_exports.string().trim().url(),
17700
17698
  message: external_exports.string().trim().min(1)
17701
17699
  })
17702
17700
  ]);
17703
- ToolConnectCompleteResponseSchema = external_exports.object({
17701
+ SessionToolConnectCompleteResponseSchema = external_exports.object({
17704
17702
  status: external_exports.literal("connected"),
17703
+ session: ResourceNameSchema.optional(),
17705
17704
  tool: ResourceNameSchema,
17706
17705
  connection: ResourceNameSchema,
17707
17706
  projectId: ProjectIdSchema
@@ -18682,22 +18681,14 @@ var init_project_resources = __esm({
18682
18681
  plan: external_exports.array(
18683
18682
  external_exports.object({
18684
18683
  action: external_exports.enum(["create", "update", "unchanged", "archive"]),
18685
- kind: external_exports.enum([
18686
- RESOURCE_KIND_ENVIRONMENT,
18687
- RESOURCE_KIND_IDENTITY,
18688
- RESOURCE_KIND_SESSION
18689
- ]),
18684
+ kind: external_exports.enum(PROJECT_RESOURCE_KINDS),
18690
18685
  name: external_exports.string().min(1),
18691
18686
  uid: external_exports.string().min(1).optional()
18692
18687
  })
18693
18688
  ).default([]),
18694
18689
  pruned: external_exports.array(
18695
18690
  external_exports.object({
18696
- kind: external_exports.enum([
18697
- RESOURCE_KIND_ENVIRONMENT,
18698
- RESOURCE_KIND_IDENTITY,
18699
- RESOURCE_KIND_SESSION
18700
- ]),
18691
+ kind: external_exports.enum(PROJECT_RESOURCE_KINDS),
18701
18692
  name: external_exports.string().min(1),
18702
18693
  uid: external_exports.string().min(1)
18703
18694
  })
@@ -18846,18 +18837,11 @@ var init_session_runs = __esm({
18846
18837
  sessionSnapshot: SessionResourceSchema,
18847
18838
  environmentSnapshot: EnvironmentResourceSchema,
18848
18839
  toolSnapshots: external_exports.array(
18849
- external_exports.discriminatedUnion("source", [
18850
- external_exports.object({
18851
- source: external_exports.literal("inline"),
18852
- alias: ToolAliasSchema,
18853
- spec: RemoteMcpToolSchema.or(LocalToolSchema).or(GithubToolSchema)
18854
- }),
18855
- external_exports.object({
18856
- source: external_exports.literal("resource"),
18857
- alias: ToolAliasSchema,
18858
- resource: ToolResourceSchema
18859
- })
18860
- ])
18840
+ external_exports.object({
18841
+ source: external_exports.literal("inline"),
18842
+ alias: ToolAliasSchema,
18843
+ spec: RemoteMcpToolSchema.or(LocalToolSchema).or(GithubToolSchema)
18844
+ })
18861
18845
  ),
18862
18846
  input: JsonValueSchema,
18863
18847
  createdAt: external_exports.string().datetime(),
@@ -19634,10 +19618,6 @@ function createResourceApi(context) {
19634
19618
  path: "/sessions",
19635
19619
  applyResponseSchema: SessionApplyResponseSchema
19636
19620
  });
19637
- const tools = projectResource(context, {
19638
- path: "/tools",
19639
- applyResponseSchema: ToolResourceSchema
19640
- });
19641
19621
  const identities = projectResource(
19642
19622
  context,
19643
19623
  {
@@ -19655,19 +19635,17 @@ function createResourceApi(context) {
19655
19635
  options ?? {}
19656
19636
  ),
19657
19637
  applySessionResource: sessions.apply,
19658
- applyToolResource: tools.apply,
19659
19638
  createProjectServiceAccount: (request, options) => createProjectServiceAccount(context, request, options ?? {}),
19660
19639
  deleteProjectResource: (request, options) => deleteProjectResource(context, request, options ?? {}),
19661
19640
  listEnvironments: environments.list,
19662
19641
  listIdentities: identities.list,
19663
19642
  listProjectServiceAccounts: (options) => listProjectServiceAccounts(context, options ?? {}),
19664
19643
  listSessions: sessions.list,
19665
- listTools: tools.list,
19666
19644
  getSessionPresence: (request, options) => getSessionPresence(context, request, options ?? {}),
19667
19645
  connectSessionPresence: (request, options) => connectSessionPresence(context, request, options ?? {}),
19668
19646
  recordSessionPresenceIcon: (request, options) => recordSessionPresenceIcon(context, request, options ?? {}),
19669
- startToolConnection: (request, options) => startToolConnection(context, request, options ?? {}),
19670
- completeToolConnection: (request, options) => completeToolConnection(context, request, options ?? {}),
19647
+ startSessionToolConnection: (request, options) => startSessionToolConnection(context, request, options ?? {}),
19648
+ completeSessionToolConnection: (request, options) => completeSessionToolConnection(context, request, options ?? {}),
19671
19649
  removeProjectServiceAccount: (request, options) => removeProjectServiceAccount(context, request, options ?? {}),
19672
19650
  rotateProjectServiceAccountToken: (request, options) => rotateProjectServiceAccountToken(context, request, options ?? {}),
19673
19651
  updateProjectServiceAccount: (request, options) => updateProjectServiceAccount(context, request, options ?? {})
@@ -19813,13 +19791,13 @@ async function recordSessionPresenceIcon(context, request, options) {
19813
19791
  }
19814
19792
  return SessionPresenceIconResponseSchema.parse(await response.json());
19815
19793
  }
19816
- async function startToolConnection(context, request, options) {
19794
+ async function startSessionToolConnection(context, request, options) {
19817
19795
  const project = await context.activeProject();
19818
19796
  const response = await context.authenticatedFetch(
19819
19797
  context.apiUrl(
19820
19798
  projectApiPath(
19821
19799
  project,
19822
- `/tools/${encodeURIComponent(request.name)}/connections`
19800
+ `/sessions/${encodeURIComponent(request.sessionName)}/tools/${encodeURIComponent(request.toolAlias)}/connections`
19823
19801
  ),
19824
19802
  options.apiBaseUrl
19825
19803
  ),
@@ -19837,9 +19815,9 @@ async function startToolConnection(context, request, options) {
19837
19815
  if (!response.ok) {
19838
19816
  throw new Error(await responseErrorMessage(response));
19839
19817
  }
19840
- return ToolConnectResponseSchema.parse(await response.json());
19818
+ return SessionToolConnectResponseSchema.parse(await response.json());
19841
19819
  }
19842
- async function completeToolConnection(context, request, options) {
19820
+ async function completeSessionToolConnection(context, request, options) {
19843
19821
  const url2 = new URL(
19844
19822
  context.apiUrl(apiPath("/mcp/oauth/callback"), options.apiBaseUrl)
19845
19823
  );
@@ -19853,7 +19831,7 @@ async function completeToolConnection(context, request, options) {
19853
19831
  if (!response.ok) {
19854
19832
  throw new Error(await responseErrorMessage(response));
19855
19833
  }
19856
- return ToolConnectCompleteResponseSchema.parse(await response.json());
19834
+ return SessionToolConnectCompleteResponseSchema.parse(await response.json());
19857
19835
  }
19858
19836
  async function createProjectServiceAccount(context, request, options) {
19859
19837
  const project = await context.activeProject();
@@ -21205,7 +21183,7 @@ var init_package = __esm({
21205
21183
  "package.json"() {
21206
21184
  package_default = {
21207
21185
  name: "@autohq/cli",
21208
- version: "0.1.131",
21186
+ version: "0.1.133",
21209
21187
  license: "SEE LICENSE IN README.md",
21210
21188
  publishConfig: {
21211
21189
  access: "public"
@@ -21268,133 +21246,6 @@ var init_version = __esm({
21268
21246
  }
21269
21247
  });
21270
21248
 
21271
- // src/commands/tools/connect.ts
21272
- async function connectTool(input) {
21273
- if (input.manual) {
21274
- const result = await input.client.startToolConnection(
21275
- {
21276
- name: input.tool
21277
- },
21278
- {
21279
- apiBaseUrl: input.apiBaseUrl
21280
- }
21281
- );
21282
- writeConnectionStart(input.writeOutput, result);
21283
- return;
21284
- }
21285
- let connection;
21286
- const activeSelection = input.client.getActiveSelection();
21287
- let scopeContext = toolConnectionScopeContext({
21288
- activeSelection
21289
- });
21290
- const scopeContextPromise = resolveToolConnectionScopeContext({
21291
- activeSelection,
21292
- apiBaseUrl: input.apiBaseUrl,
21293
- client: input.client
21294
- });
21295
- const callback = await createOAuthLoopbackCallback({
21296
- successHtml: () => renderOAuthLoopbackPage({
21297
- status: "success",
21298
- eyebrow: "Auto Tool",
21299
- title: `${connection?.tool ?? input.tool} is authorized`,
21300
- message: "Auto received the provider authorization. The CLI will finish the token exchange in your terminal.",
21301
- details: [
21302
- { label: "Tool", value: connection?.tool ?? input.tool },
21303
- { label: "Connection", value: connection?.connection },
21304
- { label: "Organization", value: scopeContext.organization },
21305
- { label: "Project", value: scopeContext.project }
21306
- ]
21307
- }),
21308
- failureHtml: () => renderOAuthLoopbackPage({
21309
- status: "failure",
21310
- eyebrow: "Auto Tool",
21311
- title: `${connection?.tool ?? input.tool} was not authorized`,
21312
- message: "The provider rejected the authorization request. Return to your terminal to see the error details.",
21313
- details: [
21314
- { label: "Tool", value: connection?.tool ?? input.tool },
21315
- { label: "Connection", value: connection?.connection },
21316
- { label: "Organization", value: scopeContext.organization },
21317
- { label: "Project", value: scopeContext.project }
21318
- ]
21319
- })
21320
- });
21321
- try {
21322
- const result = await input.client.startToolConnection(
21323
- {
21324
- name: input.tool,
21325
- redirectUri: callback.redirectUri
21326
- },
21327
- {
21328
- apiBaseUrl: input.apiBaseUrl
21329
- }
21330
- );
21331
- scopeContext = await scopeContextPromise;
21332
- connection = result;
21333
- writeConnectionStart(input.writeOutput, result);
21334
- input.writeOutput("Waiting for browser authorization...");
21335
- openBrowser(result.authorizationUrl);
21336
- const authorized = await callback.result;
21337
- if (!authorized.state) {
21338
- throw new Error("OAuth callback is missing state");
21339
- }
21340
- const completed = await input.client.completeToolConnection(
21341
- {
21342
- code: authorized.code,
21343
- state: authorized.state
21344
- },
21345
- {
21346
- apiBaseUrl: input.apiBaseUrl
21347
- }
21348
- );
21349
- input.writeOutput(
21350
- `connected tool/${completed.tool} connection/${completed.connection}`
21351
- );
21352
- } finally {
21353
- callback.close();
21354
- }
21355
- }
21356
- async function resolveToolConnectionScopeContext(input) {
21357
- if (!input.activeSelection.organizationId || !input.activeSelection.projectId) {
21358
- return toolConnectionScopeContext({
21359
- activeSelection: input.activeSelection
21360
- });
21361
- }
21362
- try {
21363
- const response = await input.client.listProjects({
21364
- apiBaseUrl: input.apiBaseUrl
21365
- });
21366
- const activeProject = response.projects.find(
21367
- (project) => project.organizationId === input.activeSelection.organizationId && project.projectId === input.activeSelection.projectId
21368
- );
21369
- return toolConnectionScopeContext({
21370
- activeProject,
21371
- activeSelection: input.activeSelection
21372
- });
21373
- } catch {
21374
- return toolConnectionScopeContext({
21375
- activeSelection: input.activeSelection
21376
- });
21377
- }
21378
- }
21379
- function toolConnectionScopeContext(input) {
21380
- return {
21381
- organization: input.activeProject ? `${input.activeProject.organizationName} (${input.activeProject.organizationSlug})` : input.activeSelection.organizationId,
21382
- project: input.activeProject ? `${input.activeProject.projectName} (${input.activeProject.projectSlug})` : input.activeSelection.projectId
21383
- };
21384
- }
21385
- function writeConnectionStart(writeOutput, result) {
21386
- writeOutput(result.message);
21387
- writeOutput(`connect tool/${result.tool} connection/${result.connection}`);
21388
- writeOutput(`authorization_url ${result.authorizationUrl}`);
21389
- }
21390
- var init_connect = __esm({
21391
- "src/commands/tools/connect.ts"() {
21392
- "use strict";
21393
- init_browser();
21394
- init_loopback();
21395
- }
21396
- });
21397
-
21398
21249
  // src/commands/apply/assets.ts
21399
21250
  async function resolveApplyAssets(input) {
21400
21251
  const entries = Object.entries(input.request.assets);
@@ -21559,15 +21410,21 @@ function appliedResourceKind(request, response, index) {
21559
21410
  }
21560
21411
  return kind;
21561
21412
  }
21562
- function mcpOAuthToolConnectionsFromApplyRequest(request) {
21413
+ function mcpOAuthSessionToolConnectionsFromApplyRequest(request) {
21563
21414
  return request.resources.filter((resource) => resource.kind === RESOURCE_KIND_SESSION).flatMap((resource) => {
21564
- return mcpOAuthToolConnectionsFromSessionTools(resource.spec.tools);
21415
+ return mcpOAuthSessionToolConnectionsFromSessionTools({
21416
+ session: resource.metadata.name,
21417
+ tools: resource.spec.tools
21418
+ });
21565
21419
  });
21566
21420
  }
21567
- function mcpOAuthToolConnectionsFromAppliedResources(resources) {
21421
+ function mcpOAuthSessionToolConnectionsFromAppliedResources(resources) {
21568
21422
  return resources.filter((item) => item.kind === RESOURCE_KIND_SESSION).flatMap((item) => {
21569
21423
  const resource = item.resource;
21570
- return mcpOAuthToolConnectionsFromSessionTools(resource.spec.tools);
21424
+ return mcpOAuthSessionToolConnectionsFromSessionTools({
21425
+ session: resource.metadata.name,
21426
+ tools: resource.spec.tools
21427
+ });
21571
21428
  });
21572
21429
  }
21573
21430
  function applyFiles(root) {
@@ -21590,12 +21447,18 @@ function applyFiles(root) {
21590
21447
  }
21591
21448
  return files;
21592
21449
  }
21593
- function mcpOAuthToolConnectionsFromSessionTools(tools) {
21594
- return Object.entries(tools).flatMap(([alias, tool]) => {
21450
+ function mcpOAuthSessionToolConnectionsFromSessionTools(input) {
21451
+ return Object.entries(input.tools).flatMap(([alias, tool]) => {
21595
21452
  if (tool.kind !== "mcp_remote" || tool.disabled || tool.auth.kind !== "mcp_oauth") {
21596
21453
  return [];
21597
21454
  }
21598
- return [{ tool: alias, connection: tool.auth.connection }];
21455
+ return [
21456
+ {
21457
+ session: input.session,
21458
+ tool: alias,
21459
+ connection: tool.auth.connection
21460
+ }
21461
+ ];
21599
21462
  });
21600
21463
  }
21601
21464
  function readApplyDocumentFile(path2) {
@@ -21808,6 +21671,139 @@ var init_files = __esm({
21808
21671
  }
21809
21672
  });
21810
21673
 
21674
+ // src/commands/apply/session-tool-connect.ts
21675
+ async function connectSessionTool(input) {
21676
+ if (input.manual) {
21677
+ const result = await input.client.startSessionToolConnection(
21678
+ {
21679
+ sessionName: input.session,
21680
+ toolAlias: input.tool
21681
+ },
21682
+ {
21683
+ apiBaseUrl: input.apiBaseUrl
21684
+ }
21685
+ );
21686
+ writeConnectionStart(input.writeOutput, result);
21687
+ return;
21688
+ }
21689
+ let connection;
21690
+ const activeSelection = input.client.getActiveSelection();
21691
+ let scopeContext = sessionToolConnectionScopeContext({
21692
+ activeSelection
21693
+ });
21694
+ const scopeContextPromise = resolveSessionToolConnectionScopeContext({
21695
+ activeSelection,
21696
+ apiBaseUrl: input.apiBaseUrl,
21697
+ client: input.client
21698
+ });
21699
+ const callback = await createOAuthLoopbackCallback({
21700
+ successHtml: () => renderOAuthLoopbackPage({
21701
+ status: "success",
21702
+ eyebrow: "Auto Tool",
21703
+ title: `${connection?.tool ?? input.tool} is authorized`,
21704
+ message: "Auto received the provider authorization. The CLI will finish the token exchange in your terminal.",
21705
+ details: [
21706
+ { label: "Session", value: connection?.session ?? input.session },
21707
+ { label: "Tool", value: connection?.tool ?? input.tool },
21708
+ { label: "Connection", value: connection?.connection },
21709
+ { label: "Organization", value: scopeContext.organization },
21710
+ { label: "Project", value: scopeContext.project }
21711
+ ]
21712
+ }),
21713
+ failureHtml: () => renderOAuthLoopbackPage({
21714
+ status: "failure",
21715
+ eyebrow: "Auto Tool",
21716
+ title: `${connection?.tool ?? input.tool} was not authorized`,
21717
+ message: "The provider rejected the authorization request. Return to your terminal to see the error details.",
21718
+ details: [
21719
+ { label: "Session", value: connection?.session ?? input.session },
21720
+ { label: "Tool", value: connection?.tool ?? input.tool },
21721
+ { label: "Connection", value: connection?.connection },
21722
+ { label: "Organization", value: scopeContext.organization },
21723
+ { label: "Project", value: scopeContext.project }
21724
+ ]
21725
+ })
21726
+ });
21727
+ try {
21728
+ const result = await input.client.startSessionToolConnection(
21729
+ {
21730
+ sessionName: input.session,
21731
+ toolAlias: input.tool,
21732
+ redirectUri: callback.redirectUri
21733
+ },
21734
+ {
21735
+ apiBaseUrl: input.apiBaseUrl
21736
+ }
21737
+ );
21738
+ scopeContext = await scopeContextPromise;
21739
+ connection = result;
21740
+ writeConnectionStart(input.writeOutput, result);
21741
+ input.writeOutput("Waiting for browser authorization...");
21742
+ openBrowser(result.authorizationUrl);
21743
+ const authorized = await callback.result;
21744
+ if (!authorized.state) {
21745
+ throw new Error("OAuth callback is missing state");
21746
+ }
21747
+ const completed = await input.client.completeSessionToolConnection(
21748
+ {
21749
+ code: authorized.code,
21750
+ state: authorized.state
21751
+ },
21752
+ {
21753
+ apiBaseUrl: input.apiBaseUrl
21754
+ }
21755
+ );
21756
+ input.writeOutput(
21757
+ `connected session/${completed.session ?? input.session} tool/${completed.tool} connection/${completed.connection}`
21758
+ );
21759
+ } finally {
21760
+ callback.close();
21761
+ }
21762
+ }
21763
+ async function resolveSessionToolConnectionScopeContext(input) {
21764
+ if (!input.activeSelection.organizationId || !input.activeSelection.projectId) {
21765
+ return sessionToolConnectionScopeContext({
21766
+ activeSelection: input.activeSelection
21767
+ });
21768
+ }
21769
+ try {
21770
+ const response = await input.client.listProjects({
21771
+ apiBaseUrl: input.apiBaseUrl
21772
+ });
21773
+ const activeProject = response.projects.find(
21774
+ (project) => project.organizationId === input.activeSelection.organizationId && project.projectId === input.activeSelection.projectId
21775
+ );
21776
+ return sessionToolConnectionScopeContext({
21777
+ activeProject,
21778
+ activeSelection: input.activeSelection
21779
+ });
21780
+ } catch {
21781
+ return sessionToolConnectionScopeContext({
21782
+ activeSelection: input.activeSelection
21783
+ });
21784
+ }
21785
+ }
21786
+ function sessionToolConnectionScopeContext(input) {
21787
+ return {
21788
+ organization: input.activeProject ? `${input.activeProject.organizationName} (${input.activeProject.organizationSlug})` : input.activeSelection.organizationId,
21789
+ project: input.activeProject ? `${input.activeProject.projectName} (${input.activeProject.projectSlug})` : input.activeSelection.projectId
21790
+ };
21791
+ }
21792
+ function writeConnectionStart(writeOutput, result) {
21793
+ writeOutput(result.message);
21794
+ writeOutput(
21795
+ `connect session/${result.session} tool/${result.tool} connection/${result.connection}`
21796
+ );
21797
+ writeOutput(`authorization_url ${result.authorizationUrl}`);
21798
+ }
21799
+ var init_session_tool_connect = __esm({
21800
+ "src/commands/apply/session-tool-connect.ts"() {
21801
+ "use strict";
21802
+ init_browser();
21803
+ init_loopback();
21804
+ }
21805
+ });
21806
+
21811
21807
  // src/commands/apply/actions.ts
21812
21808
  async function applyResource(input) {
21813
21809
  if (input.commandOptions.connect && input.commandOptions.json) {
@@ -21870,12 +21866,12 @@ async function applyProjectInput(input) {
21870
21866
  );
21871
21867
  }
21872
21868
  if (input.commandOptions.connect) {
21873
- for (const item of mcpOAuthToolConnectionsFromApplyRequest(
21869
+ for (const item of mcpOAuthSessionToolConnectionsFromApplyRequest(
21874
21870
  input.request
21875
21871
  )) {
21876
21872
  input.writeOutput(
21877
21873
  style.dim(
21878
- `would connect tool/${item.tool} connection/${item.connection}`
21874
+ `would connect session/${item.session} tool/${item.tool} connection/${item.connection}`
21879
21875
  )
21880
21876
  );
21881
21877
  }
@@ -21911,12 +21907,13 @@ async function applyProjectInput(input) {
21911
21907
  }
21912
21908
  writeDiagnostics(response.diagnostics, input.writeOutput, style);
21913
21909
  if (input.commandOptions.connect) {
21914
- const connections = mcpOAuthToolConnectionsFromAppliedResources(resources);
21910
+ const connections = mcpOAuthSessionToolConnectionsFromAppliedResources(resources);
21915
21911
  for (const item of connections) {
21916
- await connectTool({
21912
+ await connectSessionTool({
21917
21913
  apiBaseUrl: input.commandOptions.apiBaseUrl,
21918
21914
  client: input.client,
21919
21915
  manual: input.commandOptions.manualConnect,
21916
+ session: item.session,
21920
21917
  tool: item.tool,
21921
21918
  writeOutput: input.writeOutput
21922
21919
  });
@@ -21949,9 +21946,9 @@ var init_actions = __esm({
21949
21946
  "src/commands/apply/actions.ts"() {
21950
21947
  "use strict";
21951
21948
  init_style();
21952
- init_connect();
21953
21949
  init_assets();
21954
21950
  init_files();
21951
+ init_session_tool_connect();
21955
21952
  }
21956
21953
  });
21957
21954
 
@@ -24702,7 +24699,6 @@ function useSwitchProject() {
24702
24699
  for (const queryKey of [
24703
24700
  ["sessions"],
24704
24701
  ["environments"],
24705
- ["tools"],
24706
24702
  ["service-accounts"],
24707
24703
  ["connections"],
24708
24704
  ["connection-providers"]
@@ -24999,7 +24995,6 @@ var init_queries = __esm({
24999
24995
  environments: (apiUrl) => ["environments", apiUrl],
25000
24996
  identities: (apiUrl) => ["identities", apiUrl],
25001
24997
  sessions: (apiUrl) => ["sessions", apiUrl],
25002
- tools: (apiUrl) => ["tools", apiUrl],
25003
24998
  projects: (apiUrl) => ["projects", apiUrl],
25004
24999
  serviceAccounts: (apiUrl) => ["service-accounts", apiUrl],
25005
25000
  connections: (apiUrl) => ["connections", apiUrl],
@@ -29620,7 +29615,10 @@ function registerApplyCommands(program, context) {
29620
29615
  program.command("apply").description("Apply Auto resources from a file or the .auto directory.").option("-f, --file <file>", "single resource file to apply instead").option(
29621
29616
  "--directory <directory>",
29622
29617
  "directory containing Auto resource files"
29623
- ).option("--dry-run", "print the apply plan without changing resources").option("--no-prune", "leave omitted .auto resources unchanged").option("--connect", "connect MCP OAuth tools after applying resources").option(
29618
+ ).option("--dry-run", "print the apply plan without changing resources").option("--no-prune", "leave omitted .auto resources unchanged").option(
29619
+ "--connect",
29620
+ "connect MCP OAuth session tools after applying resources"
29621
+ ).option(
29624
29622
  "--manual-connect",
29625
29623
  "print MCP OAuth authorization URLs instead of opening a browser"
29626
29624
  ).option("--json", "print the apply response as JSON").option("--api-url <url>", "Auto API base URL").option("--api-base-url <url>", "Auto API base URL").action(async (commandOptions) => {
@@ -30897,7 +30895,7 @@ Docs and help: auto --help
30897
30895
  `;
30898
30896
 
30899
30897
  // src/commands/onboard/skill-content.generated.ts
30900
- var onboardingSkillMarkdown = "# Intent\n\nYou are onboarding a user onto auto. Achieve three goals, in roughly this order, as rapidly as the user's pace allows:\n\n1. **Educate** \u2014 teach the user what auto is and how it works, and get them genuinely excited about it.\n2. **Magic moment** \u2014 get a tailor-made, deployed, proactive workflow live that solves a *real* problem for them, and have them witness it working end to end.\n3. **Self-sufficiency** \u2014 leave them with the building blocks (mental model, CI/CD, a self-improvement loop) to iterate on their auto system rapidly and safely on their own.\n\n# Background\n\n**What is auto?**\n\nauto lets you program software factories the same way you program CI/CD.\n\nCompose agents and triggers into workflows using simple YAML files, and deploy them into the cloud on merge.\n\nYou can use auto to build simple (but effective) automations:\n\n- Ticket / feedback triage and resolution\n- Automated incident / bug response\n- Custom tailored code review agents\n\nYou can also use auto to push the frontier of agentic labor:\n\n- Organized fleets of agents on long-horizon tasks\n- Multi-agent autoresearch / optimization loops\n- Agentic BDR and outbound lead engines\n- \u221E more ideas we've yet to dream up\n\nAnything that can be described in a standard operating procedure can be translated into a \"chart\" of agents and triggers in auto \u2014 the only limit is your imagination.\n\n# Reference material\n\nThis skill ships with documentation and worked examples. Read them before you onboard anyone; cite and copy from them as you go.\n\n| Path | What it covers |\n| --- | --- |\n| `docs/index.md` | The mental model: resources, events, triggers, runs. Start here. |\n| `docs/resource-model.md` | The `.auto/` directory, resource envelopes, and `auto apply` semantics. |\n| `docs/sessions-and-triggers.md` | Sessions, the trigger/event/routing vocabulary, filters, and PR checks. |\n| `docs/environments-and-profiles.md` | Sandbox images, setup steps and caching, and reusable agent profiles. |\n| `docs/tools-and-connections.md` | MCP tools, chat tools, provider connections, secrets, and the runtime tool surface agents see. |\n| `docs/cli.md` | The `auto` CLI command reference. |\n| `docs/ci-cd.md` | Service accounts and GitHub Actions for apply-on-merge. |\n| `examples/index.md` | Prose outline of every example \u2014 read this to know what's on the shelf. |\n| `examples/` | Complete, copyable `.auto/` directories \u2014 one per workflow archetype, each with a README explaining the moving parts. |\n\nIf these relative paths are not available (for example this playbook was printed by `auto onboard --agent` rather than installed as a skill directory), fetch the same content from the skills mirror: `npx skills add auto-dot-sh/skills`, or browse https://github.com/auto-dot-sh/skills.\n\n# Operating principles\n\nHold these throughout the onboarding:\n\n- **Trust live command output over this document.** The CLI evolves; run `auto --help` early and whenever in doubt, and when a command's real output disagrees with anything written here, trust the command output over this document and adapt.\n- **Converse, don't lecture.** Short messages, one question at a time, and adapt your vocabulary to the user's technical level. The pitch should take seconds, not paragraphs.\n- **Ask before changing anything outside `.auto/`.** The onboarding's write surface is the `.auto/` directory (plus the CI workflow in Beat 7, which ships as a PR). Any other file in the user's repo gets touched only with their explicit go-ahead.\n- **Warn before browsers open, and surface the link either way.** `auto auth login`, `auto connect`, `auto tools connect`, and `auto sessions connect` open a browser window *and* print the authorization URL. Give a one-sentence heads-up first (\"this will open your browser to install the GitHub App\") so it doesn't feel like something hijacked their machine. If the browser doesn't pop (some environments can't open one), don't leave the user hunting through command output \u2014 repeat the printed authorization URL back to them on its own line as a clickable fallback, one provider at a time, and tell them plainly to click it.\n- **Signal before going quiet.** Deep repo exploration and waiting on async runs both involve silence. Say what you're about to do and roughly how long it will take.\n- **Enlist the user as the second pair of hands.** They trigger the inputs you can't (tagging a bot in Slack, commenting on a PR) and verify the outputs you can't see (a Slack message arriving). Make those asks explicit and specific.\n- **Hand off, don't hint.** When the user needs to do something, spell it out the *first* time \u2014 before they have to ask. Name the exact trigger (which label, which channel, which command), where to click, and what they'll see when it works. \"Label the issue whenever you're ready\" assumes they can see what's in your head and the YAML you wrote; a numbered \"in Linear: create an issue \u2192 add the `auto-triage` label \u2192 that label is the trigger\" does not. If you catch yourself about to post a one-line \"go ahead and \u2026\", expand it.\n- **Set expectations once, then stay quiet.** When you start watching an async run, tell the user up front roughly how long it takes and what \"normal\" looks like (\"the coder run provisions a sandbox first \u2014 expect a quiet couple of minutes\"), then hold until something *they'd care about* changes. Don't narrate every monitor tick or re-report the same event from a second watcher \u2014 a stream of \"still queued / still running / no news\" reads as noise, not reassurance.\n- **Expect trouble; own the troubleshooting.** OAuth flows fail, secrets get mistyped, webhooks misfire. When something breaks, diagnose it with the CLI (`auto runs list`, `auto runs show`, `auto runs conversation`, `auto apply --dry-run`) rather than asking the user to debug.\n- **Asynchronous means asynchronous.** Triggered runs take time to spawn and act. Tell the user when a wait is expected, and tail run state rather than declaring failure early.\n- **Never fabricate success.** Verify each step actually worked (the apply plan, the trigger receipt, the run conversation) before telling the user it did.\n- **Celebrate real wins.** When a workflow completes end to end for the first time, mark the moment \u2014 emoji, a pun, a little flourish. This should feel fun.\n\n# Procedure\n\nWork through the following beats in order. They are a roadmap, not a script \u2014 skip or reorder when the user's situation clearly calls for it (for example, a user who already has an account and connections can jump straight to Beat 3).\n\n## Beat 0: Learn auto\n\nBefore talking to the user, make sure you have a working command of the system: read `docs/index.md` for the mental model, skim the rest of `docs/`, and look through `examples/` to internalize what complete workflows look like. You will be drawing on the examples heavily in Beats 3-5.\n\n## Beat 1: Establish rapport\n\n**Your very first message after launching is a plain-language pitch, not a form.** Two or three sentences on what auto is and where it's valuable, then *one* opening question. Do **not** open with `AskUserQuestion` or a multiple-choice menu \u2014 that skips the *Educate* goal and makes the onboarding feel like a config wizard. Lead with words; reach for `AskUserQuestion` only once you're past the pitch and genuinely offering discrete choices (e.g. the hero workflow in Beat 3).\n\nAfter the pitch, shift into lightly interviewing the user. You want to learn:\n\n1. **Who they are and their professional context.**\n - Hobbyist, or evaluating auto for a real business?\n - How technical are they? Engineer, or a more managerial / operational role?\n2. **Where the work that matters most to them happens.**\n - Do they have a GitHub account / organization? Is there a repo that would make a good home for their auto system \u2014 better yet, are you running inside it right now?\n - Do they work out of Slack day-to-day, and could they install auto there?\n - What else is in their operating loop? Linear, Datadog, Sentry, PostHog, Notion, Telegram, internal webhooks, and so on.\n\nKeep this light \u2014 a few questions, not a survey. You're gathering enough signal to propose workflows that will land.\n\n## Beat 2: Get up to speed\n\nIf you are running inside a repo the user has indicated is their focus, tell them you're going to explore it for a few minutes (and that you'll go quiet while a research agent reads the repo) \u2014 then **dispatch a subagent to do the deep read in parallel** rather than reading file-by-file in the main thread. This keeps the conversation responsive and your own context clean, and it forces real exploration instead of leaning on whatever `CLAUDE.md` / `AGENTS.md` happened to load.\n\nSpawn one general-purpose / Explore subagent (or a small fan-out of them for a large monorepo) and have it read **both**:\n\n- **The repo:** what the project does, how the team works (CI, review culture, issue-tracker and chat integrations), the conventions written down in `CLAUDE.md`/`AGENTS.md`/`docs/`, and \u2014 most importantly \u2014 where the recurring, automatable toil is.\n- **This skill's `docs/` and `examples/`**, so the ideas it returns are already expressed in auto's vocabulary (sessions, triggers, profiles) and mapped to a concrete archetype.\n\nHave the subagent return a structured shortlist: for each candidate workflow, a one-line description, the matching archetype, the trigger/event that would fire it, and the *specific evidence in this repo* that the toil is real (a file, a workflow, a documented rule, a past incident). That shortlist is the raw material for Beat 3.\n\nWhen the agent returns, don't just move on \u2014 **surface 1-2 concrete observations to the user** (\"you renumber migrations by hand and a missed renumber caused a prod outage; your `postman/collection.json` updates are marked NOT OPTIONAL\") so they see the exploration paid off and trust that your pitches are grounded in *their* code. If `CLAUDE.md` already told you something, say so and confirm it against the repo rather than presenting it as discovery.\n\n## Beat 3: Present some options\n\nCombine what you know about the user, their goals, and their codebase, and brainstorm at least three workflows they could deploy *today*. Anchor on the archetypes in `examples/index.md` \u2014 code review, issue triage, incident response, chat assistant, scheduled digest, an orchestrated agent fleet, a research/optimization loop, an outbound lead engine \u2014 but tailor each pitch to their actual stack and pain points (\"a review agent that enforces *your* `docs/style.md`\", not \"a code review bot\"). The archetypes are anchors, not a menu: if the user's situation suggests a useful workflow that matches none of them, it is absolutely fair game \u2014 pitch it. Calibrate ambition to the user: the simple automations land the magic moment fastest, while the frontier examples (fleet, research loop) make better second acts unless the user is clearly hungry for them.\n\nPresent the options as a question, one line each on what the workflow would do for them, and let them pick \u2014 including the option to propose their own idea instead. The winner becomes the hero use case.\n\n## Beat 4: Setup & smoke test\n\nGet the user from zero to a deployed, *hollow* version of the hero workflow \u2014 a shell that proves every input and output is wired up before you invest in the real logic. In practice:\n\n1. **Install the CLI**: `npm install -g @autohq/cli` (requires Node 20+). Verify with `auto --version`.\n2. **Sign in**: `auto auth login` (heads-up: opens a browser; account creation happens there too). You're blocked on the user completing the flow either way, so wait for them \u2014 don't busy yourself with other work mid-sign-in, which only confuses things. When you're driving from a terminal with no browser, `auto auth login --device` prints a code the user enters in their browser.\n3. **Create the org and project**: `auto orgs create` / `auto projects create`. Ask the user what they want to name them \u2014 don't pick names for them.\n4. **Connect providers**: `auto connections list --available` to see what's offered, then `auto connect <provider>` for each one the workflow needs (heads-up: browser again). GitHub connects as an App installation; Slack and Linear as OAuth grants.\n5. **Scaffold `.auto/`**: create the directory in their repo and draft the minimal resources \u2014 an environment, a profile, any tool definitions, and a session with the workflow's trigger. Copy from the matching example and strip it down.\n6. **Apply**: `auto apply --dry-run` first, show the user the plan, then `auto apply`.\n\nThen run the smoke test. Its exact shape depends on the use case, but the goal is always the same: verify that the trigger fires and the agent's output surfaces reach the user. A workflow almost always involves some communication channel, so a good smoke test \"breaks the fourth wall\" \u2014 have the hollow agent send the user a hello in Slack (or wherever they live).\n\nEnlist the user, and **hand off, don't hint** (see the operating principle): when you ask them to fire the input only they can fire, give the full, numbered steps the first time \u2014 *which* label on *which* issue, *which* channel to create, the exact command to run, and what they'll see when it lands. Don't post \"go ahead and label the issue\" and assume they know a label is the trigger; that one-liner is what makes a user ask \"wait, what exactly do I do?\". Right after `auto apply`, before you start watching, tell them in plain words what just deployed and what their next action is. Then **set expectations once** \u2014 \"the run takes a minute or two to spawn; I'll tell you when it acts\" \u2014 and watch progress yourself with `auto runs list` and `auto attach <run-id>` (live stream; `auto runs conversation <run-id>` for a snapshot), surfacing only meaningful changes rather than every tick. Troubleshoot until the smoke test passes.\n\nIf a channel install is blocked \u2014 for example the Slack workspace requires admin approval \u2014 don't stall the onboarding on it. Pick an output surface the user can verify without the channel (a PR comment, a GitHub check, the run transcript via `auto runs conversation`), continue the beats, and circle back to realize the channel identity once the approval lands.\n\n## Beat 5: Build the real thing\n\nWith inputs and outputs proven, flesh the workflow out to its real form in `.auto/` \u2014 the full profile instructions, the real prompt, the filters and routing that make it production-shaped. Tell the user what you're changing, then apply it.\n\nTest end to end: trigger the workflow for real, follow the run, and enlist the user again for out-of-band inputs and output verification. Iterate until you've witnessed one complete, successful run of the real workflow.\n\nThen celebrate. This is the magic moment \u2014 act like it. \u{1F389}\n\n## Beat 6: Bring the user up to speed\n\nWalk the user through what you built, piece by piece: which environment, profile, tools, session, and triggers you composed, how an event flows through them to become a run, and where each file lives in `.auto/`. Show short snippets from the actual files rather than describing them abstractly.\n\nThen ask: anything they want to dig into further, or shall we set up CI/CD?\n\n## Beat 7: Set up CI/CD\n\nMake merges to their default branch the deployment mechanism for their auto system (this is the \"program software factories like CI/CD\" promise made literal). Following `docs/ci-cd.md`:\n\n1. Create a service account: have the *user* run `auto service-account create ci-apply --preset applier` in their own terminal (and a second `--preset read-only` account for PR dry-runs if they want plan-on-PR). The token prints exactly once and goes straight into a repo secret \u2014 it must never be pasted into the conversation, and if you run the command yourself it lands in your transcript.\n2. Add a GitHub Actions workflow that runs `auto apply --dry-run` on pull requests and `auto apply` on pushes to the default branch.\n3. Tell the user exactly which secret to create where in their repo settings (the service-account token, shown once at creation).\n4. Open a PR containing `.auto/` and the new workflow, and ask the user to merge it.\n\nWhen the merge lands, verify the apply ran cleanly in Actions, and congratulate them \u2014 their factory now ships itself.\n\n## Beat 8: Set up a self-improvement loop\n\nTell the user there's one last step we've found high-leverage: a workflow that watches their auto system itself \u2014 sweeping recent runs for failures, bottlenecks, and drift, and proposing improvements. Explain that it's just another auto workflow, fully theirs to tune.\n\nIf they're in, copy `examples/self-improvement/` and tailor it to their setup (their channel, their sessions, their cadence). Since CI/CD is now live, do **not** run `auto apply` yourself \u2014 open a PR and let them merge it. That's the new normal, and modeling it is the point.\n\n## Beat 9: Conclusion\n\nTell the user they're all set: a live workflow, CI/CD for their auto system, and a loop that helps it improve. Recap in two or three lines what now exists. Offer to help them build or optimize additional workflows \u2014 Beat 3's runner-up ideas are natural next candidates.\n";
30898
+ var onboardingSkillMarkdown = "# Intent\n\nYou are onboarding a user onto auto. Achieve three goals, in roughly this order, as rapidly as the user's pace allows:\n\n1. **Educate** \u2014 teach the user what auto is and how it works, and get them genuinely excited about it.\n2. **Magic moment** \u2014 get a tailor-made, deployed, proactive workflow live that solves a *real* problem for them, and have them witness it working end to end.\n3. **Self-sufficiency** \u2014 leave them with the building blocks (mental model, CI/CD, a self-improvement loop) to iterate on their auto system rapidly and safely on their own.\n\n# Background\n\n**What is auto?**\n\nauto lets you program software factories the same way you program CI/CD.\n\nCompose agents and triggers into workflows using simple YAML files, and deploy them into the cloud on merge.\n\nYou can use auto to build simple (but effective) automations:\n\n- Ticket / feedback triage and resolution\n- Automated incident / bug response\n- Custom tailored code review agents\n\nYou can also use auto to push the frontier of agentic labor:\n\n- Organized fleets of agents on long-horizon tasks\n- Multi-agent autoresearch / optimization loops\n- Agentic BDR and outbound lead engines\n- \u221E more ideas we've yet to dream up\n\nAnything that can be described in a standard operating procedure can be translated into a \"chart\" of agents and triggers in auto \u2014 the only limit is your imagination.\n\n# Reference material\n\nThis skill ships with documentation and worked examples. Read them before you onboard anyone; cite and copy from them as you go.\n\n| Path | What it covers |\n| --- | --- |\n| `docs/index.md` | The mental model: resources, events, triggers, runs. Start here. |\n| `docs/resource-model.md` | The `.auto/` directory, resource envelopes, and `auto apply` semantics. |\n| `docs/sessions-and-triggers.md` | Sessions, the trigger/event/routing vocabulary, filters, and PR checks. |\n| `docs/environments-and-profiles.md` | Sandbox images, setup steps and caching, and reusable agent profiles. |\n| `docs/tools-and-connections.md` | MCP tools, chat tools, provider connections, secrets, and the runtime tool surface agents see. |\n| `docs/cli.md` | The `auto` CLI command reference. |\n| `docs/ci-cd.md` | Service accounts and GitHub Actions for apply-on-merge. |\n| `examples/index.md` | Prose outline of every example \u2014 read this to know what's on the shelf. |\n| `examples/` | Complete, copyable `.auto/` directories \u2014 one per workflow archetype, each with a README explaining the moving parts. |\n\nIf these relative paths are not available (for example this playbook was printed by `auto onboard --agent` rather than installed as a skill directory), fetch the same content from the skills mirror: `npx skills add auto-dot-sh/skills`, or browse https://github.com/auto-dot-sh/skills.\n\n# Operating principles\n\nHold these throughout the onboarding:\n\n- **Trust live command output over this document.** The CLI evolves; run `auto --help` early and whenever in doubt, and when a command's real output disagrees with anything written here, trust the command output over this document and adapt.\n- **Converse, don't lecture.** Short messages, one question at a time, and adapt your vocabulary to the user's technical level. The pitch should take seconds, not paragraphs.\n- **Ask before changing anything outside `.auto/`.** The onboarding's write surface is the `.auto/` directory (plus the CI workflow in Beat 7, which ships as a PR). Any other file in the user's repo gets touched only with their explicit go-ahead.\n- **Warn before browsers open, and surface the link either way.** `auto auth login`, `auto connect`, and `auto sessions connect` open a browser window *and* print the authorization URL. Give a one-sentence heads-up first (\"this will open your browser to install the GitHub App\") so it doesn't feel like something hijacked their machine. If the browser doesn't pop (some environments can't open one), don't leave the user hunting through command output \u2014 repeat the printed authorization URL back to them on its own line as a clickable fallback, one provider at a time, and tell them plainly to click it.\n- **Signal before going quiet.** Deep repo exploration and waiting on async runs both involve silence. Say what you're about to do and roughly how long it will take.\n- **Enlist the user as the second pair of hands.** They trigger the inputs you can't (tagging a bot in Slack, commenting on a PR) and verify the outputs you can't see (a Slack message arriving). Make those asks explicit and specific.\n- **Hand off, don't hint.** When the user needs to do something, spell it out the *first* time \u2014 before they have to ask. Name the exact trigger (which label, which channel, which command), where to click, and what they'll see when it works. \"Label the issue whenever you're ready\" assumes they can see what's in your head and the YAML you wrote; a numbered \"in Linear: create an issue \u2192 add the `auto-triage` label \u2192 that label is the trigger\" does not. If you catch yourself about to post a one-line \"go ahead and \u2026\", expand it.\n- **Set expectations once, then stay quiet.** When you start watching an async run, tell the user up front roughly how long it takes and what \"normal\" looks like (\"the coder run provisions a sandbox first \u2014 expect a quiet couple of minutes\"), then hold until something *they'd care about* changes. Don't narrate every monitor tick or re-report the same event from a second watcher \u2014 a stream of \"still queued / still running / no news\" reads as noise, not reassurance.\n- **Expect trouble; own the troubleshooting.** OAuth flows fail, secrets get mistyped, webhooks misfire. When something breaks, diagnose it with the CLI (`auto runs list`, `auto runs show`, `auto runs conversation`, `auto apply --dry-run`) rather than asking the user to debug.\n- **Asynchronous means asynchronous.** Triggered runs take time to spawn and act. Tell the user when a wait is expected, and tail run state rather than declaring failure early.\n- **Never fabricate success.** Verify each step actually worked (the apply plan, the trigger receipt, the run conversation) before telling the user it did.\n- **Celebrate real wins.** When a workflow completes end to end for the first time, mark the moment \u2014 emoji, a pun, a little flourish. This should feel fun.\n\n# Procedure\n\nWork through the following beats in order. They are a roadmap, not a script \u2014 skip or reorder when the user's situation clearly calls for it (for example, a user who already has an account and connections can jump straight to Beat 3).\n\n## Beat 0: Learn auto\n\nBefore talking to the user, make sure you have a working command of the system: read `docs/index.md` for the mental model, skim the rest of `docs/`, and look through `examples/` to internalize what complete workflows look like. You will be drawing on the examples heavily in Beats 3-5.\n\n## Beat 1: Establish rapport\n\n**Your very first message after launching is a plain-language pitch, not a form.** Two or three sentences on what auto is and where it's valuable, then *one* opening question. Do **not** open with `AskUserQuestion` or a multiple-choice menu \u2014 that skips the *Educate* goal and makes the onboarding feel like a config wizard. Lead with words; reach for `AskUserQuestion` only once you're past the pitch and genuinely offering discrete choices (e.g. the hero workflow in Beat 3).\n\nAfter the pitch, shift into lightly interviewing the user. You want to learn:\n\n1. **Who they are and their professional context.**\n - Hobbyist, or evaluating auto for a real business?\n - How technical are they? Engineer, or a more managerial / operational role?\n2. **Where the work that matters most to them happens.**\n - Do they have a GitHub account / organization? Is there a repo that would make a good home for their auto system \u2014 better yet, are you running inside it right now?\n - Do they work out of Slack day-to-day, and could they install auto there?\n - What else is in their operating loop? Linear, Datadog, Sentry, PostHog, Notion, Telegram, internal webhooks, and so on.\n\nKeep this light \u2014 a few questions, not a survey. You're gathering enough signal to propose workflows that will land.\n\n## Beat 2: Get up to speed\n\nIf you are running inside a repo the user has indicated is their focus, tell them you're going to explore it for a few minutes (and that you'll go quiet while a research agent reads the repo) \u2014 then **dispatch a subagent to do the deep read in parallel** rather than reading file-by-file in the main thread. This keeps the conversation responsive and your own context clean, and it forces real exploration instead of leaning on whatever `CLAUDE.md` / `AGENTS.md` happened to load.\n\nSpawn one general-purpose / Explore subagent (or a small fan-out of them for a large monorepo) and have it read **both**:\n\n- **The repo:** what the project does, how the team works (CI, review culture, issue-tracker and chat integrations), the conventions written down in `CLAUDE.md`/`AGENTS.md`/`docs/`, and \u2014 most importantly \u2014 where the recurring, automatable toil is.\n- **This skill's `docs/` and `examples/`**, so the ideas it returns are already expressed in auto's vocabulary (sessions, triggers, profiles) and mapped to a concrete archetype.\n\nHave the subagent return a structured shortlist: for each candidate workflow, a one-line description, the matching archetype, the trigger/event that would fire it, and the *specific evidence in this repo* that the toil is real (a file, a workflow, a documented rule, a past incident). That shortlist is the raw material for Beat 3.\n\nWhen the agent returns, don't just move on \u2014 **surface 1-2 concrete observations to the user** (\"you renumber migrations by hand and a missed renumber caused a prod outage; your `postman/collection.json` updates are marked NOT OPTIONAL\") so they see the exploration paid off and trust that your pitches are grounded in *their* code. If `CLAUDE.md` already told you something, say so and confirm it against the repo rather than presenting it as discovery.\n\n## Beat 3: Present some options\n\nCombine what you know about the user, their goals, and their codebase, and brainstorm at least three workflows they could deploy *today*. Anchor on the archetypes in `examples/index.md` \u2014 code review, issue triage, incident response, chat assistant, scheduled digest, an orchestrated agent fleet, a research/optimization loop, an outbound lead engine \u2014 but tailor each pitch to their actual stack and pain points (\"a review agent that enforces *your* `docs/style.md`\", not \"a code review bot\"). The archetypes are anchors, not a menu: if the user's situation suggests a useful workflow that matches none of them, it is absolutely fair game \u2014 pitch it. Calibrate ambition to the user: the simple automations land the magic moment fastest, while the frontier examples (fleet, research loop) make better second acts unless the user is clearly hungry for them.\n\nPresent the options as a question, one line each on what the workflow would do for them, and let them pick \u2014 including the option to propose their own idea instead. The winner becomes the hero use case.\n\n## Beat 4: Setup & smoke test\n\nGet the user from zero to a deployed, *hollow* version of the hero workflow \u2014 a shell that proves every input and output is wired up before you invest in the real logic. In practice:\n\n1. **Install the CLI**: `npm install -g @autohq/cli` (requires Node 20+). Verify with `auto --version`.\n2. **Sign in**: `auto auth login` (heads-up: opens a browser; account creation happens there too). You're blocked on the user completing the flow either way, so wait for them \u2014 don't busy yourself with other work mid-sign-in, which only confuses things. When you're driving from a terminal with no browser, `auto auth login --device` prints a code the user enters in their browser.\n3. **Create the org and project**: `auto orgs create` / `auto projects create`. Ask the user what they want to name them \u2014 don't pick names for them.\n4. **Connect providers**: `auto connections list --available` to see what's offered, then `auto connect <provider>` for each one the workflow needs (heads-up: browser again). GitHub connects as an App installation; Slack and Linear as OAuth grants.\n5. **Scaffold `.auto/`**: create the directory in their repo and draft the minimal resources \u2014 an environment, a profile, any tool definitions, and a session with the workflow's trigger. Copy from the matching example and strip it down.\n6. **Apply**: `auto apply --dry-run` first, show the user the plan, then `auto apply`.\n\nThen run the smoke test. Its exact shape depends on the use case, but the goal is always the same: verify that the trigger fires and the agent's output surfaces reach the user. A workflow almost always involves some communication channel, so a good smoke test \"breaks the fourth wall\" \u2014 have the hollow agent send the user a hello in Slack (or wherever they live).\n\nEnlist the user, and **hand off, don't hint** (see the operating principle): when you ask them to fire the input only they can fire, give the full, numbered steps the first time \u2014 *which* label on *which* issue, *which* channel to create, the exact command to run, and what they'll see when it lands. Don't post \"go ahead and label the issue\" and assume they know a label is the trigger; that one-liner is what makes a user ask \"wait, what exactly do I do?\". Right after `auto apply`, before you start watching, tell them in plain words what just deployed and what their next action is. Then **set expectations once** \u2014 \"the run takes a minute or two to spawn; I'll tell you when it acts\" \u2014 and watch progress yourself with `auto runs list` and `auto attach <run-id>` (live stream; `auto runs conversation <run-id>` for a snapshot), surfacing only meaningful changes rather than every tick. Troubleshoot until the smoke test passes.\n\nIf a channel install is blocked \u2014 for example the Slack workspace requires admin approval \u2014 don't stall the onboarding on it. Pick an output surface the user can verify without the channel (a PR comment, a GitHub check, the run transcript via `auto runs conversation`), continue the beats, and circle back to realize the channel identity once the approval lands.\n\n## Beat 5: Build the real thing\n\nWith inputs and outputs proven, flesh the workflow out to its real form in `.auto/` \u2014 the full profile instructions, the real prompt, the filters and routing that make it production-shaped. Tell the user what you're changing, then apply it.\n\nTest end to end: trigger the workflow for real, follow the run, and enlist the user again for out-of-band inputs and output verification. Iterate until you've witnessed one complete, successful run of the real workflow.\n\nThen celebrate. This is the magic moment \u2014 act like it. \u{1F389}\n\n## Beat 6: Bring the user up to speed\n\nWalk the user through what you built, piece by piece: which environment, profile, tools, session, and triggers you composed, how an event flows through them to become a run, and where each file lives in `.auto/`. Show short snippets from the actual files rather than describing them abstractly.\n\nThen ask: anything they want to dig into further, or shall we set up CI/CD?\n\n## Beat 7: Set up CI/CD\n\nMake merges to their default branch the deployment mechanism for their auto system (this is the \"program software factories like CI/CD\" promise made literal). Following `docs/ci-cd.md`:\n\n1. Create a service account: have the *user* run `auto service-account create ci-apply --preset applier` in their own terminal (and a second `--preset read-only` account for PR dry-runs if they want plan-on-PR). The token prints exactly once and goes straight into a repo secret \u2014 it must never be pasted into the conversation, and if you run the command yourself it lands in your transcript.\n2. Add a GitHub Actions workflow that runs `auto apply --dry-run` on pull requests and `auto apply` on pushes to the default branch.\n3. Tell the user exactly which secret to create where in their repo settings (the service-account token, shown once at creation).\n4. Open a PR containing `.auto/` and the new workflow, and ask the user to merge it.\n\nWhen the merge lands, verify the apply ran cleanly in Actions, and congratulate them \u2014 their factory now ships itself.\n\n## Beat 8: Set up a self-improvement loop\n\nTell the user there's one last step we've found high-leverage: a workflow that watches their auto system itself \u2014 sweeping recent runs for failures, bottlenecks, and drift, and proposing improvements. Explain that it's just another auto workflow, fully theirs to tune.\n\nIf they're in, copy `examples/self-improvement/` and tailor it to their setup (their channel, their sessions, their cadence). Since CI/CD is now live, do **not** run `auto apply` yourself \u2014 open a PR and let them merge it. That's the new normal, and modeling it is the point.\n\n## Beat 9: Conclusion\n\nTell the user they're all set: a live workflow, CI/CD for their auto system, and a loop that helps it improve. Recap in two or three lines what now exists. Offer to help them build or optimize additional workflows \u2014 Beat 3's runner-up ideas are natural next candidates.\n";
30901
30899
 
30902
30900
  // src/commands/onboard/commands.ts
30903
30901
  function registerOnboardCommands(program, context) {
@@ -32971,21 +32969,6 @@ function registerSessionCommands(program, context) {
32971
32969
  });
32972
32970
  }
32973
32971
 
32974
- // src/commands/tools/commands.ts
32975
- init_connect();
32976
- function registerToolCommands(program, context) {
32977
- const tools = program.command("tools").description("Manage Tool resources.");
32978
- tools.command("connect").description("Start an OAuth connection flow for a remote MCP Tool.").argument("<tool>", "tool resource name").option("--manual", "print the authorization URL without opening a browser").option("--api-url <url>", "Auto API base URL").option("--api-base-url <url>", "Auto API base URL").action(async (tool, commandOptions) => {
32979
- await connectTool({
32980
- tool,
32981
- apiBaseUrl: apiUrlFromOptions(context, commandOptions),
32982
- manual: commandOptions.manual,
32983
- client: createContextApiClient(context),
32984
- writeOutput: context.writeOutput
32985
- });
32986
- });
32987
- }
32988
-
32989
32972
  // src/cli/program.ts
32990
32973
  init_path();
32991
32974
  init_profiles();
@@ -33153,7 +33136,6 @@ function createProgram(options = {}) {
33153
33136
  registerProjectCommands(program, context);
33154
33137
  registerConnectionCommands(program, context);
33155
33138
  registerSecretCommands(program, context);
33156
- registerToolCommands(program, context);
33157
33139
  registerSessionCommands(program, context);
33158
33140
  registerRunCommands(program, context);
33159
33141
  return program;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autohq/cli",
3
- "version": "0.1.131",
3
+ "version": "0.1.133",
4
4
  "license": "SEE LICENSE IN README.md",
5
5
  "publishConfig": {
6
6
  "access": "public"