sinatra.dev 0.4.0 → 0.5.1

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/README.md CHANGED
@@ -241,8 +241,8 @@ sinatra connect telegram
241
241
  The CLI prints the URL before opening your browser, then polls `workspace show`'s
242
242
  overview until the integration is connected or the timeout expires. Complete authorization
243
243
  in a signed-in browser; never paste OAuth codes, tokens or cookies into CLI arguments.
244
- GitHub, Linear and Slack require a workspace admin or owner. Telegram links your
245
- personal account where available, independently of whether the workspace enables requests.
244
+ GitHub, Linear and Slack require a workspace admin or owner. Telegram links your personal
245
+ account where available, independently of whether the workspace enables requests.
246
246
 
247
247
  If no browser opens, open the printed URL manually. `--json` prints only the raw
248
248
  `{ "url": "…" }` response, without opening a browser or polling. Check status separately
package/dist/client.js CHANGED
@@ -86,7 +86,7 @@ export function createClient(options) {
86
86
  catch (error) {
87
87
  if (error instanceof SignInError || error instanceof ConfigError)
88
88
  throw error;
89
- const codes = ["invalid_token", "unauthorized", "not_found", "repo_not_found", "secret_not_found", "model_key_not_found", "actor_not_authorized", "unsupported_provider", "key_validation_failed", "provider_unreachable", "invalid_body", "invalid_secret_hosts", "invalid_secret_header", "invalid_secret_prefix", "invalid_secret_name", "invalid_secret_value", "secret_cap_exceeded", "capability_request_not_found", "capability_target_not_authorized", "repo_environments_not_enabled", "internal_error", "unavailable", "request_failed"];
89
+ const codes = ["invalid_token", "unauthorized", "not_found", "repo_not_found", "secret_not_found", "model_key_not_found", "actor_not_authorized", "unsupported_provider", "key_validation_failed", "provider_unreachable", "invalid_body", "invalid_secret_hosts", "invalid_secret_header", "invalid_secret_prefix", "invalid_secret_name", "invalid_secret_value", "secret_cap_exceeded", "capability_request_not_found", "capability_target_not_authorized", "repo_environments_not_enabled", "invalid_project_ref", "invalid_label", "invalid_token_value", "acknowledgement_required", "connector_label_taken", "connector_cap_exceeded", "connector_not_found", "connection_not_found", "internal_error", "unavailable", "request_failed"];
90
90
  if (error instanceof ApiError)
91
91
  throw new ApiError(error.status, codes.includes(error.code) ? error.code : "request_failed");
92
92
  throw new ApiError(503, "unavailable");
@@ -102,6 +102,10 @@ export function createClient(options) {
102
102
  getWorkspacePrReviewSettings: (workspaceId) => request("GET", `/v1/workspaces/${encodeURIComponent(workspaceId)}/review-external-prs`),
103
103
  setWorkspacePrReviewSettings: (workspaceId, reviewExternalPrs) => request("PUT", `/v1/workspaces/${encodeURIComponent(workspaceId)}/review-external-prs`, { reviewExternalPrs }, false),
104
104
  integrationConnect: (workspaceId, integration) => request("GET", `/v1/workspaces/${encodeURIComponent(workspaceId)}/integrations/${integration}/connect`),
105
+ listConnectors: (workspaceId) => request("GET", `/v1/workspaces/${encodeURIComponent(workspaceId)}/connectors`),
106
+ /** Carries a provider token: only in the body, and through the path that keeps no server detail. */
107
+ connectConnector: (workspaceId, body) => keyRequest("POST", `/v1/workspaces/${encodeURIComponent(workspaceId)}/connectors`, body),
108
+ disconnectConnector: (workspaceId, connectionId) => request("DELETE", `/v1/workspaces/${encodeURIComponent(workspaceId)}/connectors/${encodeURIComponent(connectionId)}`, undefined, false),
105
109
  getModelDefault: (workspaceId) => request("GET", `/v1/workspaces/${encodeURIComponent(workspaceId)}/model-default`),
106
110
  setModelDefault: (workspaceId, selection) => request("PUT", `/v1/workspaces/${encodeURIComponent(workspaceId)}/model-default`, selection, false),
107
111
  clearModelDefault: (workspaceId) => request("DELETE", `/v1/workspaces/${encodeURIComponent(workspaceId)}/model-default`, undefined, false),
package/dist/commands.js CHANGED
@@ -4,7 +4,7 @@ import { readFile } from "node:fs/promises";
4
4
  import { ApiError, createClient } from "./client.js";
5
5
  import { ConfigError, DEFAULT_API_URL, DEFAULT_APP_URL } from "./config.js";
6
6
  import { DEFAULT_FOLLOW_TIMEOUT_MS } from "./follow.js";
7
- import { revokeSignIn } from "./oauth.js";
7
+ import { revokeSignIn, SignInError } from "./oauth.js";
8
8
  /**
9
9
  * A ticket reference as a person pastes it: `ENG-123`, a Linear issue URL, `owner/name#12` or a
10
10
  * GitHub issue URL. Null for anything else.
@@ -26,8 +26,132 @@ export class UsageError extends Error {
26
26
  const TASK_ID = /^[a-z0-9][a-z0-9_-]{19,63}$/;
27
27
  const SUBSCRIPTIONS_USAGE = "Usage: sinatra subscriptions [list | connect <codex|claude|xai|cursor> | remove <id>] [--json] [-w <id>]. Paste Claude's authorization code at the hidden prompt or through stdin, never on the command line.";
28
28
  const CONNECT_USAGE = "Usage: sinatra connect <github|linear|slack|telegram> [-w <id>] [--timeout <minutes>] [--json]. Authorization happens in your browser; never supply secrets on the command line.";
29
+ // Connectors are unlisted: this is the only place the group's usage is said, and USAGE never names it.
30
+ const CONNECTORS_USAGE = "Usage: sinatra connectors [list | connect <connector> [--project <ref>] [--name <label>] [--token] [--accept] | disconnect <connection-id> [--yes]] [-w <id>] [--json]. --project is needed only by services that take a project reference. Without --token or --accept, a service you can sign in to gives a link to the dashboard, where a workspace owner or admin signs in and accepts the warning; --token, or --accept to accept the terms without a prompt, pastes a token instead, for a service that takes one. Paste a token at the hidden prompt or pipe it on stdin, never on the command line.";
29
31
  const WORKSPACE_CREATE_USAGE = 'Usage: sinatra workspace create "<name>" [--json]. Quote a name with spaces.';
30
32
  const REPO_USAGE = "Usage: sinatra repo <owner/name> config [preflight --file <json>] | override set --file <json> | override clear [--yes] | secrets [list | set <name> --host <host> | rotate <name> | update <name> | delete <name> --yes] | env | capability-requests | review-external-prs [inherit|on|off] [-w <id>] [--json]. Secret values belong only at the hidden prompt or on stdin, never in arguments or flags.";
33
+ /** The help text. Unlisted command groups stay out of it. */
34
+ export const USAGE = `Usage:
35
+ sinatra login [--api-url <url>] [-w <id>] [--no-browser | --token]
36
+ Sign in through your browser (-w: the default workspace)
37
+ --no-browser Print the sign-in URL instead of opening it (the browser
38
+ must still be on this computer)
39
+ --token Paste a personal access token instead (also when stdin
40
+ is piped: sinatra login < token-file)
41
+ sinatra [start] "<what to do>" Start a task and follow it
42
+ -r, --repo <owner/name> Repository (default: this checkout's GitHub remote)
43
+ -f, --file <path> Attach a text file (repeatable, 80KB total)
44
+ -t, --title <title> Task title (default: the prompt's first line)
45
+ -m, --model <model> Model for every agent, such as openai-codex/gpt-6.1-sol
46
+ (default: the repository's or workspace's model)
47
+ --timeout <minutes> Stop following after this long (default 30)
48
+ --no-wait Start it and return
49
+ --json With --no-wait: print the started task as JSON
50
+ sinatra reply <task-id> "<message>" Follow up on a task, then follow it
51
+ (takes -f, --timeout, --no-wait, --json like start)
52
+ sinatra show <task-id> [--json] Print a task and its conversation
53
+ sinatra tasks [--status <status>] [-n, --limit <n>] [--json]
54
+ List the workspace's recent tasks (20 unless -n)
55
+ sinatra stop <task-id> Stop a task's running agent
56
+ sinatra tickets [-q <text>] [-r <owner/name>] [--json]
57
+ Open Linear and GitHub issues you could delegate: yours,
58
+ then the team's unassigned (-q: search, -r: repo first)
59
+ sinatra delegate <ticket> Hand Sinatra a Linear or GitHub issue as you: ENG-123,
60
+ owner/name#12, or the issue's URL
61
+ sinatra subscriptions [list] [--json] List your subscription connections in this workspace
62
+ sinatra subscriptions connect <codex|claude|xai|cursor> [--json] [--no-browser]
63
+ Print the verification URL/code and open your browser;
64
+ wait up to 15 minutes for device approval. Claude asks
65
+ for a hidden authorization code (or reads it from stdin).
66
+ Never pass an authorization code on the command line.
67
+ With --json, handoff and prompts go to stderr.
68
+ sinatra subscriptions remove <id> [--json]
69
+ Remove one of your subscription connections
70
+ sinatra whoami [--json] Who you're logged in as, and your workspaces
71
+ sinatra account [--json] Your account, memberships and linked identities
72
+ sinatra email-preferences [--json] Read your email preferences
73
+ --setup-reminders <on|off> Change setup reminder emails
74
+ --task-alerts <on|off> Change task alert emails (omitted flags stay unchanged)
75
+ sinatra workspace [<id>] List your workspaces, or make one the default
76
+ sinatra repos [-w <id>] [--json] List the workspace's accessible repositories
77
+ sinatra repo <owner/name> config Read effective repository config and provenance
78
+ sinatra repo <owner/name> config preflight --file <json>
79
+ Preflight a draft override fragment from a JSON file
80
+ sinatra repo <owner/name> override set --file <json>
81
+ Save your repository override fragment
82
+ sinatra repo <owner/name> override clear [--yes]
83
+ Clear your override (confirmation required)
84
+ sinatra repo <owner/name> secrets [list]
85
+ List secret metadata, never plaintext values
86
+ sinatra repo <owner/name> secrets set <name> --host <host>
87
+ sinatra repo <owner/name> secrets rotate <name>
88
+ Read a value at a hidden prompt or from stdin;
89
+ never pass secret values in arguments or flags
90
+ sinatra repo <owner/name> secrets update <name>
91
+ PATCH metadata without changing the secret value
92
+ --host <host> Allowed host (repeatable; replaces hosts on update)
93
+ --header <header> --prefix <prefix> Optional proxy metadata for set, rotate or update
94
+ --capability-request <id> Fulfill a capability request with set or rotate
95
+ sinatra repo <owner/name> secrets delete <name> [--yes]
96
+ Delete a secret (confirmation required)
97
+ sinatra repo <owner/name> env Read the feature-gated repository environment
98
+ sinatra repo <owner/name> capability-requests
99
+ Read repository capability requests
100
+ sinatra repo <owner/name> review-external-prs [inherit|on|off]
101
+ Read or set external PR reviews (writes: owner/admin)
102
+ All repos/repo commands take -w and --json
103
+ sinatra model [get] [--json] Show the workspace's saved default (members)
104
+ sinatra model set <model> --engine <engine> [--effort <effort>]
105
+ Save a catalog engine/model/effort pairing (owner only)
106
+ sinatra model clear [--yes] Restore automatic selection (owner only; confirmation required)
107
+ sinatra keys [list] [--json] List configured providers, never key values (members)
108
+ sinatra keys add <anthropic|openrouter> Paste a key at a hidden prompt, or pipe stdin
109
+ sinatra keys remove <anthropic|openrouter> [--yes]
110
+ Remove a key (owners/admins; confirmation required)
111
+ Model and keys commands take -w and --json
112
+ sinatra billing [-w <id>] [--json] Show plan, capacity and subscription status
113
+ sinatra billing upgrade --plan <pro|team|scale> [-w <id>] [--json]
114
+ Open checkout (workspace owner only)
115
+ sinatra billing portal [-w <id>] [--json]
116
+ Open billing management (workspace owner only)
117
+ sinatra connect <github|linear|slack|telegram> [-w <id>] [--timeout <minutes>] [--json]
118
+ Print the authorization URL, open your browser and wait
119
+ for connection (--json returns only the URL response)
120
+ Browser commands always print the URL; --json returns
121
+ only the response without opening a browser
122
+ sinatra members list [--json] List members, pending invites and access requests
123
+ sinatra invite <email> --role <role> Invite a member or admin
124
+ sinatra invite resend <invite-id> Resend an invitation
125
+ sinatra invite revoke <invite-id> Revoke an invitation (confirmation required)
126
+ sinatra requests approve <request-id> --role <role>
127
+ sinatra requests deny <request-id> Resolve an access request
128
+ sinatra members role <membership-id> --role <role>
129
+ sinatra members remove <membership-id> Remove a member (confirmation required)
130
+ sinatra members transfer <membership-id>
131
+ Transfer ownership (confirmation required)
132
+ sinatra workspace leave Leave the workspace (confirmation required)
133
+ --role <member|admin> Role to grant; owner is never a grantable role
134
+ --yes, -y Skip confirmation for destructive access actions, model clear,
135
+ keys remove, repo override clear or repo secrets delete;
136
+ never pass keys or secret values in argv
137
+ Access commands take -w and --json; owner-only except leave
138
+ sinatra workspace create "<name>" [--json]
139
+ Create a workspace you own (one per person without
140
+ GitHub); the first becomes your default
141
+ sinatra workspace show [-w <id>] [--json]
142
+ Read repositories, integrations, plan and default model
143
+ sinatra workspace review-external-prs [on|off] [-w <id>] [--json]
144
+ Read or set external PR reviews (writes: owner/admin)
145
+ sinatra logout Revoke the saved sign-in or token and forget it
146
+ sinatra -v, --version Print the CLI's version
147
+
148
+ -w, --workspace <id> Workspace for task, access, subscription, workspace settings,
149
+ model, keys, repos, repo or billing commands, or default to save at login
150
+ (default: yours from login or \`sinatra workspace\`)
151
+ Account and email preferences need no workspace membership or default workspace.
152
+
153
+ Exit codes: 0 done, 1 error, 2 the task failed, was cancelled or is paused,
154
+ 3 still working (or your reply not picked up yet) when the CLI stopped waiting.`;
31
155
  /**
32
156
  * What the arguments ask for. A command word counts only in the shape that command takes, so
33
157
  * `sinatra stop retrying on 429` or `sinatra logout the user on expiry` start tasks instead of
@@ -48,6 +172,17 @@ export function parseCommand(positionals) {
48
172
  }
49
173
  return usage("Usage: sinatra workspace review-external-prs [on|off] [-w <id>] [--json]");
50
174
  }
175
+ // Only the group's own shapes count (`sinatra connectors keep timing out` is still a task), but a
176
+ // malformed connect or disconnect is its usage, never a task: a mistyped connect could carry a token.
177
+ if (first === "connectors" && connectorsShape(rest)) {
178
+ if (rest.length === 0 || (rest.length === 1 && rest[0] === "list"))
179
+ return { name: "connectors", action: "list" };
180
+ if (rest.length === 2 && rest[0] === "connect" && rest[1].trim())
181
+ return { name: "connectors", action: "connect", connector: rest[1] };
182
+ if (rest.length === 2 && rest[0] === "disconnect" && rest[1].trim())
183
+ return { name: "connectors", action: "disconnect", connectionId: rest[1] };
184
+ return usage(CONNECTORS_USAGE);
185
+ }
51
186
  if (first === "repos")
52
187
  return rest.length === 0 ? { name: "repos" } : usage("Usage: sinatra repos [-w <id>] [--json]");
53
188
  if (first === "repo") {
@@ -79,7 +214,7 @@ export function parseCommand(positionals) {
79
214
  return usage(REPO_USAGE);
80
215
  }
81
216
  if (first === "connect") {
82
- if (rest.length === 1 && ["github", "linear", "slack", "telegram"].includes(rest[0])) {
217
+ if (rest.length === 1 && ["github", "linear", "slack", "telegram", "buzz"].includes(rest[0])) {
83
218
  return { name: "connect", integration: rest[0] };
84
219
  }
85
220
  return usage(CONNECT_USAGE);
@@ -224,6 +359,15 @@ const OPTIONS = {
224
359
  version: { type: "boolean", short: "v" },
225
360
  help: { type: "boolean", short: "h" },
226
361
  };
362
+ /**
363
+ * Options only `sinatra connectors` reads. They are parsed only for that unlisted group, so every
364
+ * other command answers them exactly as it did before (`Unknown option --project.`).
365
+ */
366
+ const CONNECTOR_OPTIONS = {
367
+ project: { type: "string" },
368
+ name: { type: "string" },
369
+ accept: { type: "boolean" },
370
+ };
227
371
  /** The commands each option means something to; given to any other, it's a mistake. */
228
372
  const APPLIES_TO = {
229
373
  repo: ["start", "tickets"],
@@ -231,19 +375,19 @@ const APPLIES_TO = {
231
375
  file: ["start", "reply", "repo"],
232
376
  title: ["start"],
233
377
  model: ["start"],
234
- workspace: ["start", "reply", "show", "workspace-show", "workspace-pr-review", "tasks", "stop", "tickets", "delegate", "login", "access", "subscriptions", "model", "keys", "billing", "connect", "repos", "repo"],
378
+ workspace: ["start", "reply", "show", "workspace-show", "workspace-pr-review", "tasks", "stop", "tickets", "delegate", "login", "access", "subscriptions", "model", "keys", "billing", "connect", "connectors", "repos", "repo"],
235
379
  "no-wait": ["start", "reply"],
236
380
  timeout: ["start", "reply", "connect"],
237
- json: ["whoami", "account", "email-preferences", "tasks", "show", "workspace-show", "workspace-create", "workspace-pr-review", "start", "reply", "tickets", "access", "subscriptions", "model", "keys", "billing", "connect", "repos", "repo"],
381
+ json: ["whoami", "account", "email-preferences", "tasks", "show", "workspace-show", "workspace-create", "workspace-pr-review", "start", "reply", "tickets", "access", "subscriptions", "model", "keys", "billing", "connect", "connectors", "repos", "repo"],
238
382
  "setup-reminders": ["email-preferences"],
239
383
  "task-alerts": ["email-preferences"],
240
384
  status: ["tasks"],
241
385
  limit: ["tasks"],
242
386
  "api-url": ["login"],
243
- token: ["login"],
387
+ token: ["login", "connectors"],
244
388
  "no-browser": ["login", "subscriptions"],
245
389
  role: ["access"],
246
- yes: ["access", "model", "keys", "repo"],
390
+ yes: ["access", "model", "keys", "repo", "connectors"],
247
391
  engine: ["model"],
248
392
  effort: ["model"],
249
393
  plan: ["billing"],
@@ -251,12 +395,16 @@ const APPLIES_TO = {
251
395
  header: ["repo"],
252
396
  prefix: ["repo"],
253
397
  "capability-request": ["repo"],
398
+ project: ["connectors"],
399
+ name: ["connectors"],
400
+ accept: ["connectors"],
254
401
  };
255
402
  function requiresConfirmation(command) {
256
403
  return (command.name === "access" && ["revoke", "remove", "transfer", "leave"].includes(command.action))
257
404
  || (command.name === "model" && command.action === "clear")
258
405
  || (command.name === "keys" && command.action === "remove")
259
- || (command.name === "repo" && (command.action === "override-clear" || command.action === "secrets-delete"));
406
+ || (command.name === "repo" && (command.action === "override-clear" || command.action === "secrets-delete"))
407
+ || (command.name === "connectors" && command.action === "disconnect");
260
408
  }
261
409
  /** Refusals fail closed before the caller sends a workspace mutation. */
262
410
  export async function confirmWorkspaceMutation(command, options) {
@@ -270,7 +418,9 @@ export async function confirmWorkspaceMutation(command, options) {
270
418
  ? `remove ${command.provider} key`
271
419
  : command.name === "repo"
272
420
  ? `${command.action} in ${command.repoName}${"secretName" in command ? ` (${command.secretName})` : ""}`
273
- : "clear model default";
421
+ : command.name === "connectors"
422
+ ? `disconnect connection${"connectionId" in command ? ` ${command.connectionId}` : ""}`
423
+ : "clear model default";
274
424
  const answer = await options.ask(printable(`Confirm ${action} in workspace ${options.workspaceId}? [y/N] `));
275
425
  if (!/^(y|yes)$/i.test(answer.trim()))
276
426
  throw new UsageError("Cancelled. Nothing changed.");
@@ -417,6 +567,16 @@ export function parseInvocation(argv) {
417
567
  return parseArgs({ args: argv, allowPositionals: true, options: OPTIONS });
418
568
  }
419
569
  catch (error) {
570
+ // The unlisted connectors group reads its own options; any other command never sees them.
571
+ if (connectorsInvocation(argv)) {
572
+ try {
573
+ return parseArgs({ args: argv, allowPositionals: true, options: { ...OPTIONS, ...CONNECTOR_OPTIONS } });
574
+ }
575
+ catch {
576
+ // Never quote the option: it could be a pasted token.
577
+ throw new UsageError(CONNECTORS_USAGE);
578
+ }
579
+ }
420
580
  // parseArgs can quote an entire unknown option, including a pasted secret after `=`.
421
581
  if (argv.includes("repo"))
422
582
  throw new UsageError(REPO_USAGE);
@@ -500,6 +660,12 @@ export function parseInvocation(argv) {
500
660
  if (!needsRole && values.role !== undefined)
501
661
  throw new UsageError("--role doesn't apply to this access action.");
502
662
  }
663
+ if (command.name === "connectors") {
664
+ const connecting = command.action === "connect";
665
+ if (!connecting && (values.project !== undefined || values.name !== undefined || values.accept !== undefined || values.token !== undefined)) {
666
+ throw new UsageError("--project, --name, --token and --accept only apply to `sinatra connectors connect`.");
667
+ }
668
+ }
503
669
  if (values.yes !== undefined && command.name !== "help" && command.name !== "version" && !requiresConfirmation(command)) {
504
670
  throw new UsageError("--yes doesn't apply to this action.");
505
671
  }
@@ -535,6 +701,12 @@ export function parseInvocation(argv) {
535
701
  ...(values.prefix !== undefined ? { prefix: values.prefix } : {}),
536
702
  ...(values["capability-request"] !== undefined ? { capabilityRequestId: values["capability-request"] } : {}),
537
703
  } } : {}),
704
+ ...(command.name === "connectors" && command.action === "connect" ? { connection: {
705
+ ...(values.project?.trim() ? { projectRef: values.project.trim() } : {}),
706
+ ...(values.name !== undefined ? { label: values.name } : {}),
707
+ accept: values.accept ?? false,
708
+ token: values.token ?? false,
709
+ } } : {}),
538
710
  ...(values.role === "member" || values.role === "admin" ? { role: values.role } : {}),
539
711
  ...(values.yes !== undefined ? { yes: values.yes } : {}),
540
712
  ...(values.repo !== undefined ? { repo: values.repo } : {}),
@@ -550,6 +722,15 @@ export function parseInvocation(argv) {
550
722
  ...(values["api-url"] !== undefined ? { apiUrl: values["api-url"] } : {}),
551
723
  };
552
724
  }
725
+ /** The words after `connectors` that make it the group: none, `list`, or a connect or disconnect. */
726
+ function connectorsShape(rest) {
727
+ return rest.length === 0 || (rest.length === 1 && rest[0] === "list") || rest[0] === "connect" || rest[0] === "disconnect";
728
+ }
729
+ /** Whether the command line is the `sinatra connectors` group, read leniently so a bad option can't hide it. */
730
+ function connectorsInvocation(argv) {
731
+ const [first, ...rest] = parseArgs({ args: argv, allowPositionals: true, strict: false, options: { ...OPTIONS, ...CONNECTOR_OPTIONS } }).positionals;
732
+ return first === "connectors" && connectorsShape(rest);
733
+ }
553
734
  /**
554
735
  * An argument that starts with `-` but holds whitespace, before any `--`: a prompt, not options
555
736
  * (`sinatra "-v is broken"`).
@@ -896,6 +1077,8 @@ export function classifyRefusal(error, context = {}) {
896
1077
  case "invalid_token":
897
1078
  return { kind: context.during === "login" ? "token_rejected_at_login" : "token_invalid" };
898
1079
  case "not_found":
1080
+ if (context.group === "connectors")
1081
+ return { kind: "connectors_unavailable" };
899
1082
  return { kind: context.during ? "task_api_off" : "not_found" };
900
1083
  case "unavailable":
901
1084
  if (typeof error.detail.taskId === "string")
@@ -917,6 +1100,7 @@ export function explain(error, context = {}) {
917
1100
  case "task_api_off":
918
1101
  return "The task API isn't available for this account. Write to contact@sinatra.dev if you think it should be.";
919
1102
  case "not_found": return "No such task or workspace, or you're not a member of it.";
1103
+ case "connectors_unavailable": return "Connectors aren't available for this workspace.";
920
1104
  case "created_not_started":
921
1105
  return `Task ${refusal.taskId} was created but Sinatra couldn't start it yet. Run \`sinatra reply ${refusal.taskId} "go"\` to start it (your prompt goes first).`;
922
1106
  case "message_saved_not_sent":
@@ -930,6 +1114,10 @@ export function explain(error, context = {}) {
930
1114
  "`sinatra connect github` if it isn't yet. To make another workspace, install the Sinatra GitHub App on another " +
931
1115
  "account or organization from the dashboard's Add a workspace.";
932
1116
  }
1117
+ // The connect request keeps no server detail, so say the role rule here rather than the model-key one.
1118
+ if (context.group === "connectors" && refusal.code === "actor_not_authorized") {
1119
+ return "Only workspace owners and admins can connect or disconnect services.";
1120
+ }
933
1121
  // A refusal the server explained itself (delegation's are the dashboard's own words).
934
1122
  if (typeof error.detail.reason === "string")
935
1123
  return printable(error.detail.reason);
@@ -966,6 +1154,14 @@ export function explain(error, context = {}) {
966
1154
  case "not_an_api_task": return "That task wasn't started from the API or CLI, so it has no conversation here; reply where it started.";
967
1155
  case "not_running": return "That task isn't running.";
968
1156
  case "idempotency_conflict": return "That request conflicts with an earlier one; try again.";
1157
+ case "invalid_project_ref": return "That doesn't look like a valid project reference for this service.";
1158
+ case "invalid_label": return "Use a name of up to 64 characters, with no line breaks or invisible characters.";
1159
+ case "invalid_token_value": return "That token can't be used. Paste it exactly as the provider shows it, with no spaces or line breaks.";
1160
+ case "acknowledgement_required": return "The terms for this connection have changed. Run the command again to review them.";
1161
+ case "connector_label_taken": return "This workspace already has a connection with that name. Pass --name to choose another.";
1162
+ case "connector_cap_exceeded": return "This workspace has reached its connection limit, counting sign-ins still in progress. Disconnect one first.";
1163
+ case "connector_not_found": return "No such service. Run `sinatra connectors` to see what can be connected.";
1164
+ case "connection_not_found": return "No such connection. Run `sinatra connectors` to see this workspace's connections.";
969
1165
  default: return `Sinatra refused: ${error.code} (HTTP ${error.status}).`;
970
1166
  }
971
1167
  }
@@ -1054,9 +1250,13 @@ export async function runConnect(client, workspaceId, invocation, deps) {
1054
1250
  const deadline = now() + invocation.timeoutMs;
1055
1251
  while (now() < deadline) {
1056
1252
  const overview = await client.getWorkspace(workspaceId);
1253
+ if (integration === "buzz" && overview.buzz?.status === "pending_owner") {
1254
+ deps.out("Buzz joined. A community owner or admin must link their Buzz account before tasks can start.\n");
1255
+ return;
1256
+ }
1057
1257
  const connected = integration === "telegram"
1058
1258
  ? overview.telegram.connected === true
1059
- : overview[integration].status === "connected" && (integration !== "linear" || overview.linear.needsReconnect === false);
1259
+ : overview[integration]?.status === "connected" && (integration !== "linear" || overview.linear.needsReconnect === false);
1060
1260
  if (connected) {
1061
1261
  deps.out(printable(`${integration} connected.\n`));
1062
1262
  return;
@@ -1067,3 +1267,272 @@ export async function runConnect(client, workspaceId, invocation, deps) {
1067
1267
  }
1068
1268
  throw new UsageError(`Timed out waiting for ${integration} to connect after ${invocation.timeoutMs / 60_000} minutes. Finish authorization in your browser, then check with \`sinatra workspace show\`.`);
1069
1269
  }
1270
+ /** How long, and how often, a sign-in at a terminal watches the list for its connection. */
1271
+ const SIGN_IN_WAIT_MS = 10 * 60_000;
1272
+ const SIGN_IN_POLL_MS = 3_000;
1273
+ /**
1274
+ * What the dashboard and MCP check a connect link's project and name against, copied from
1275
+ * packages/shared/src/lib/connectors/catalog.ts (`reference.pattern`, and the patterns
1276
+ * `looksLikeConnectorCredential` reads): the CLI is published on its own and can't import it. A
1277
+ * test compares the copies. A connector missing here (a newer API's) gets the credential check only.
1278
+ */
1279
+ export const CONNECT_LINK_REFERENCE_PATTERNS = {
1280
+ neon: /^[a-z0-9-]{3,64}$/,
1281
+ supabase: /^[a-z0-9]{20}$/,
1282
+ posthog: /^[0-9]{1,12}$/,
1283
+ sentry: /^[a-z0-9][a-z0-9_-]{0,63}$/,
1284
+ };
1285
+ export const CONNECT_LINK_CREDENTIAL_PATTERNS = [
1286
+ /^napi_/, /^sbp_/, /^phx_/, /^sntry[su]_/, /^pscale_tkn_/, /^cfk_/, /^ntn_/,
1287
+ ];
1288
+ const CONNECTOR_LABEL_MAX_CHARS = 64;
1289
+ const LABEL_FORBIDDEN = /[\p{Cc}\p{Cf}\u2028\u2029]/u;
1290
+ /**
1291
+ * Refuses a `--project` or `--name` that the dashboard would drop from a connect link, or that is
1292
+ * shaped like a credential (it may be a token typed in the wrong place). The value is never repeated.
1293
+ */
1294
+ function checkConnectLinkValues(entry, connection) {
1295
+ const credential = (value) => CONNECT_LINK_CREDENTIAL_PATTERNS.some((pattern) => pattern.test(value.trim()));
1296
+ for (const [flag, value] of [["--project", connection.projectRef], ["--name", connection.label]]) {
1297
+ if (value !== undefined && credential(value)) {
1298
+ throw new UsageError(`That ${flag} looks like a token, so it was not used. Never put a token in a connect link; the provider's sign-in happens in your browser.`);
1299
+ }
1300
+ }
1301
+ const project = connection.projectRef;
1302
+ const pattern = CONNECT_LINK_REFERENCE_PATTERNS[entry.id];
1303
+ if (project && pattern && !pattern.test(project)) {
1304
+ throw new UsageError(printable(`That --project doesn't look like a ${entry.name} ${connectorReference(entry)?.label ?? "project reference"}.`));
1305
+ }
1306
+ const label = connection.label?.trim();
1307
+ if (label !== undefined && (label === "" || [...label].length > CONNECTOR_LABEL_MAX_CHARS || LABEL_FORBIDDEN.test(label))) {
1308
+ throw new UsageError("Use a --name of up to 64 characters, with no line breaks or invisible characters.");
1309
+ }
1310
+ }
1311
+ /** A failed poll worth retrying: a server error, a rate limit, or no answer at all (not a sign-in or config failure). */
1312
+ function pollFailureIsTransient(error) {
1313
+ if (error instanceof ApiError)
1314
+ return error.status >= 500 || error.status === 429;
1315
+ return !(error instanceof SignInError || error instanceof ConfigError || error instanceof UsageError);
1316
+ }
1317
+ /** One shell word: as is when nothing in it needs quoting, otherwise single-quoted. */
1318
+ function shellWord(value) {
1319
+ return /^[A-Za-z0-9._@%+=:,/-]+$/.test(value) ? value : `'${value.replace(/'/g, "'\\''")}'`;
1320
+ }
1321
+ /** The command that signs a connection in again: the same service, reference and name. */
1322
+ function signInAgainCommand(connection) {
1323
+ return `sinatra connectors connect ${shellWord(connection.connector)}${connection.projectRef ? ` --project ${shellWord(connection.projectRef)}` : ""} --name ${shellWord(connection.label)}`;
1324
+ }
1325
+ /** The reference `entry` takes, read from either API shape; null when it takes none. */
1326
+ function connectorReference(entry) {
1327
+ if (entry.reference !== undefined)
1328
+ return entry.reference;
1329
+ return entry.projectRefLabel ? { label: entry.projectRefLabel, required: true } : null;
1330
+ }
1331
+ function connectionLine(connection, projectRefLabel) {
1332
+ const readOnly = connection.grantLabel === "enforced"
1333
+ ? `read-only, enforced by ${connection.name}`
1334
+ : connection.grantLabel === "token_decides" ? "may be able to make changes" : "read-only not guaranteed";
1335
+ return [
1336
+ `${connection.name} · ${connection.label}`,
1337
+ ...(connection.projectRef ? [`${projectRefLabel} ${connection.projectRef}`] : []),
1338
+ readOnly,
1339
+ ...(connection.status === "needs_reconnect"
1340
+ ? [`needs sign-in again (run: ${signInAgainCommand(connection)})`]
1341
+ : connection.status !== "active" ? [connection.status] : []),
1342
+ ...(connection.connectedByName ? [`connected by ${connection.connectedByName}`] : []),
1343
+ // Disconnect takes the id, so the list has to show it.
1344
+ `(connection ${connection.id})`,
1345
+ ].join(" ");
1346
+ }
1347
+ /**
1348
+ * `sinatra connectors` (unlisted). A token is read only through the hidden reader and sent only
1349
+ * in the connect request's body, through the client path that keeps no server detail.
1350
+ */
1351
+ export async function runConnectors(client, workspaceId, inv, deps) {
1352
+ const { command } = inv;
1353
+ const emit = (value) => deps.out(`${JSON.stringify(value, null, 2)}\n`);
1354
+ // Writes are for owners and admins: refuse anyone else before showing terms or asking for a token.
1355
+ const requireAdmin = async () => {
1356
+ const { role } = await client.getWorkspace(workspaceId);
1357
+ if (role !== "owner" && role !== "admin")
1358
+ throw new ApiError(403, "actor_not_authorized");
1359
+ };
1360
+ /** The service being connected, once the catalog has named it. */
1361
+ let listedName;
1362
+ /**
1363
+ * Signing in, and accepting the warning, happen in a person's browser: the CLI only hands over
1364
+ * the dashboard link that opens the dialog filled in. At a terminal it opens the link and watches
1365
+ * the list for the new connection; otherwise it prints the link and returns.
1366
+ */
1367
+ const signInByLink = async (entry, connection, before) => {
1368
+ if (!entry.connectUrl)
1369
+ throw new UsageError(printable(`Sign in to ${entry.name} from the Connectors page of your Sinatra dashboard.`));
1370
+ const url = new URL(entry.connectUrl);
1371
+ if (url.protocol !== "https:" && url.protocol !== "http:")
1372
+ throw new UsageError("Sinatra returned an invalid connect link.");
1373
+ if (connection.projectRef !== undefined)
1374
+ url.searchParams.set("project", connection.projectRef);
1375
+ if (connection.label !== undefined)
1376
+ url.searchParams.set("name", connection.label);
1377
+ url.searchParams.set("method", "oauth");
1378
+ const link = url.toString();
1379
+ if (inv.json || !deps.interactive) {
1380
+ return emit({
1381
+ connector: entry.id,
1382
+ url: link,
1383
+ next: `Have a workspace admin or owner open this link in a browser, sign in to ${entry.name} and accept the warning there. Then run \`sinatra connectors -w ${workspaceId} --json\` to check that the connection appears.`,
1384
+ });
1385
+ }
1386
+ deps.out(printable(`${entry.name}'s warning and sign-in happen in your browser:\n${link}\n`));
1387
+ await deps.openBrowser?.(link).catch(() => false);
1388
+ // Only the caller's own new connection counts: another admin may connect the same service meanwhile.
1389
+ const { user } = await client.me();
1390
+ const known = new Set(before);
1391
+ const now = deps.now ?? Date.now;
1392
+ const sleep = deps.sleep ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
1393
+ const deadline = now() + SIGN_IN_WAIT_MS;
1394
+ while (now() < deadline) {
1395
+ await sleep(Math.min(SIGN_IN_POLL_MS, deadline - now()));
1396
+ let connections;
1397
+ try {
1398
+ ({ connections } = await client.listConnectors(workspaceId));
1399
+ }
1400
+ catch (error) {
1401
+ // A dropped connection, a server error or a rate limit is not an answer: keep watching until the deadline.
1402
+ // Anything else (signed out, no access, connectors off) ends the wait with its own message.
1403
+ if (pollFailureIsTransient(error))
1404
+ continue;
1405
+ throw error;
1406
+ }
1407
+ const added = connections.find((row) => row.connector === entry.id && row.status === "active" && row.connectedByUserId === user.id && !known.has(row.id));
1408
+ if (added) {
1409
+ deps.out(printable(`Connected ${added.name} (${added.label}). Agents can use it on their next run.\n`));
1410
+ return;
1411
+ }
1412
+ }
1413
+ throw new UsageError("Nothing was connected yet. `sinatra connectors` shows the connection once it is.");
1414
+ };
1415
+ try {
1416
+ if (command.action === "list") {
1417
+ const result = await client.listConnectors(workspaceId);
1418
+ if (inv.json)
1419
+ return emit(result);
1420
+ if (result.connections.length === 0)
1421
+ deps.out("Nothing connected.\n");
1422
+ for (const connection of result.connections) {
1423
+ const entry = result.catalog.find((row) => row.id === connection.connector);
1424
+ const label = (entry && connectorReference(entry)?.label) ?? "Project";
1425
+ deps.out(printable(`${connectionLine(connection, label)}\n`));
1426
+ }
1427
+ if (result.catalog.length > 0)
1428
+ deps.out(printable(`Available: ${result.catalog.map((entry) => entry.id).join(", ")}\n`));
1429
+ return;
1430
+ }
1431
+ if (command.action === "disconnect") {
1432
+ await requireAdmin();
1433
+ await confirmWorkspaceMutation(command, { yes: inv.yes ?? false, interactive: deps.interactive, workspaceId, ask: deps.ask });
1434
+ const result = await client.disconnectConnector(workspaceId, command.connectionId);
1435
+ if (inv.json)
1436
+ return emit(result);
1437
+ deps.out("Disconnected.\n");
1438
+ if (result.providerRevocation === "revoked")
1439
+ deps.out("Sinatra's access was revoked at the provider.\n");
1440
+ else if (result.providerRevocation === "failed") {
1441
+ deps.out("Sinatra could not revoke its access at the provider. Remove Sinatra in your account settings there.\n");
1442
+ }
1443
+ else if (result.revokeAtProvider)
1444
+ deps.out("The token still works at the provider until you revoke it there.\n");
1445
+ // What the provider still lists after a sign-in is gone, and where to remove it.
1446
+ if (result.leftAtProvider)
1447
+ deps.out(printable(`${result.leftAtProvider}\n`));
1448
+ return;
1449
+ }
1450
+ const connection = inv.connection;
1451
+ if (!connection)
1452
+ throw new UsageError(CONNECTORS_USAGE);
1453
+ const listed = await client.listConnectors(workspaceId);
1454
+ // Off for this workspace or caller, the list still answers while connections remain: nothing can be connected.
1455
+ if (!listed.enabled)
1456
+ throw new ApiError(404, "not_found");
1457
+ const entry = listed.catalog.find((row) => row.id === command.connector);
1458
+ if (!entry)
1459
+ throw new ApiError(404, "connector_not_found");
1460
+ listedName = entry.name;
1461
+ const reference = connectorReference(entry);
1462
+ if (!reference && connection.projectRef !== undefined) {
1463
+ throw new UsageError(printable(`${entry.name} takes no project reference, so leave out --project. ${CONNECTORS_USAGE}`));
1464
+ }
1465
+ const offersSignIn = entry.methods.includes("oauth");
1466
+ const takesToken = entry.methods.includes("token");
1467
+ if ((connection.token || connection.accept) && !takesToken) {
1468
+ const flags = [connection.token ? "--token" : "", connection.accept ? "--accept" : ""].filter(Boolean).join(" and ");
1469
+ throw new UsageError(printable(`${entry.name} connects only by signing in, in the browser: leave out ${flags}.`));
1470
+ }
1471
+ // Signing in is the default only when nothing asks for a token: `--accept` keeps pasting one, as
1472
+ // it did before sign-in existed (`echo "$KEY" | sinatra connectors connect neon --project p --accept`).
1473
+ if (offersSignIn && !connection.token && !connection.accept) {
1474
+ checkConnectLinkValues(entry, connection);
1475
+ // As with a token: refuse anyone but an owner or admin before handing over a link or waiting.
1476
+ await requireAdmin();
1477
+ return await signInByLink(entry, connection, listed.connections.map((row) => row.id));
1478
+ }
1479
+ if (reference?.required && connection.projectRef === undefined) {
1480
+ throw new UsageError(printable(`Connecting ${entry.name} requires --project <ref>: its ${reference.label}.`));
1481
+ }
1482
+ await requireAdmin();
1483
+ // An API from before sign-in sends only `acknowledgement`, which is the token's.
1484
+ const acknowledgement = entry.acknowledgements?.token ?? entry.acknowledgement;
1485
+ const { warning, confirmations } = acknowledgement;
1486
+ if (warning) {
1487
+ deps.notice(printable(`${warning.title}\n${warning.body}\n${warning.items.map((item) => ` - ${item}\n`).join("")}\n`));
1488
+ }
1489
+ deps.notice(printable(`${acknowledgement.text}\n\n`));
1490
+ // The acknowledgement already ends with the provider's guidance; say it only if it ever doesn't.
1491
+ if (!acknowledgement.text.includes(entry.providerGuidance))
1492
+ deps.notice(printable(`${entry.providerGuidance}\n\n`));
1493
+ if (confirmations?.length) {
1494
+ deps.notice(printable(`By accepting, you confirm:\n${confirmations.map((line) => ` - ${line}\n`).join("")}\n`));
1495
+ }
1496
+ if (!connection.accept) {
1497
+ if (!deps.interactive)
1498
+ throw new UsageError("Connecting needs your acceptance of the text above. Run at a terminal or pass --accept.");
1499
+ const answer = await deps.ask(printable(`Accept and connect ${entry.name}? [y/N] `));
1500
+ if (!/^(y|yes)$/i.test(answer.trim()))
1501
+ throw new UsageError("Cancelled. Nothing changed.");
1502
+ }
1503
+ deps.notice(printable(`${entry.tokenHelp}\n${entry.tokenHelpUrl}\n`));
1504
+ let token;
1505
+ try {
1506
+ token = (await deps.askSecret(printable(`${entry.name} token (hidden): `))).trim();
1507
+ }
1508
+ catch {
1509
+ throw new UsageError("Couldn't read the token. Paste it at the hidden prompt or pipe it on stdin.");
1510
+ }
1511
+ if (!token)
1512
+ throw new UsageError("No token supplied. Nothing changed.");
1513
+ const connected = await client.connectConnector(workspaceId, {
1514
+ connector: entry.id,
1515
+ ...(connection.projectRef !== undefined ? { projectRef: connection.projectRef } : {}),
1516
+ ...(connection.label !== undefined ? { label: connection.label } : {}),
1517
+ token,
1518
+ // The version of the text just shown, so the server refuses if it has changed since.
1519
+ acknowledgementVersion: acknowledgement.version,
1520
+ // The confirmations just printed and accepted. An API that sends none refuses the field.
1521
+ ...(confirmations?.length ? { confirmations } : {}),
1522
+ });
1523
+ if (inv.json)
1524
+ return emit(connected);
1525
+ deps.out(printable(`Connected ${connected.name} (${connected.label}). Agents can use it on their next run.\n`));
1526
+ }
1527
+ catch (error) {
1528
+ // With no --name, the default name is the one that collided.
1529
+ if (error instanceof ApiError && error.code === "connector_label_taken" && command.action === "connect" && inv.connection?.label === undefined) {
1530
+ const name = listedName ?? "service";
1531
+ throw new UsageError(printable(`This workspace already has an unnamed ${name} connection. Give this one a name.`));
1532
+ }
1533
+ // The group's own wording, so a gated workspace isn't reported as a missing task.
1534
+ if (error instanceof ApiError)
1535
+ throw new UsageError(explain(error, { group: "connectors" }));
1536
+ throw error;
1537
+ }
1538
+ }
package/dist/index.js CHANGED
@@ -10,7 +10,7 @@
10
10
  * sinatra tasks | show <task> | stop <task> | whoami | workspace [id] | logout
11
11
  */
12
12
  import { ApiError, createClient } from "./client.js";
13
- import { addWorkspaceModelKey, confirmWorkspaceMutation, explain, login, loginMode, logout, parseInvocation, printable, removeWorkspaceModelKey, repoChoices, revokeSavedToken, runBilling, runConnect, runRepo, runWorkspaceCreate, startTask, subscriptions, UsageError, } from "./commands.js";
13
+ import { addWorkspaceModelKey, confirmWorkspaceMutation, explain, login, loginMode, logout, parseInvocation, printable, removeWorkspaceModelKey, repoChoices, revokeSavedToken, runBilling, runConnect, runConnectors, runRepo, runWorkspaceCreate, startTask, subscriptions, USAGE, UsageError, } from "./commands.js";
14
14
  import { ConfigError, DEFAULT_API_URL, deleteConfig, readConfig, withConfigLock, writeConfig } from "./config.js";
15
15
  import { AttachmentError, composePrompt, detectRepos, readAttachments } from "./context.js";
16
16
  import { EXIT, followOutcome, followTask } from "./follow.js";
@@ -18,127 +18,6 @@ import { browserSignIn, openBrowser, revokeSignIn, SignInError } from "./oauth.j
18
18
  import { ask, askSecret } from "./prompt.js";
19
19
  import { credentialsFor } from "./session.js";
20
20
  import { CLI_VERSION } from "./version.js";
21
- const USAGE = `Usage:
22
- sinatra login [--api-url <url>] [-w <id>] [--no-browser | --token]
23
- Sign in through your browser (-w: the default workspace)
24
- --no-browser Print the sign-in URL instead of opening it (the browser
25
- must still be on this computer)
26
- --token Paste a personal access token instead (also when stdin
27
- is piped: sinatra login < token-file)
28
- sinatra [start] "<what to do>" Start a task and follow it
29
- -r, --repo <owner/name> Repository (default: this checkout's GitHub remote)
30
- -f, --file <path> Attach a text file (repeatable, 80KB total)
31
- -t, --title <title> Task title (default: the prompt's first line)
32
- -m, --model <model> Model for every agent, such as openai-codex/gpt-6.1-sol
33
- (default: the repository's or workspace's model)
34
- --timeout <minutes> Stop following after this long (default 30)
35
- --no-wait Start it and return
36
- --json With --no-wait: print the started task as JSON
37
- sinatra reply <task-id> "<message>" Follow up on a task, then follow it
38
- (takes -f, --timeout, --no-wait, --json like start)
39
- sinatra show <task-id> [--json] Print a task and its conversation
40
- sinatra tasks [--status <status>] [-n, --limit <n>] [--json]
41
- List the workspace's recent tasks (20 unless -n)
42
- sinatra stop <task-id> Stop a task's running agent
43
- sinatra tickets [-q <text>] [-r <owner/name>] [--json]
44
- Open Linear and GitHub issues you could delegate: yours,
45
- then the team's unassigned (-q: search, -r: repo first)
46
- sinatra delegate <ticket> Hand Sinatra a Linear or GitHub issue as you: ENG-123,
47
- owner/name#12, or the issue's URL
48
- sinatra subscriptions [list] [--json] List your subscription connections in this workspace
49
- sinatra subscriptions connect <codex|claude|xai|cursor> [--json] [--no-browser]
50
- Print the verification URL/code and open your browser;
51
- wait up to 15 minutes for device approval. Claude asks
52
- for a hidden authorization code (or reads it from stdin).
53
- Never pass an authorization code on the command line.
54
- With --json, handoff and prompts go to stderr.
55
- sinatra subscriptions remove <id> [--json]
56
- Remove one of your subscription connections
57
- sinatra whoami [--json] Who you're logged in as, and your workspaces
58
- sinatra account [--json] Your account, memberships and linked identities
59
- sinatra email-preferences [--json] Read your email preferences
60
- --setup-reminders <on|off> Change setup reminder emails
61
- --task-alerts <on|off> Change task alert emails (omitted flags stay unchanged)
62
- sinatra workspace [<id>] List your workspaces, or make one the default
63
- sinatra repos [-w <id>] [--json] List the workspace's accessible repositories
64
- sinatra repo <owner/name> config Read effective repository config and provenance
65
- sinatra repo <owner/name> config preflight --file <json>
66
- Preflight a draft override fragment from a JSON file
67
- sinatra repo <owner/name> override set --file <json>
68
- Save your repository override fragment
69
- sinatra repo <owner/name> override clear [--yes]
70
- Clear your override (confirmation required)
71
- sinatra repo <owner/name> secrets [list]
72
- List secret metadata, never plaintext values
73
- sinatra repo <owner/name> secrets set <name> --host <host>
74
- sinatra repo <owner/name> secrets rotate <name>
75
- Read a value at a hidden prompt or from stdin;
76
- never pass secret values in arguments or flags
77
- sinatra repo <owner/name> secrets update <name>
78
- PATCH metadata without changing the secret value
79
- --host <host> Allowed host (repeatable; replaces hosts on update)
80
- --header <header> --prefix <prefix> Optional proxy metadata for set, rotate or update
81
- --capability-request <id> Fulfill a capability request with set or rotate
82
- sinatra repo <owner/name> secrets delete <name> [--yes]
83
- Delete a secret (confirmation required)
84
- sinatra repo <owner/name> env Read the feature-gated repository environment
85
- sinatra repo <owner/name> capability-requests
86
- Read repository capability requests
87
- sinatra repo <owner/name> review-external-prs [inherit|on|off]
88
- Read or set external PR reviews (writes: owner/admin)
89
- All repos/repo commands take -w and --json
90
- sinatra model [get] [--json] Show the workspace's saved default (members)
91
- sinatra model set <model> --engine <engine> [--effort <effort>]
92
- Save a catalog engine/model/effort pairing (owner only)
93
- sinatra model clear [--yes] Restore automatic selection (owner only; confirmation required)
94
- sinatra keys [list] [--json] List configured providers, never key values (members)
95
- sinatra keys add <anthropic|openrouter> Paste a key at a hidden prompt, or pipe stdin
96
- sinatra keys remove <anthropic|openrouter> [--yes]
97
- Remove a key (owners/admins; confirmation required)
98
- Model and keys commands take -w and --json
99
- sinatra billing [-w <id>] [--json] Show plan, capacity and subscription status
100
- sinatra billing upgrade --plan <pro|team|scale> [-w <id>] [--json]
101
- Open checkout (workspace owner only)
102
- sinatra billing portal [-w <id>] [--json]
103
- Open billing management (workspace owner only)
104
- sinatra connect <github|linear|slack|telegram> [-w <id>] [--timeout <minutes>] [--json]
105
- Print the authorization URL, open your browser and wait
106
- for connection (--json returns only the URL response)
107
- Browser commands always print the URL; --json returns
108
- only the response without opening a browser
109
- sinatra members list [--json] List members, pending invites and access requests
110
- sinatra invite <email> --role <role> Invite a member or admin
111
- sinatra invite resend <invite-id> Resend an invitation
112
- sinatra invite revoke <invite-id> Revoke an invitation (confirmation required)
113
- sinatra requests approve <request-id> --role <role>
114
- sinatra requests deny <request-id> Resolve an access request
115
- sinatra members role <membership-id> --role <role>
116
- sinatra members remove <membership-id> Remove a member (confirmation required)
117
- sinatra members transfer <membership-id>
118
- Transfer ownership (confirmation required)
119
- sinatra workspace leave Leave the workspace (confirmation required)
120
- --role <member|admin> Role to grant; owner is never a grantable role
121
- --yes, -y Skip confirmation for destructive access actions, model clear,
122
- keys remove, repo override clear or repo secrets delete;
123
- never pass keys or secret values in argv
124
- Access commands take -w and --json; owner-only except leave
125
- sinatra workspace create "<name>" [--json]
126
- Create a workspace you own (one per person without
127
- GitHub); the first becomes your default
128
- sinatra workspace show [-w <id>] [--json]
129
- Read repositories, integrations, plan and default model
130
- sinatra workspace review-external-prs [on|off] [-w <id>] [--json]
131
- Read or set external PR reviews (writes: owner/admin)
132
- sinatra logout Revoke the saved sign-in or token and forget it
133
- sinatra -v, --version Print the CLI's version
134
-
135
- -w, --workspace <id> Workspace for task, access, subscription, workspace settings,
136
- model, keys, repos, repo or billing commands, or default to save at login
137
- (default: yours from login or \`sinatra workspace\`)
138
- Account and email preferences need no workspace membership or default workspace.
139
-
140
- Exit codes: 0 done, 1 error, 2 the task failed, was cancelled or is paused,
141
- 3 still working (or your reply not picked up yet) when the CLI stopped waiting.`;
142
21
  /** How a follow ended, for a task that stopped rather than waiting on you. */
143
22
  const ENDINGS = {
144
23
  completed: "Task completed.",
@@ -477,6 +356,16 @@ async function main(argv) {
477
356
  case "connect":
478
357
  await runConnect(client, workspaceOf(config, inv.workspace), { ...inv, command }, { out, openBrowser });
479
358
  return;
359
+ case "connectors":
360
+ await runConnectors(client, workspaceOf(config, inv.workspace), { ...inv, command }, {
361
+ out,
362
+ notice: (text) => { process.stderr.write(text); },
363
+ ask: (question) => ask(question, process.stdin, process.stderr),
364
+ askSecret: (question) => askSecret(question, process.stdin, process.stderr, "value"),
365
+ interactive: Boolean(process.stdin.isTTY && process.stderr.isTTY),
366
+ openBrowser,
367
+ });
368
+ return;
480
369
  case "whoami": {
481
370
  const me = await whoAmI(client, config.apiUrl, "me");
482
371
  if (inv.json)
@@ -526,12 +415,16 @@ async function main(argv) {
526
415
  const workspace = await client.getWorkspace(workspaceOf(config, inv.workspace));
527
416
  if (inv.json)
528
417
  return printJson(workspace);
529
- const { github, linear, slack, telegram, planStatus, defaultModel } = workspace;
418
+ const { github, linear, slack, telegram, buzz, planStatus, defaultModel } = workspace;
530
419
  out(printable(`${workspace.name} (${workspace.id})\nRole: ${workspace.role}\n`));
531
420
  out(printable(`GitHub: ${github.status}${github.accountLogin ? ` (${github.accountLogin})` : ""}\n`));
532
421
  out(printable(`Linear: ${linear.status}${linear.organizationName ? ` (${linear.organizationName})` : ""}\n`));
533
422
  out(printable(`Slack: ${slack.available ? slack.status : "unavailable"}${slack.teamName ? ` (${slack.teamName})` : ""}\n`));
534
423
  out(`Telegram: ${!telegram.available ? "unavailable" : telegram.enabled ? "enabled" : "disabled"}\n`);
424
+ if (buzz?.available)
425
+ out(printable(`Buzz: ${buzz.status ?? "not connected"}${buzz.host ? ` (${buzz.host})` : ""}\n`));
426
+ if (workspace.connectors?.available)
427
+ out("Connectors: available\n");
535
428
  out(printable(`Plan: ${planStatus.capacity?.plan ?? planStatus.plan}${planStatus.subscription ? ` (${planStatus.subscription.status})` : ""}\n`));
536
429
  if (planStatus.capacity)
537
430
  out(`Capacity limits: ${planStatus.capacity.running} running, ${planStatus.capacity.queued} queued\n`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sinatra.dev",
3
- "version": "0.4.0",
3
+ "version": "0.5.1",
4
4
  "description": "Hand coding tasks to Sinatra from your terminal.",
5
5
  "keywords": [
6
6
  "sinatra",