ref0-git 0.2.0 → 0.4.0

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.
Files changed (210) hide show
  1. package/app/apps/github/.dev.vars.example +2 -1
  2. package/app/apps/github/generated/git-rest.ts +191 -25
  3. package/app/apps/github/generated/routeTree.gen.ts +21 -0
  4. package/app/apps/github/package.json +1 -1
  5. package/app/apps/github/src/branches/branch-list.tsx +8 -4
  6. package/app/apps/github/src/branches/branches.ts +10 -5
  7. package/app/apps/github/src/camo/addresses.ts +120 -0
  8. package/app/apps/github/src/camo/client.ts +125 -0
  9. package/app/apps/github/src/camo/fetch.ts +201 -0
  10. package/app/apps/github/src/camo/lookup.ts +23 -0
  11. package/app/apps/github/src/camo/node.ts +50 -0
  12. package/app/apps/github/src/camo/proxy.ts +116 -0
  13. package/app/apps/github/src/camo/sign-images.ts +307 -0
  14. package/app/apps/github/src/camo/signing.ts +80 -0
  15. package/app/apps/github/src/clients/allowed.ts +111 -18
  16. package/app/apps/github/src/clients/clients.ts +76 -61
  17. package/app/apps/github/src/clients/transport.ts +13 -0
  18. package/app/apps/github/src/code/code-tree.tsx +3 -1
  19. package/app/apps/github/src/code/file-view.tsx +15 -6
  20. package/app/apps/github/src/code/files.ts +26 -19
  21. package/app/apps/github/src/code/go-to-file.tsx +2 -1
  22. package/app/apps/github/src/code/load.ts +41 -23
  23. package/app/apps/github/src/code/markdown-files.ts +13 -2
  24. package/app/apps/github/src/code/ref-pages.ts +14 -5
  25. package/app/apps/github/src/code/ref-switcher.tsx +4 -3
  26. package/app/apps/github/src/code/refs.ts +42 -8
  27. package/app/apps/github/src/code/repo-home.tsx +6 -2
  28. package/app/apps/github/src/code/repo.ts +12 -6
  29. package/app/apps/github/src/code/saved.ts +5 -3
  30. package/app/apps/github/src/code/trees.ts +11 -9
  31. package/app/apps/github/src/components/markdown/markdown.css +6 -0
  32. package/app/apps/github/src/components/markdown/markdown.tsx +95 -10
  33. package/app/apps/github/src/components/owner-card.tsx +3 -1
  34. package/app/apps/github/src/components/repos/your-repos.tsx +3 -1
  35. package/app/apps/github/src/components/shell/owner-repos.tsx +7 -12
  36. package/app/apps/github/src/components/shell/repo-switcher.tsx +10 -16
  37. package/app/apps/github/src/components/signin/device-card.tsx +9 -2
  38. package/app/apps/github/src/components/user-avatar.tsx +2 -1
  39. package/app/apps/github/src/context/context.ts +13 -0
  40. package/app/apps/github/src/diffs/blobs.ts +37 -14
  41. package/app/apps/github/src/diffs/diff-job.ts +53 -0
  42. package/app/apps/github/src/diffs/diff-worker.ts +6 -0
  43. package/app/apps/github/src/diffs/diffing.ts +136 -0
  44. package/app/apps/github/src/diffs/files.ts +4 -3
  45. package/app/apps/github/src/diffs/hunks.tsx +101 -53
  46. package/app/apps/github/src/diffs/patch.ts +20 -11
  47. package/app/apps/github/src/history/commit-diff.ts +10 -5
  48. package/app/apps/github/src/history/commit-list.tsx +3 -1
  49. package/app/apps/github/src/history/commit-page.tsx +4 -2
  50. package/app/apps/github/src/history/history.ts +12 -10
  51. package/app/apps/github/src/hooks/allowed.ts +9 -9
  52. package/app/apps/github/src/hooks/avatars.ts +3 -3
  53. package/app/apps/github/src/hooks/open-counts.ts +5 -4
  54. package/app/apps/github/src/hooks/profiles.ts +26 -12
  55. package/app/apps/github/src/hooks/repos.ts +78 -25
  56. package/app/apps/github/src/inbox/count.ts +30 -29
  57. package/app/apps/github/src/inbox/inbox-item.tsx +3 -1
  58. package/app/apps/github/src/inbox/inbox-page.tsx +5 -2
  59. package/app/apps/github/src/inbox/marks.ts +26 -15
  60. package/app/apps/github/src/inbox/release-tags.ts +7 -6
  61. package/app/apps/github/src/inbox/subjects.ts +5 -4
  62. package/app/apps/github/src/inbox/subscription-controls.tsx +14 -5
  63. package/app/apps/github/src/inbox/subscriptions.ts +95 -35
  64. package/app/apps/github/src/inbox/threads.ts +6 -6
  65. package/app/apps/github/src/issues/changes.ts +40 -16
  66. package/app/apps/github/src/issues/counts.ts +8 -5
  67. package/app/apps/github/src/issues/issue-list.tsx +20 -6
  68. package/app/apps/github/src/issues/issue-page.tsx +30 -14
  69. package/app/apps/github/src/issues/issues.ts +195 -46
  70. package/app/apps/github/src/issues/label-dialog.tsx +8 -11
  71. package/app/apps/github/src/issues/labels-page.tsx +35 -3
  72. package/app/apps/github/src/issues/milestone-dialog.tsx +197 -0
  73. package/app/apps/github/src/issues/milestones-page.tsx +269 -0
  74. package/app/apps/github/src/issues/new-issue.tsx +3 -1
  75. package/app/apps/github/src/issues/sidebar.tsx +8 -6
  76. package/app/apps/github/src/markdown/README.md +22 -17
  77. package/app/apps/github/src/markdown/context.ts +83 -10
  78. package/app/apps/github/src/markdown/images.ts +3 -2
  79. package/app/apps/github/src/markdown/lookup.ts +17 -11
  80. package/app/apps/github/src/markdown/page-budget.ts +50 -0
  81. package/app/apps/github/src/markdown/patches.ts +74 -32
  82. package/app/apps/github/src/markdown/query.ts +7 -2
  83. package/app/apps/github/src/markdown/remote.ts +106 -0
  84. package/app/apps/github/src/markdown/render.ts +101 -24
  85. package/app/apps/github/src/markdown/texts.ts +43 -0
  86. package/app/apps/github/src/markdown/words-module.d.ts +5 -0
  87. package/app/apps/github/src/markdown/words-plugin.ts +135 -0
  88. package/app/apps/github/src/names/repos.ts +1 -1
  89. package/app/apps/github/src/palette/palette.tsx +28 -10
  90. package/app/apps/github/src/palette/rows.tsx +93 -40
  91. package/app/apps/github/src/palette/server.ts +10 -7
  92. package/app/apps/github/src/palette/targets.ts +1 -0
  93. package/app/apps/github/src/policy.ts +137 -61
  94. package/app/apps/github/src/private-repos.ts +5 -5
  95. package/app/apps/github/src/pulls/compare-page.tsx +6 -3
  96. package/app/apps/github/src/pulls/files-tab.tsx +480 -214
  97. package/app/apps/github/src/pulls/held-summary.ts +178 -0
  98. package/app/apps/github/src/pulls/live.ts +6 -4
  99. package/app/apps/github/src/pulls/merge-box.tsx +17 -10
  100. package/app/apps/github/src/pulls/pull-list.tsx +6 -3
  101. package/app/apps/github/src/pulls/pull-page.tsx +19 -10
  102. package/app/apps/github/src/pulls/pull.ts +68 -40
  103. package/app/apps/github/src/pulls/pulls.ts +39 -22
  104. package/app/apps/github/src/pulls/review-drafts.ts +131 -0
  105. package/app/apps/github/src/pulls/review.ts +374 -99
  106. package/app/apps/github/src/pulls/threads.tsx +152 -0
  107. package/app/apps/github/src/queue/queue-page.tsx +15 -8
  108. package/app/apps/github/src/queue/queue.ts +35 -20
  109. package/app/apps/github/src/releases/latest-release.tsx +3 -1
  110. package/app/apps/github/src/releases/overview.tsx +4 -2
  111. package/app/apps/github/src/releases/release-form.tsx +8 -5
  112. package/app/apps/github/src/releases/release-list.tsx +8 -5
  113. package/app/apps/github/src/releases/release-view.tsx +1 -0
  114. package/app/apps/github/src/releases/releases.ts +33 -23
  115. package/app/apps/github/src/releases/tag-list.tsx +3 -1
  116. package/app/apps/github/src/router.tsx +5 -2
  117. package/app/apps/github/src/routes/$owner/$repo/_code/blob/$.tsx +7 -1
  118. package/app/apps/github/src/routes/$owner/$repo/_code/tree/$.tsx +6 -1
  119. package/app/apps/github/src/routes/$owner/$repo/_releases/releases/index.tsx +2 -1
  120. package/app/apps/github/src/routes/$owner/$repo/_releases/tags.tsx +1 -1
  121. package/app/apps/github/src/routes/$owner/$repo/branches.tsx +5 -1
  122. package/app/apps/github/src/routes/$owner/$repo/commit/$sha.tsx +1 -1
  123. package/app/apps/github/src/routes/$owner/$repo/commits/$.tsx +6 -1
  124. package/app/apps/github/src/routes/$owner/$repo/index.tsx +1 -1
  125. package/app/apps/github/src/routes/$owner/$repo/issues/$number.tsx +4 -2
  126. package/app/apps/github/src/routes/$owner/$repo/issues/index.tsx +2 -2
  127. package/app/apps/github/src/routes/$owner/$repo/issues/new.tsx +5 -2
  128. package/app/apps/github/src/routes/$owner/$repo/labels.tsx +2 -1
  129. package/app/apps/github/src/routes/$owner/$repo/milestones.tsx +36 -0
  130. package/app/apps/github/src/routes/$owner/$repo/pull/$number/route.tsx +4 -2
  131. package/app/apps/github/src/routes/$owner/$repo/pulls/index.tsx +2 -2
  132. package/app/apps/github/src/routes/$owner/$repo/queue.tsx +2 -1
  133. package/app/apps/github/src/routes/$owner/$repo/releases/edit/$.tsx +5 -2
  134. package/app/apps/github/src/routes/$owner/$repo/releases/new.tsx +2 -1
  135. package/app/apps/github/src/routes/$owner/$repo/releases/tag/$.tsx +4 -2
  136. package/app/apps/github/src/routes/$owner/$repo/route.tsx +9 -5
  137. package/app/apps/github/src/routes/$owner/$repo/settings/hooks/index.tsx +3 -1
  138. package/app/apps/github/src/routes/$owner/$repo/settings/index.tsx +3 -1
  139. package/app/apps/github/src/routes/-nav.tsx +10 -2
  140. package/app/apps/github/src/routes/-root-testing.ts +29 -6
  141. package/app/apps/github/src/routes/__root.tsx +9 -4
  142. package/app/apps/github/src/routes/index.tsx +3 -1
  143. package/app/apps/github/src/routes/orgs/$owner/route.tsx +4 -1
  144. package/app/apps/github/src/routes/orgs/$owner/settings.tsx +4 -1
  145. package/app/apps/github/src/seed/acme.ts +1 -1
  146. package/app/apps/github/src/seed/seed.ts +199 -120
  147. package/app/apps/github/src/server.ts +24 -15
  148. package/app/apps/github/src/settings/account-avatar.tsx +4 -1
  149. package/app/apps/github/src/settings/general-settings.tsx +3 -1
  150. package/app/apps/github/src/settings/general.ts +4 -4
  151. package/app/apps/github/src/settings/hook-form.tsx +3 -1
  152. package/app/apps/github/src/settings/hook-list.tsx +5 -2
  153. package/app/apps/github/src/settings/hooks.ts +7 -7
  154. package/app/apps/github/src/settings/org-settings.tsx +3 -1
  155. package/app/apps/github/src/settings/orgs.ts +21 -11
  156. package/app/apps/github/src/settings/settings-layout.tsx +3 -1
  157. package/app/apps/github/src/signin/approval.ts +4 -3
  158. package/app/apps/github/src/signin/auth.ts +9 -2
  159. package/app/apps/github/src/signin/device-code.ts +8 -3
  160. package/app/apps/github/src/signin/device-prompt.ts +28 -3
  161. package/app/apps/github/src/signin/revoke.ts +36 -0
  162. package/app/apps/github/tsconfig.json +4 -1
  163. package/app/apps/github/vite.config.ts +8 -0
  164. package/app/pnpm-workspace.yaml +9 -5
  165. package/app/tsconfig.base.json +1 -0
  166. package/dist/cli/child.mjs +1 -1
  167. package/dist/cli/credentials.mjs +4 -4
  168. package/dist/cli/documents.mjs +32 -22
  169. package/dist/cli/events.mjs +1 -1
  170. package/dist/cli/failure.mjs +20 -7
  171. package/dist/cli/folders.mjs +2 -2
  172. package/dist/cli/git-remote-ref0.mjs +47 -22
  173. package/dist/cli/git.mjs +26 -5
  174. package/dist/cli/helpers.mjs +168 -35
  175. package/dist/cli/hosts.mjs +3 -3
  176. package/dist/cli/output.mjs +2 -2
  177. package/dist/cli/prompt.mjs +1 -1
  178. package/dist/cli/queue.mjs +7 -7
  179. package/dist/cli/ref0-git.mjs +2 -2
  180. package/dist/cli/repos.mjs +35 -18
  181. package/dist/cli/resources.mjs +5 -5
  182. package/dist/cli/retry-after.mjs +8 -0
  183. package/dist/cli/setup.mjs +172 -66
  184. package/dist/cli/sign-in.mjs +65 -23
  185. package/dist/cli/sign-ins.mjs +70 -13
  186. package/dist/cli/sqlite.mjs +2 -2
  187. package/dist/cli/tokens.mjs +3 -3
  188. package/dist/cli/vendor.mjs +1 -1
  189. package/dist/init/app.mjs +18 -20
  190. package/dist/init/choices.mjs +1 -1
  191. package/dist/init/cloudflare.mjs +15 -19
  192. package/dist/init/create.mjs +4 -3
  193. package/dist/init/detect.mjs +4 -4
  194. package/dist/init/files.mjs +121 -9
  195. package/dist/init/frameworks.mjs +16 -0
  196. package/dist/init/git-module.mjs +22 -7
  197. package/dist/init/jsonc.mjs +9 -7
  198. package/dist/init/metadata.mjs +9 -3
  199. package/dist/init/mounts.mjs +13 -10
  200. package/dist/init/next.mjs +3 -5
  201. package/dist/init/node-app.mjs +3 -3
  202. package/dist/init/node.mjs +41 -42
  203. package/dist/init/nuxt.mjs +153 -27
  204. package/dist/init/stores.mjs +14 -9
  205. package/dist/init/sveltekit.mjs +4 -2
  206. package/dist/init/template.mjs +9 -6
  207. package/dist/init/templates.mjs +64 -48
  208. package/dist/init/vercel.mjs +37 -36
  209. package/dist/init/versions.mjs +3 -3
  210. package/package.json +6 -5
