sinatra.dev 0.3.0 → 0.3.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/dist/commands.js CHANGED
@@ -246,8 +246,9 @@ export function repoChoices(named, detected) {
246
246
  * Starts the task on the first repository the workspace accepts, and says which that was. One
247
247
  * the person named is never second-guessed: its refusal is the answer. Detected ones are tried in
248
248
  * order (a fork's `origin`, then the `upstream` it came from), and when none is connected the
249
- * agent picks, which is said first. Every attempt is its own request with its own idempotency
250
- * key: the server refuses an unconnected repository before creating anything.
249
+ * agent picks, which is said first. In a workspace without GitHub no detected repository can be
250
+ * connected, so the task goes ahead without one. Every attempt is its own request with its own
251
+ * idempotency key: the server refuses an unconnected repository before creating anything.
251
252
  */
252
253
  export async function startTask(client, workspaceId, body, repos, notice) {
253
254
  const label = (repo) => (repo.explicit ? repo.name : `${repo.name} (this checkout's ${repo.remote} remote)`);
@@ -256,7 +257,14 @@ export async function startTask(client, workspaceId, body, repos, notice) {
256
257
  return { started: await client.startTask(workspaceId, { ...body, repo: repo.name }), repo };
257
258
  }
258
259
  catch (error) {
259
- if (repo.explicit || !(error instanceof ApiError && error.code === "invalid_repo"))
260
+ if (repo.explicit || !(error instanceof ApiError))
261
+ throw error;
262
+ if (error.code === "github_not_connected" && error.detail.refusal === "missing") {
263
+ notice("This workspace isn't connected to GitHub, so Sinatra will answer without a repository. " +
264
+ "Connect GitHub on the dashboard to have it change code.");
265
+ break;
266
+ }
267
+ if (error.code !== "invalid_repo")
260
268
  throw error;
261
269
  const next = repos[i + 1];
262
270
  notice(next
@@ -303,7 +311,7 @@ export async function login(deps) {
303
311
  ...(signedIn.oauth ? { oauth: signedIn.oauth } : {}),
304
312
  ...(workspaceId ? { workspaceId } : {}),
305
313
  });
306
- const name = me.user.githubLogin ? `@${me.user.githubLogin}` : me.user.name ?? me.user.id;
314
+ const name = me.user.githubLogin ? `@${me.user.githubLogin}` : me.user.email;
307
315
  const workspace = me.workspaces.find((w) => w.id === workspaceId)?.name;
308
316
  out(printable(`Logged in as ${name}${workspace ? `, workspace ${workspace}` : ""}.\n`));
309
317
  }
package/dist/index.js CHANGED
@@ -239,7 +239,7 @@ async function main(argv) {
239
239
  const me = await whoAmI(client, config.apiUrl, "me");
240
240
  if (inv.json)
241
241
  return printJson({ ...me, defaultWorkspaceId: config.workspaceId ?? null });
242
- out(printable(`${me.user.githubLogin ? `@${me.user.githubLogin}` : me.user.id}\n`));
242
+ out(printable(`${me.user.githubLogin ? `@${me.user.githubLogin}` : me.user.email}\n`));
243
243
  for (const w of me.workspaces) {
244
244
  out(printable(` ${w.id === config.workspaceId ? "*" : " "} ${w.name} (${w.id}, ${w.role})\n`));
245
245
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sinatra.dev",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Hand coding tasks to Sinatra from your terminal.",
5
5
  "keywords": [
6
6
  "sinatra",