@keystrokehq/cli 0.1.38 → 0.1.39

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -5024,8 +5024,14 @@ function getCliTargetOptions() {
5024
5024
  }
5025
5025
  //#endregion
5026
5026
  //#region src/resolve-project-target.ts
5027
- function resolveLinkedProjectRef(fromDir = process.cwd()) {
5028
- return readLinkedProjectConfig(fromDir).project;
5027
+ /**
5028
+ * The active project reference for the current command: the explicit global
5029
+ * `--project` flag when set, otherwise the `project` recorded in
5030
+ * keystroke.config.ts. Single source of truth for "which project" across every
5031
+ * CLI command — commands should never read the flag or linked config directly.
5032
+ */
5033
+ function resolveActiveProjectRef(fromDir = process.cwd()) {
5034
+ return (getCliTargetOptions().projectId ?? readLinkedProjectConfig(fromDir).project)?.trim() || void 0;
5029
5035
  }
5030
5036
  /** Activate the organization slug from keystroke.config.ts when present. */
5031
5037
  async function ensureLinkedOrganization(config, fromDir = process.cwd()) {
@@ -5034,7 +5040,7 @@ async function ensureLinkedOrganization(config, fromDir = process.cwd()) {
5034
5040
  await activateOrganization(config, resolveOrganizationRef(await listOrganizations(config), linked.organization).organization.id);
5035
5041
  }
5036
5042
  async function resolveActiveProject(config, platform, fromDir = process.cwd()) {
5037
- const ref = getCliTargetOptions().projectId ?? readLinkedProjectConfig(fromDir).project;
5043
+ const ref = resolveActiveProjectRef(fromDir);
5038
5044
  if (!ref) return;
5039
5045
  await ensureLinkedOrganization(config, fromDir);
5040
5046
  return resolveProjectRef(platform ?? createCliPlatformClient(config), ref);
@@ -6928,11 +6934,12 @@ async function runHistoryGet(config, runId) {
6928
6934
  //#region src/commands/history/index.ts
6929
6935
  function registerHistoryCommand(program) {
6930
6936
  const history = program.command("history").description("List and inspect platform run history");
6931
- history.command("list").description("List runs across projects in the active organization").option("--project <id>", "Filter by project id").option("--status <status>", "Filter by status (pending, running, sleeping, waiting_hook, completed, failed, canceled)").option("--kind <kind>", "Filter by kind (workflow or agent)").option("--admin", "List all org resources (org owner or admin only)").action(async (options) => {
6937
+ history.command("list").description("List runs across projects in the active organization").option("--status <status>", "Filter by status (pending, running, sleeping, waiting_hook, completed, failed, canceled)").option("--kind <kind>", "Filter by kind (workflow or agent)").option("--admin", "List all org resources (org owner or admin only)").action(async (options) => {
6932
6938
  const config = createCliConfig();
6933
6939
  try {
6940
+ const projectId = await resolveActiveProjectId(config);
6934
6941
  await runHistoryList(config, {
6935
- ...options.project ? { project: options.project } : {},
6942
+ ...projectId ? { project: projectId } : {},
6936
6943
  ...options.status ? { status: options.status } : {},
6937
6944
  ...options.kind ? { kind: options.kind } : {},
6938
6945
  ...options.admin ? { admin: true } : {}
@@ -7327,8 +7334,9 @@ async function runInit(options) {
7327
7334
  //#endregion
7328
7335
  //#region src/commands/init.ts
7329
7336
  function registerInitCommand(program) {
7330
- program.command("init").description("Create a new keystroke project from a template").argument("[directory]", "Directory to create the project in").option("--name <name>", "Project name (kebab-case)").option("--template <name>", "Template to use", "hello-world").option("-y, --yes", "Skip prompts (headless mode for scripts and AI agents)").option("--skip-install", "Skip dependency installation").option("--pm <manager>", "Package manager: npm, pnpm, yarn, or bun").option("--no-example", "Scaffold without the example action, agent, and workflow").option("--project <slug>", "Platform project slug to write into keystroke.config.ts").option("--organization <slug>", "Platform organization slug to write into keystroke.config.ts").action(async (directory, options) => {
7337
+ program.command("init").description("Create a new keystroke project from a template").argument("[directory]", "Directory to create the project in").option("--name <name>", "Project name (kebab-case)").option("--template <name>", "Template to use", "hello-world").option("-y, --yes", "Skip prompts (headless mode for scripts and AI agents)").option("--skip-install", "Skip dependency installation").option("--pm <manager>", "Package manager: npm, pnpm, yarn, or bun").option("--no-example", "Scaffold without the example action, agent, and workflow").option("--organization <slug>", "Platform organization slug to write into keystroke.config.ts").action(async (directory, options) => {
7331
7338
  try {
7339
+ const project = getCliTargetOptions().projectId;
7332
7340
  const result = await runInit({
7333
7341
  directory,
7334
7342
  name: options.name,
@@ -7337,7 +7345,7 @@ function registerInitCommand(program) {
7337
7345
  skipInstall: options.skipInstall,
7338
7346
  packageManager: options.pm,
7339
7347
  noExample: options.example === false,
7340
- project: options.project,
7348
+ project,
7341
7349
  organization: options.organization,
7342
7350
  version: readCliVersion()
7343
7351
  });
@@ -7345,7 +7353,7 @@ function registerInitCommand(program) {
7345
7353
  process.stdout.write("\nNext steps:\n");
7346
7354
  process.stdout.write(` cd ${result.targetDir}\n`);
7347
7355
  process.stdout.write(" keystroke auth login # once\n");
7348
- if (!options.project) process.stdout.write(" keystroke project link --project <slug> # link this directory to a platform project\n");
7356
+ if (!project) process.stdout.write(" keystroke project link --project <slug> # link this directory to a platform project\n");
7349
7357
  process.stdout.write(" keystroke deploy # build + ship src/ to the platform\n");
7350
7358
  } catch (error) {
7351
7359
  const message = error instanceof Error ? error.message : "Init failed";
@@ -7483,21 +7491,21 @@ async function runProjectLink(config, projectRef, fromDir = process.cwd()) {
7483
7491
  }
7484
7492
  //#endregion
7485
7493
  //#region src/commands/project/run-project-members.ts
7486
- async function resolveMembersProject(platform, config, projectRef) {
7487
- const ref = projectRef ?? getCliTargetOptions().projectId ?? readLinkedProjectConfig().project;
7494
+ async function resolveMembersProject(platform) {
7495
+ const ref = resolveActiveProjectRef();
7488
7496
  if (!ref) throw new Error("Usage: keystroke --project <slug> project members <command>");
7489
7497
  return resolveProjectRef(platform, ref);
7490
7498
  }
7491
- async function runProjectMembersList(config, options) {
7499
+ async function runProjectMembersList(config) {
7492
7500
  await withActivePlatformClient(config, async (platform) => {
7493
- const project = await resolveMembersProject(platform, config, options.projectRef);
7501
+ const project = await resolveMembersProject(platform);
7494
7502
  const members = await platform.members.listForProject(project.id);
7495
7503
  process.stdout.write(`${JSON.stringify({ members }, null, 2)}\n`);
7496
7504
  });
7497
7505
  }
7498
7506
  async function runProjectMembersInvite(config, input) {
7499
7507
  await withActivePlatformClient(config, async (platform) => {
7500
- const project = await resolveMembersProject(platform, config, input.projectRef);
7508
+ const project = await resolveMembersProject(platform);
7501
7509
  const result = await platform.members.inviteToProject({
7502
7510
  projectId: project.id,
7503
7511
  emails: input.emails,
@@ -7508,21 +7516,21 @@ async function runProjectMembersInvite(config, input) {
7508
7516
  }
7509
7517
  async function runProjectMembersRole(config, input) {
7510
7518
  await withActivePlatformClient(config, async (platform) => {
7511
- const project = await resolveMembersProject(platform, config, input.projectRef);
7519
+ const project = await resolveMembersProject(platform);
7512
7520
  const member = await platform.members.updateProjectMember(project.id, input.userId, { role: input.role });
7513
7521
  process.stdout.write(`${JSON.stringify({ member }, null, 2)}\n`);
7514
7522
  });
7515
7523
  }
7516
7524
  async function runProjectMembersRemove(config, input) {
7517
7525
  await withActivePlatformClient(config, async (platform) => {
7518
- const project = await resolveMembersProject(platform, config, input.projectRef);
7526
+ const project = await resolveMembersProject(platform);
7519
7527
  await platform.members.removeProjectMember(project.id, input.userId);
7520
7528
  process.stdout.write(`${JSON.stringify({ removed: input.userId }, null, 2)}\n`);
7521
7529
  });
7522
7530
  }
7523
- async function runProjectMembersLeave(config, options) {
7531
+ async function runProjectMembersLeave(config) {
7524
7532
  await withActivePlatformClient(config, async (platform) => {
7525
- const project = await resolveMembersProject(platform, config, options.projectRef);
7533
+ const project = await resolveMembersProject(platform);
7526
7534
  await platform.members.leaveProject(project.id);
7527
7535
  process.stdout.write(`${JSON.stringify({ left: project.id }, null, 2)}\n`);
7528
7536
  });
@@ -7536,13 +7544,6 @@ function parseProjectRole$1(role) {
7536
7544
  if (role === "admin" || role === "builder") return role;
7537
7545
  throw new Error("Role must be admin or builder");
7538
7546
  }
7539
- function resolveProjectRefOption$1(config, optionsProject) {
7540
- return optionsProject ?? getCliTargetOptions().projectId ?? readLinkedProjectConfig().project;
7541
- }
7542
- function projectRefInput$1(config, optionsProject) {
7543
- const projectRef = resolveProjectRefOption$1(config, optionsProject);
7544
- return projectRef ? { projectRef } : {};
7545
- }
7546
7547
  async function handleProjectMembersError(fallback, action) {
7547
7548
  const config = createCliConfig();
7548
7549
  try {
@@ -7557,80 +7558,67 @@ async function handleProjectMembersError(fallback, action) {
7557
7558
  }
7558
7559
  function registerProjectMembersCommand(project) {
7559
7560
  const members = project.command("members").description("Manage members for a platform project");
7560
- members.command("list").description("List members for a project").option("--project <slug>", "Project slug").action(async (options) => {
7561
+ members.command("list").description("List members for a project").action(async () => {
7561
7562
  const config = createCliConfig();
7562
7563
  await handleProjectMembersError("List project members failed", async () => {
7563
- await runProjectMembersList(config, projectRefInput$1(config, options.project));
7564
+ await runProjectMembersList(config);
7564
7565
  });
7565
7566
  });
7566
- members.command("invite").description("Invite people to a project").option("--project <slug>", "Project slug").requiredOption("--email <email>", "Email address (repeat for multiple)", collectEmails, []).requiredOption("--role <role>", "Project role (admin or builder)").action(async (options) => {
7567
+ members.command("invite").description("Invite people to a project").requiredOption("--email <email>", "Email address (repeat for multiple)", collectEmails, []).requiredOption("--role <role>", "Project role (admin or builder)").action(async (options) => {
7567
7568
  const config = createCliConfig();
7568
7569
  await handleProjectMembersError("Invite project members failed", async () => {
7569
7570
  await runProjectMembersInvite(config, {
7570
- ...projectRefInput$1(config, options.project),
7571
7571
  emails: options.email,
7572
7572
  role: parseProjectRole$1(options.role)
7573
7573
  });
7574
7574
  });
7575
7575
  });
7576
- members.command("role").description("Update a project member role").argument("<userId>", "Member user id").option("--project <slug>", "Project slug").requiredOption("--role <role>", "Project role (admin or builder)").action(async (userId, options) => {
7576
+ members.command("role").description("Update a project member role").argument("<userId>", "Member user id").requiredOption("--role <role>", "Project role (admin or builder)").action(async (userId, options) => {
7577
7577
  const config = createCliConfig();
7578
7578
  await handleProjectMembersError("Update project member role failed", async () => {
7579
7579
  await runProjectMembersRole(config, {
7580
- ...projectRefInput$1(config, options.project),
7581
7580
  userId,
7582
7581
  role: parseProjectRole$1(options.role)
7583
7582
  });
7584
7583
  });
7585
7584
  });
7586
- members.command("remove").description("Remove a member from a project").argument("<userId>", "Member user id").option("--project <slug>", "Project slug").action(async (userId, options) => {
7585
+ members.command("remove").description("Remove a member from a project").argument("<userId>", "Member user id").action(async (userId) => {
7587
7586
  const config = createCliConfig();
7588
7587
  await handleProjectMembersError("Remove project member failed", async () => {
7589
- await runProjectMembersRemove(config, {
7590
- ...projectRefInput$1(config, options.project),
7591
- userId
7592
- });
7588
+ await runProjectMembersRemove(config, { userId });
7593
7589
  });
7594
7590
  });
7595
- members.command("leave").description("Leave a project as the current user").option("--project <slug>", "Project slug").option("-y, --yes", "Skip confirmation prompt").action(async (options) => {
7591
+ members.command("leave").description("Leave a project as the current user").option("-y, --yes", "Skip confirmation prompt").action(async (options) => {
7596
7592
  const config = createCliConfig();
7597
7593
  await handleProjectMembersError("Leave project failed", async () => {
7598
7594
  if (!options.yes) throw new Error("Pass --yes to confirm leaving the project");
7599
- await runProjectMembersLeave(config, projectRefInput$1(config, options.project));
7595
+ await runProjectMembersLeave(config);
7600
7596
  });
7601
7597
  });
7602
7598
  }
7603
7599
  //#endregion
7604
7600
  //#region src/commands/project/run-project-settings.ts
7605
- async function resolveSettingsProject(platform, config, projectRef) {
7606
- const ref = projectRef ?? getCliTargetOptions().projectId ?? readLinkedProjectConfig().project;
7601
+ async function resolveSettingsProject(platform) {
7602
+ const ref = resolveActiveProjectRef();
7607
7603
  if (!ref) throw new Error("Usage: keystroke --project <slug> project settings <command>");
7608
7604
  return resolveProjectRef(platform, ref);
7609
7605
  }
7610
- async function runProjectSettingsGet(config, options) {
7606
+ async function runProjectSettingsGet(config) {
7611
7607
  await withActivePlatformClient(config, async (platform) => {
7612
- const project = await resolveSettingsProject(platform, config, options.projectRef);
7608
+ const project = await resolveSettingsProject(platform);
7613
7609
  const settings = await platform.projectSettings.get(project.id);
7614
7610
  process.stdout.write(`${JSON.stringify({ settings }, null, 2)}\n`);
7615
7611
  });
7616
7612
  }
7617
- async function runProjectSettingsUpdate(config, input) {
7613
+ async function runProjectSettingsUpdate(config, patch) {
7618
7614
  await withActivePlatformClient(config, async (platform) => {
7619
- const project = await resolveSettingsProject(platform, config, input.projectRef);
7620
- const { projectRef: _projectRef, ...patch } = input;
7615
+ const project = await resolveSettingsProject(platform);
7621
7616
  const settings = await platform.projectSettings.update(project.id, patch);
7622
7617
  process.stdout.write(`${JSON.stringify({ settings }, null, 2)}\n`);
7623
7618
  });
7624
7619
  }
7625
7620
  //#endregion
7626
7621
  //#region src/commands/project/settings.ts
7627
- function resolveProjectRefOption(config, optionsProject) {
7628
- return optionsProject ?? getCliTargetOptions().projectId ?? readLinkedProjectConfig().project;
7629
- }
7630
- function projectRefInput(config, optionsProject) {
7631
- const projectRef = resolveProjectRefOption(config, optionsProject);
7632
- return projectRef ? { projectRef } : {};
7633
- }
7634
7622
  function parseProjectRole(role) {
7635
7623
  if (role === "admin" || role === "builder") return role;
7636
7624
  throw new Error("Default role must be admin or builder");
@@ -7653,18 +7641,17 @@ async function handleProjectSettingsError(fallback, action) {
7653
7641
  }
7654
7642
  function registerProjectSettingsCommand(project) {
7655
7643
  const settings = project.command("settings").description("View and update project governance settings");
7656
- settings.command("get").description("Get settings for a project").option("--project <slug>", "Project slug").action(async (options) => {
7644
+ settings.command("get").description("Get settings for a project").action(async () => {
7657
7645
  const config = createCliConfig();
7658
7646
  await handleProjectSettingsError("Get project settings failed", async () => {
7659
- await runProjectSettingsGet(config, projectRefInput(config, options.project));
7647
+ await runProjectSettingsGet(config);
7660
7648
  });
7661
7649
  });
7662
- settings.command("update").description("Update settings for a project").option("--project <slug>", "Project slug").option("--description <description>", "Project description").option("--default-role <role>", "Default role for new members (admin or builder)").option("--invite-permission <permission>", "Who can invite members (admin or all)").action(async (options) => {
7650
+ settings.command("update").description("Update settings for a project").option("--description <description>", "Project description").option("--default-role <role>", "Default role for new members (admin or builder)").option("--invite-permission <permission>", "Who can invite members (admin or all)").action(async (options) => {
7663
7651
  const config = createCliConfig();
7664
7652
  await handleProjectSettingsError("Update project settings failed", async () => {
7665
7653
  if (options.description === void 0 && options.defaultRole === void 0 && options.invitePermission === void 0) throw new Error("At least one of --description, --default-role, or --invite-permission is required");
7666
7654
  await runProjectSettingsUpdate(config, {
7667
- ...projectRefInput(config, options.project),
7668
7655
  ...options.description !== void 0 ? { description: options.description } : {},
7669
7656
  ...options.defaultRole !== void 0 ? { defaultRole: parseProjectRole(options.defaultRole) } : {},
7670
7657
  ...options.invitePermission !== void 0 ? { invitePermission: parseInvitePermission(options.invitePermission) } : {}
@@ -7691,7 +7678,7 @@ function registerProjectCommand(program) {
7691
7678
  project.command("metrics").description("List rollup metrics for projects in the active organization").option("--admin", "List all org resources (org owner or admin only)").action(async (options) => {
7692
7679
  const config = createCliConfig();
7693
7680
  try {
7694
- const projectRef = getCliTargetOptions().projectId;
7681
+ const projectRef = resolveActiveProjectRef();
7695
7682
  await runProjectMetrics(config, {
7696
7683
  ...projectRef ? { projectRef } : {},
7697
7684
  ...options.admin ? { admin: true } : {}
@@ -7704,10 +7691,10 @@ function registerProjectCommand(program) {
7704
7691
  process.exitCode = 1;
7705
7692
  }
7706
7693
  });
7707
- project.command("deployments").description("View deployment history for platform projects").command("list").description("List deployment history for a project").option("--project <slug>", "Project slug").action(async (options) => {
7694
+ project.command("deployments").description("View deployment history for platform projects").command("list").description("List deployment history for a project").action(async () => {
7708
7695
  const config = createCliConfig();
7709
7696
  try {
7710
- const projectRef = options.project ?? getCliTargetOptions().projectId ?? resolveLinkedProjectRef();
7697
+ const projectRef = resolveActiveProjectRef();
7711
7698
  if (!projectRef) throw new Error("Usage: keystroke project deployments list --project <slug> (or run `keystroke project link`)");
7712
7699
  await runProjectDeploymentsList(config, { projectRef });
7713
7700
  } catch (error) {
@@ -7718,10 +7705,12 @@ function registerProjectCommand(program) {
7718
7705
  process.exitCode = 1;
7719
7706
  }
7720
7707
  });
7721
- project.command("link").description("Link this directory to a platform project in keystroke.config.ts").requiredOption("--project <slug>", "Platform project slug").option("--dir <path>", "Project directory", process.cwd()).action(async (options) => {
7708
+ project.command("link").description("Link this directory to a platform project in keystroke.config.ts").option("--dir <path>", "Project directory", process.cwd()).action(async (options) => {
7722
7709
  const config = createCliConfig();
7723
7710
  try {
7724
- await runProjectLink(config, options.project, options.dir);
7711
+ const projectRef = resolveActiveProjectRef(options.dir);
7712
+ if (!projectRef) throw new Error("Usage: keystroke project link --project <slug> (see: keystroke project list)");
7713
+ await runProjectLink(config, projectRef, options.dir);
7725
7714
  } catch (error) {
7726
7715
  process.stderr.write(`${formatCliError(error, "Link project failed", {
7727
7716
  serverUrl: getPlatformUrl(config),
@@ -8135,20 +8124,20 @@ function registerChannelPlatformsCommand(channel) {
8135
8124
  }
8136
8125
  //#endregion
8137
8126
  //#region src/commands/channel/resolve-channel-project.ts
8138
- async function resolveChannelProjectId(config, projectRef) {
8127
+ async function resolveChannelProjectId(config) {
8139
8128
  const platform = createCliPlatformClient(config);
8140
8129
  await ensureLinkedOrganization(config);
8141
8130
  await ensureActiveOrganization(config);
8142
- const ref = projectRef?.trim() || getCliTargetOptions().projectId?.trim() || readLinkedProjectConfig().project?.trim();
8131
+ const ref = resolveActiveProjectRef();
8143
8132
  if (!ref) throw new Error("Project is required. Pass --project <slug> or run `keystroke project link --project <slug>`.");
8144
8133
  return (await resolveProjectRef(platform, ref)).id;
8145
8134
  }
8146
8135
  //#endregion
8147
8136
  //#region src/commands/channel/list.ts
8148
8137
  function registerChannelAccountsCommand(channel) {
8149
- channel.command("accounts").description("List available workspace accounts for a platform").requiredOption("--platform <key>", "Platform key (slack)").option("--project <slug>", "Project slug").action(async (options) => runCliCommand("List channel accounts failed", async () => {
8138
+ channel.command("accounts").description("List available workspace accounts for a platform").requiredOption("--platform <key>", "Platform key (slack)").action(async (options) => runCliCommand("List channel accounts failed", async () => {
8150
8139
  const config = createCliConfig();
8151
- const projectId = await resolveChannelProjectId(config, options.project);
8140
+ const projectId = await resolveChannelProjectId(config);
8152
8141
  const client = createCliPlatformClient(config);
8153
8142
  await ensureActiveOrganization(config);
8154
8143
  const accounts = await runChannelAccounts(client, projectId, options.platform);
@@ -8156,9 +8145,9 @@ function registerChannelAccountsCommand(channel) {
8156
8145
  }));
8157
8146
  }
8158
8147
  function registerChannelListCommand(channel) {
8159
- channel.command("list").description("List channel bindings for an agent").requiredOption("--agent <id>", "Agent id").option("--project <slug>", "Project slug").action(async (options) => runCliCommand("List agent channels failed", async () => {
8148
+ channel.command("list").description("List channel bindings for an agent").requiredOption("--agent <id>", "Agent id").action(async (options) => runCliCommand("List agent channels failed", async () => {
8160
8149
  const config = createCliConfig();
8161
- const projectId = await resolveChannelProjectId(config, options.project);
8150
+ const projectId = await resolveChannelProjectId(config);
8162
8151
  const client = createCliPlatformClient(config);
8163
8152
  await ensureActiveOrganization(config);
8164
8153
  const connections = await runChannelList(client, projectId, options.agent);
@@ -8166,9 +8155,9 @@ function registerChannelListCommand(channel) {
8166
8155
  }));
8167
8156
  }
8168
8157
  function registerChannelDirectoryCommand(channel) {
8169
- channel.command("directory").description("List channels available to bind from a platform directory").requiredOption("--platform <key>", "Platform key (slack)").requiredOption("--account <id>", "Workspace account id (team id)").option("--project <slug>", "Project slug").action(async (options) => runCliCommand("List channel directory failed", async () => {
8158
+ channel.command("directory").description("List channels available to bind from a platform directory").requiredOption("--platform <key>", "Platform key (slack)").requiredOption("--account <id>", "Workspace account id (team id)").action(async (options) => runCliCommand("List channel directory failed", async () => {
8170
8159
  const config = createCliConfig();
8171
- const projectId = await resolveChannelProjectId(config, options.project);
8160
+ const projectId = await resolveChannelProjectId(config);
8172
8161
  const client = createCliPlatformClient(config);
8173
8162
  await ensureActiveOrganization(config);
8174
8163
  const channels = await runChannelDirectory(client, projectId, options.platform, options.account);
@@ -8176,9 +8165,9 @@ function registerChannelDirectoryCommand(channel) {
8176
8165
  }));
8177
8166
  }
8178
8167
  function registerChannelBindCommand(channel) {
8179
- channel.command("bind").description("Bind an agent to a channel").requiredOption("--agent <id>", "Agent id").requiredOption("--platform <key>", "Platform key (slack)").requiredOption("--account <id>", "Workspace account id (team id)").requiredOption("--channel <id>", "Provider channel id").option("--channel-name <name>", "Provider channel name").option("--mode <mode>", "Listen mode (mention, all, dm)", "mention").option("--project <slug>", "Project slug").action(async (options) => runCliCommand("Bind channel failed", async () => {
8168
+ channel.command("bind").description("Bind an agent to a channel").requiredOption("--agent <id>", "Agent id").requiredOption("--platform <key>", "Platform key (slack)").requiredOption("--account <id>", "Workspace account id (team id)").requiredOption("--channel <id>", "Provider channel id").option("--channel-name <name>", "Provider channel name").option("--mode <mode>", "Listen mode (mention, all, dm)", "mention").action(async (options) => runCliCommand("Bind channel failed", async () => {
8180
8169
  const config = createCliConfig();
8181
- const projectId = await resolveChannelProjectId(config, options.project);
8170
+ const projectId = await resolveChannelProjectId(config);
8182
8171
  const client = createCliPlatformClient(config);
8183
8172
  await ensureActiveOrganization(config);
8184
8173
  const connection = await runChannelBind(client, projectId, {
@@ -8196,9 +8185,9 @@ function registerChannelBindCommand(channel) {
8196
8185
  }));
8197
8186
  }
8198
8187
  function registerChannelUnbindCommand(channel) {
8199
- channel.command("unbind").description("Remove a channel binding from an agent").requiredOption("--agent <id>", "Agent id").requiredOption("--binding <id>", "Binding id").option("--project <slug>", "Project slug").action(async (options) => runCliCommand("Unbind channel failed", async () => {
8188
+ channel.command("unbind").description("Remove a channel binding from an agent").requiredOption("--agent <id>", "Agent id").requiredOption("--binding <id>", "Binding id").action(async (options) => runCliCommand("Unbind channel failed", async () => {
8200
8189
  const config = createCliConfig();
8201
- const projectId = await resolveChannelProjectId(config, options.project);
8190
+ const projectId = await resolveChannelProjectId(config);
8202
8191
  const client = createCliPlatformClient(config);
8203
8192
  await ensureActiveOrganization(config);
8204
8193
  const connection = await runChannelUnbind(client, projectId, {
@@ -8209,9 +8198,9 @@ function registerChannelUnbindCommand(channel) {
8209
8198
  }));
8210
8199
  }
8211
8200
  function registerChannelUpdateBindingCommand(channel) {
8212
- channel.command("update-binding").description("Update a channel binding listen mode or thread setting").requiredOption("--agent <id>", "Agent id").requiredOption("--binding <id>", "Binding id").option("--mode <mode>", "Listen mode (mention, all, dm)").option("--threads", "Enable thread follow-up (subscribe on mention)").option("--no-threads", "Disable thread follow-up").option("--project <slug>", "Project slug").action(async (options) => runCliCommand("Update channel binding failed", async () => {
8201
+ channel.command("update-binding").description("Update a channel binding listen mode or thread setting").requiredOption("--agent <id>", "Agent id").requiredOption("--binding <id>", "Binding id").option("--mode <mode>", "Listen mode (mention, all, dm)").option("--threads", "Enable thread follow-up (subscribe on mention)").option("--no-threads", "Disable thread follow-up").action(async (options) => runCliCommand("Update channel binding failed", async () => {
8213
8202
  const config = createCliConfig();
8214
- const projectId = await resolveChannelProjectId(config, options.project);
8203
+ const projectId = await resolveChannelProjectId(config);
8215
8204
  const client = createCliPlatformClient(config);
8216
8205
  await ensureActiveOrganization(config);
8217
8206
  const patch = {};