@@ -26,7 +26,7 @@ const add = Command.make("add", {
26
26
  key: Flag.String("key").pipe(Flag.withDescription("The entry's key, so an add sent again joins it: the source's name when it's left out"), Flag.withMetavar("KEY"), Flag.optional),
27
27
  priority: Flag.Int("priority").pipe(Flag.withDescription("Higher goes first"), Flag.withMetavar("NUMBER"), Flag.optional),
28
28
  jump: Flag.Boolean("jump").pipe(Flag.withDescription("Put it first, rebuilding the candidates behind it"), Flag.withDefault(false))
29
- }, Effect.fnUntraced(function* (flags) {
29
+ }, /* @__PURE__ */ Effect.fnUntraced(function* (flags) {
30
30
  const remote = yield* remoteFor(flags.host);
31
31
  const ask = (call) => answered(remote.host, call);
32
32
  const source = branchRef(flags.source);
@@ -75,7 +75,7 @@ const add = Command.make("add", {
75
75
  const remove = Command.make("remove", {
76
76
  entry: idArgument("ENTRY", "entry"),
77
77
  host: hostFlag
78
- }, Effect.fnUntraced(function* (flags) {
78
+ }, /* @__PURE__ */ Effect.fnUntraced(function* (flags) {
79
79
  const done = yield* called(flags.host, (client, signal) => client.queue.remove(flags.entry, { signal }));
80
80
  yield* changed(done.value, flags.entry, { done: `Removed ${printable(flags.entry)} from the queue on ${done.host}` });
81
81
  })).pipe(Command.withDescription("Take an entry out of the queue"));
@@ -92,7 +92,7 @@ const list = Command.make("list", {
92
92
  host: hostFlag,
93
93
  target: targetFlag,
94
94
  ...pageFlags
95
- }, Effect.fnUntraced(function* (flags) {
95
+ }, /* @__PURE__ */ Effect.fnUntraced(function* (flags) {
96
96
  const remote = yield* remoteFor(flags.host);
97
97
  const target = yield* targetOf(remote, flags.repo, flags.target);
98
98
  const command = (host) => [...[
@@ -119,7 +119,7 @@ const list = Command.make("list", {
119
119
  const show = Command.make("show", {
120
120
  entry: idArgument("ENTRY", "entry"),
121
121
  host: hostFlag
122
- }, Effect.fnUntraced(function* (flags) {
122
+ }, /* @__PURE__ */ Effect.fnUntraced(function* (flags) {
123
123
  const entry = (yield* called(flags.host, (client, signal) => client.queue.get(flags.entry, { signal }))).value;
124
124
  if ((yield* CliModes).json) return yield* document(entry);
125
125
  const rows = [
@@ -155,7 +155,7 @@ const hold = Command.make("hold", {
155
155
  entry: Flag.String("entry").pipe(Flag.withDescription("Hold this entry, instead of a REPO and --target"), Flag.withMetavar("ENTRY"), Flag.optional),
156
156
  target: Flag.String("target").pipe(Flag.withDescription("Hold the REPO's queue for this branch"), Flag.withMetavar("BRANCH"), Flag.optional),
157
157
  reason: Flag.String("reason").pipe(Flag.withDescription("Why, as the hold shows it"), Flag.withMetavar("TEXT"))
158
- }, Effect.fnUntraced(function* (flags) {
158
+ }, /* @__PURE__ */ Effect.fnUntraced(function* (flags) {
159
159
  const what = heldOf(flags);
160
160
  if (what === void 0) return yield* usageFailure("missing_target", "Hold a REPO with --target, or an --entry alone", {
161
161
  says: "See its help",
@@ -192,14 +192,14 @@ const hold = Command.make("hold", {
192
192
  const release = Command.make("release", {
193
193
  hold: idArgument("HOLD", "hold"),
194
194
  host: hostFlag
195
- }, Effect.fnUntraced(function* (flags) {
195
+ }, /* @__PURE__ */ Effect.fnUntraced(function* (flags) {
196
196
  const done = yield* called(flags.host, (client, signal) => client.queue.release(flags.hold, { signal }));
197
197
  yield* changed(done.value, flags.hold, { done: `Released ${printable(flags.hold)} on ${done.host}` });
198
198
  })).pipe(Command.withDescription("Release a hold"));
199
199
  const retry = Command.make("retry", {
200
200
  candidate: idArgument("CANDIDATE", "candidate"),
201
201
  host: hostFlag
202
- }, Effect.fnUntraced(function* (flags) {
202
+ }, /* @__PURE__ */ Effect.fnUntraced(function* (flags) {
203
203
  const done = yield* called(flags.host, (client, signal) => client.queue.retry(flags.candidate, { signal }));
204
204
  yield* changed(done.value, done.value.candidate, { done: `Closed ${printable(done.value.candidate)} to try its entries again, on ${done.host}` });
205
205
  })).pipe(Command.withDescription("Close a candidate and try its entries again"));
@@ -7,10 +7,10 @@ import { CliModes, flagOn, modesOf, nextDocument, nextLines, printable, secrets
7
7
  import { ref0Git } from "./commands.mjs";
8
8
  import { runControl } from "./run-end.mjs";
9
9
  import { layer } from "./runtime.mjs";
10
- import * as Effect from "effect/Effect";
11
- import * as Layer from "effect/Layer";
12
10
  import * as Cause from "effect/Cause";
11
+ import * as Effect from "effect/Effect";
13
12
  import * as Exit from "effect/Exit";
13
+ import * as Layer from "effect/Layer";
14
14
  import * as Fiber from "effect/Fiber";
15
15
  import * as Match from "effect/Match";
16
16
  import * as Option from "effect/Option";
@@ -7,6 +7,7 @@ import * as Command from "effect/cli/Command";
7
7
  import * as Flag from "effect/cli/Flag";
8
8
  import { jobStates } from "@ref0/git/rest";
9
9
  import { branchRef } from "@ref0/git";
10
+ import * as Record from "effect/Record";
10
11
  // src/cli/repos.ts
11
12
  /** `repos` and `work`: a host's repos, and a repo's saved work. */
12
13
  const create = Command.make("create", {
@@ -14,46 +15,62 @@ const create = Command.make("create", {
14
15
  host: hostFlag,
15
16
  public: Flag.Boolean("public").pipe(Flag.withDescription("Let anyone read it"), Flag.withDefault(false)),
16
17
  defaultBranch: Flag.String("default-branch").pipe(Flag.withDescription("Its default branch, the host's default when it's left out"), Flag.withMetavar("BRANCH"), Flag.optional)
17
- }, Effect.fnUntraced(function* (flags) {
18
+ }, /* @__PURE__ */ Effect.fnUntraced(function* (flags) {
18
19
  const made = yield* called(flags.host, (client, signal) => {
19
20
  const input = {
20
- id: flags.repo,
21
+ name: flags.repo,
21
22
  public: flags.public,
22
23
  signal
23
24
  };
24
25
  if (Option.isSome(flags.defaultBranch)) input.defaultBranch = branchRef(flags.defaultBranch.value);
25
26
  return client.repos.create(input);
26
27
  });
27
- yield* changed(made.value, made.value.id, {
28
- done: `Created repo ${printable(made.value.id)} on ${made.host}`,
29
- fields: [["Clone", `${made.endpoint}/${printable(made.value.id)}.git`]],
28
+ yield* changed(made.value, made.value.name, {
29
+ done: `Created repo ${printable(made.value.name)} on ${made.host}`,
30
+ fields: [["Clone", `${made.endpoint}/${printable(made.value.name)}.git`]],
30
31
  next: {
31
32
  says: "See it",
32
33
  run: [[
33
34
  "repos",
34
35
  "show",
35
- made.value.id,
36
+ made.value.name,
36
37
  "--host",
37
38
  made.host
38
39
  ]]
39
40
  }
40
41
  });
41
42
  })).pipe(Command.withDescription("Create a repo"));
43
+ /**
44
+ * `--order`'s values, in the CLI's kebab-case as a person types them, each with REST's name.
45
+ * This table is the only place the two meet: REST and `--json` keep REST's names.
46
+ */
47
+ const repoOrders = {
48
+ name: "name",
49
+ "name-descending": "nameDescending",
50
+ oldest: "oldest",
51
+ newest: "newest"
52
+ };
42
53
  const list = Command.make("list", {
43
54
  host: hostFlag,
55
+ order: Flag.Literals("order", Record.keys(repoOrders)).pipe(Flag.withDescription("The order to list them in: name, name-descending, or by when each was made, oldest or newest first (default: name)"), Flag.withMetavar("ORDER"), Flag.withDefault("name")),
44
56
  prefix: Flag.String("prefix").pipe(Flag.withDescription("Only repos whose names start with it, as acme/"), Flag.withMetavar("PREFIX"), Flag.optional),
45
57
  ...pageFlags
46
- }, Effect.fnUntraced(function* (flags) {
58
+ }, /* @__PURE__ */ Effect.fnUntraced(function* (flags) {
47
59
  const prefix = Option.getOrUndefined(flags.prefix);
48
- const command = (host) => [...[
49
- "repos",
50
- "list",
51
- "--host",
52
- host
53
- ], ...prefix === void 0 ? [] : ["--prefix", prefix]];
60
+ const command = (host) => [
61
+ ...[
62
+ "repos",
63
+ "list",
64
+ "--host",
65
+ host
66
+ ],
67
+ ...prefix === void 0 ? [] : ["--prefix", prefix],
68
+ ...flags.order === "name" ? [] : ["--order", flags.order]
69
+ ];
54
70
  const read = yield* pagesOf(flags.host, flags, command, printable, (client, page, signal) => {
55
71
  const input = {
56
72
  page,
73
+ order: repoOrders[flags.order],
57
74
  signal
58
75
  };
59
76
  if (prefix !== void 0) input.prefix = prefix;
@@ -69,24 +86,24 @@ const list = Command.make("list", {
69
86
  const show = Command.make("show", {
70
87
  repo: repoArgument,
71
88
  host: hostFlag
72
- }, Effect.fnUntraced(function* (flags) {
89
+ }, /* @__PURE__ */ Effect.fnUntraced(function* (flags) {
73
90
  const shown = yield* called(flags.host, (client, signal) => client.repos.get(flags.repo, { signal }));
74
91
  const info = shown.value;
75
92
  if ((yield* CliModes).json) return yield* document(info);
76
93
  const rows = [
77
- ["Repo", printable(info.id)],
94
+ ["Repo", printable(info.name)],
78
95
  ...info.defaultBranch === void 0 ? [] : [["Default branch", printable(info.defaultBranch)]],
79
96
  ["Visibility", info.public ? "Public" : "Private"],
80
97
  ...info.upstream === void 0 ? [] : [["Fork of", printable(info.upstream)]],
81
98
  ["Refs", String(info.stats.refs)],
82
- ["Clone", `${shown.endpoint}/${printable(info.id)}.git`]
99
+ ["Clone", `${shown.endpoint}/${printable(info.name)}.git`]
83
100
  ];
84
101
  yield* answer(rows.map((row) => field(row).trimStart()).join("\n"));
85
102
  })).pipe(Command.withDescription("Show a repo's details"));
86
103
  const remove = Command.make("delete", {
87
104
  repo: repoArgument,
88
105
  host: hostFlag
89
- }, Effect.fnUntraced(function* (flags) {
106
+ }, /* @__PURE__ */ Effect.fnUntraced(function* (flags) {
90
107
  const done = yield* called(flags.host, (client, signal) => client.repos.delete(flags.repo, { signal }));
91
108
  yield* changed(done.value, flags.repo, { done: `Deleted repo ${printable(flags.repo)} on ${done.host}` });
92
109
  })).pipe(Command.withDescription("Delete a repo, its refs and its objects"));
@@ -103,7 +120,7 @@ const workList = Command.make("list", {
103
120
  host: hostFlag,
104
121
  state: jobState,
105
122
  ...pageFlags
106
- }, Effect.fnUntraced(function* (flags) {
123
+ }, /* @__PURE__ */ Effect.fnUntraced(function* (flags) {
107
124
  const state = Option.getOrUndefined(flags.state);
108
125
  const command = (host) => [...[
109
126
  "work",
@@ -20,7 +20,7 @@ const pageFlags = {
20
20
  /** The host's client, for `--host` or the one the checkout or the one sign-in names. */
21
21
  const remoteFor = (host) => Effect.flatMap(chosenHost(host), remoteOf);
22
22
  /** The host's answer to `call`, made with its client: its refusal as the CLI's failure. */
23
- const called = Effect.fnUntraced(function* (host, call) {
23
+ const called = /* @__PURE__ */ Effect.fnUntraced(function* (host, call) {
24
24
  const remote = yield* remoteFor(host);
25
25
  const value = yield* answered(remote.host, (signal) => call(remote.client, signal));
26
26
  return {
@@ -35,7 +35,7 @@ const called = Effect.fnUntraced(function* (host, call) {
35
35
  * on stdout by `line` first, so its resume step loses none. A repeated cursor, the host's bug,
36
36
  * carries the rows read the same way, with no step, since resuming would only repeat it.
37
37
  */
38
- const pagesOf = Effect.fnUntraced(function* (from, choice, command, line, call) {
38
+ const pagesOf = /* @__PURE__ */ Effect.fnUntraced(function* (from, choice, command, line, call) {
39
39
  const remote = Option.isOption(from) ? yield* remoteFor(from) : from;
40
40
  const wanted = Option.getOrUndefined(choice.limit);
41
41
  const items = [];
@@ -98,7 +98,7 @@ const resumable = (failed, items, after, argv, wanted) => new CliFailure({
98
98
  * A list's rows: `--json`'s one document, else a line a row on stdout, an empty list said on
99
99
  * stderr, and one with more after it naming the command for the next page, with its `--limit`.
100
100
  */
101
- const listed = Effect.fnUntraced(function* (read, options) {
101
+ const listed = /* @__PURE__ */ Effect.fnUntraced(function* (read, options) {
102
102
  const listing = read.value;
103
103
  if ((yield* CliModes).json) return yield* document(listing);
104
104
  if (listing.items.length === 0) yield* say(options.none);
@@ -116,13 +116,13 @@ const listed = Effect.fnUntraced(function* (read, options) {
116
116
  * A change's outcome: `--json`'s document, else its receipt on stderr, and its bare ID on stdout
117
117
  * when stdout isn't a terminal or the run doesn't prompt, for a script to read.
118
118
  */
119
- const changed = Effect.fnUntraced(function* (value, id, shown) {
119
+ const changed = /* @__PURE__ */ Effect.fnUntraced(function* (value, id, shown) {
120
120
  const modes = yield* CliModes;
121
121
  if (modes.json) return yield* document(value);
122
122
  yield* receipt(shown);
123
123
  if (!modes.stdoutTerminal || !modes.interactive) yield* answer(printable(id));
124
124
  });
125
- const decodeDuration = Schema.decodeUnknownOption(DurationInput);
125
+ const decodeDuration = /* @__PURE__ */ Schema.decodeUnknownOption(DurationInput);
126
126
  /** A duration flag's value, as `30s`, `30m`, `12h` or `30d`, in milliseconds. */
127
127
  const durationOf = (flag, text) => Option.match(decodeDuration(text), {
128
128
  onNone: () => Effect.fail(usageFailure("invalid_duration", `--${flag} takes a number and a unit, as 30m, 12h or 30d: not '${printable(text)}'`)),
@@ -0,0 +1,8 @@
1
+ // src/cli/retry-after.ts
2
+ /**
3
+ * A `Retry-After` header's seconds, when it's RFC 9110's delay-seconds, a non-negative integer, cut
4
+ * to `mostSeconds`. An HTTP-date, a sign, a fraction, a space or anything else is `undefined`, so
5
+ * the caller waits as it would with no header.
6
+ */
7
+ const retryAfterSeconds = (header, mostSeconds) => header !== void 0 && /^\d+$/.test(header) ? Math.min(Number(header), mostSeconds) : void 0;
8
+ export { retryAfterSeconds };