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.
- package/app/apps/github/.dev.vars.example +2 -1
- package/app/apps/github/generated/git-rest.ts +191 -25
- package/app/apps/github/generated/routeTree.gen.ts +21 -0
- package/app/apps/github/package.json +1 -1
- package/app/apps/github/src/branches/branch-list.tsx +8 -4
- package/app/apps/github/src/branches/branches.ts +10 -5
- package/app/apps/github/src/camo/addresses.ts +120 -0
- package/app/apps/github/src/camo/client.ts +125 -0
- package/app/apps/github/src/camo/fetch.ts +201 -0
- package/app/apps/github/src/camo/lookup.ts +23 -0
- package/app/apps/github/src/camo/node.ts +50 -0
- package/app/apps/github/src/camo/proxy.ts +116 -0
- package/app/apps/github/src/camo/sign-images.ts +307 -0
- package/app/apps/github/src/camo/signing.ts +80 -0
- package/app/apps/github/src/clients/allowed.ts +111 -18
- package/app/apps/github/src/clients/clients.ts +76 -61
- package/app/apps/github/src/clients/transport.ts +13 -0
- package/app/apps/github/src/code/code-tree.tsx +3 -1
- package/app/apps/github/src/code/file-view.tsx +15 -6
- package/app/apps/github/src/code/files.ts +26 -19
- package/app/apps/github/src/code/go-to-file.tsx +2 -1
- package/app/apps/github/src/code/load.ts +41 -23
- package/app/apps/github/src/code/markdown-files.ts +13 -2
- package/app/apps/github/src/code/ref-pages.ts +14 -5
- package/app/apps/github/src/code/ref-switcher.tsx +4 -3
- package/app/apps/github/src/code/refs.ts +42 -8
- package/app/apps/github/src/code/repo-home.tsx +6 -2
- package/app/apps/github/src/code/repo.ts +12 -6
- package/app/apps/github/src/code/saved.ts +5 -3
- package/app/apps/github/src/code/trees.ts +11 -9
- package/app/apps/github/src/components/markdown/markdown.css +6 -0
- package/app/apps/github/src/components/markdown/markdown.tsx +95 -10
- package/app/apps/github/src/components/owner-card.tsx +3 -1
- package/app/apps/github/src/components/repos/your-repos.tsx +3 -1
- package/app/apps/github/src/components/shell/owner-repos.tsx +7 -12
- package/app/apps/github/src/components/shell/repo-switcher.tsx +10 -16
- package/app/apps/github/src/components/signin/device-card.tsx +9 -2
- package/app/apps/github/src/components/user-avatar.tsx +2 -1
- package/app/apps/github/src/context/context.ts +13 -0
- package/app/apps/github/src/diffs/blobs.ts +37 -14
- package/app/apps/github/src/diffs/diff-job.ts +53 -0
- package/app/apps/github/src/diffs/diff-worker.ts +6 -0
- package/app/apps/github/src/diffs/diffing.ts +136 -0
- package/app/apps/github/src/diffs/files.ts +4 -3
- package/app/apps/github/src/diffs/hunks.tsx +101 -53
- package/app/apps/github/src/diffs/patch.ts +20 -11
- package/app/apps/github/src/history/commit-diff.ts +10 -5
- package/app/apps/github/src/history/commit-list.tsx +3 -1
- package/app/apps/github/src/history/commit-page.tsx +4 -2
- package/app/apps/github/src/history/history.ts +12 -10
- package/app/apps/github/src/hooks/allowed.ts +9 -9
- package/app/apps/github/src/hooks/avatars.ts +3 -3
- package/app/apps/github/src/hooks/open-counts.ts +5 -4
- package/app/apps/github/src/hooks/profiles.ts +26 -12
- package/app/apps/github/src/hooks/repos.ts +78 -25
- package/app/apps/github/src/inbox/count.ts +30 -29
- package/app/apps/github/src/inbox/inbox-item.tsx +3 -1
- package/app/apps/github/src/inbox/inbox-page.tsx +5 -2
- package/app/apps/github/src/inbox/marks.ts +26 -15
- package/app/apps/github/src/inbox/release-tags.ts +7 -6
- package/app/apps/github/src/inbox/subjects.ts +5 -4
- package/app/apps/github/src/inbox/subscription-controls.tsx +14 -5
- package/app/apps/github/src/inbox/subscriptions.ts +95 -35
- package/app/apps/github/src/inbox/threads.ts +6 -6
- package/app/apps/github/src/issues/changes.ts +40 -16
- package/app/apps/github/src/issues/counts.ts +8 -5
- package/app/apps/github/src/issues/issue-list.tsx +20 -6
- package/app/apps/github/src/issues/issue-page.tsx +30 -14
- package/app/apps/github/src/issues/issues.ts +195 -46
- package/app/apps/github/src/issues/label-dialog.tsx +8 -11
- package/app/apps/github/src/issues/labels-page.tsx +35 -3
- package/app/apps/github/src/issues/milestone-dialog.tsx +197 -0
- package/app/apps/github/src/issues/milestones-page.tsx +269 -0
- package/app/apps/github/src/issues/new-issue.tsx +3 -1
- package/app/apps/github/src/issues/sidebar.tsx +8 -6
- package/app/apps/github/src/markdown/README.md +22 -17
- package/app/apps/github/src/markdown/context.ts +83 -10
- package/app/apps/github/src/markdown/images.ts +3 -2
- package/app/apps/github/src/markdown/lookup.ts +17 -11
- package/app/apps/github/src/markdown/page-budget.ts +50 -0
- package/app/apps/github/src/markdown/patches.ts +74 -32
- package/app/apps/github/src/markdown/query.ts +7 -2
- package/app/apps/github/src/markdown/remote.ts +106 -0
- package/app/apps/github/src/markdown/render.ts +101 -24
- package/app/apps/github/src/markdown/texts.ts +43 -0
- package/app/apps/github/src/markdown/words-module.d.ts +5 -0
- package/app/apps/github/src/markdown/words-plugin.ts +135 -0
- package/app/apps/github/src/names/repos.ts +1 -1
- package/app/apps/github/src/palette/palette.tsx +28 -10
- package/app/apps/github/src/palette/rows.tsx +93 -40
- package/app/apps/github/src/palette/server.ts +10 -7
- package/app/apps/github/src/palette/targets.ts +1 -0
- package/app/apps/github/src/policy.ts +137 -61
- package/app/apps/github/src/private-repos.ts +5 -5
- package/app/apps/github/src/pulls/compare-page.tsx +6 -3
- package/app/apps/github/src/pulls/files-tab.tsx +480 -214
- package/app/apps/github/src/pulls/held-summary.ts +178 -0
- package/app/apps/github/src/pulls/live.ts +6 -4
- package/app/apps/github/src/pulls/merge-box.tsx +17 -10
- package/app/apps/github/src/pulls/pull-list.tsx +6 -3
- package/app/apps/github/src/pulls/pull-page.tsx +19 -10
- package/app/apps/github/src/pulls/pull.ts +68 -40
- package/app/apps/github/src/pulls/pulls.ts +39 -22
- package/app/apps/github/src/pulls/review-drafts.ts +131 -0
- package/app/apps/github/src/pulls/review.ts +374 -99
- package/app/apps/github/src/pulls/threads.tsx +152 -0
- package/app/apps/github/src/queue/queue-page.tsx +15 -8
- package/app/apps/github/src/queue/queue.ts +35 -20
- package/app/apps/github/src/releases/latest-release.tsx +3 -1
- package/app/apps/github/src/releases/overview.tsx +4 -2
- package/app/apps/github/src/releases/release-form.tsx +8 -5
- package/app/apps/github/src/releases/release-list.tsx +8 -5
- package/app/apps/github/src/releases/release-view.tsx +1 -0
- package/app/apps/github/src/releases/releases.ts +33 -23
- package/app/apps/github/src/releases/tag-list.tsx +3 -1
- package/app/apps/github/src/router.tsx +5 -2
- package/app/apps/github/src/routes/$owner/$repo/_code/blob/$.tsx +7 -1
- package/app/apps/github/src/routes/$owner/$repo/_code/tree/$.tsx +6 -1
- package/app/apps/github/src/routes/$owner/$repo/_releases/releases/index.tsx +2 -1
- package/app/apps/github/src/routes/$owner/$repo/_releases/tags.tsx +1 -1
- package/app/apps/github/src/routes/$owner/$repo/branches.tsx +5 -1
- package/app/apps/github/src/routes/$owner/$repo/commit/$sha.tsx +1 -1
- package/app/apps/github/src/routes/$owner/$repo/commits/$.tsx +6 -1
- package/app/apps/github/src/routes/$owner/$repo/index.tsx +1 -1
- package/app/apps/github/src/routes/$owner/$repo/issues/$number.tsx +4 -2
- package/app/apps/github/src/routes/$owner/$repo/issues/index.tsx +2 -2
- package/app/apps/github/src/routes/$owner/$repo/issues/new.tsx +5 -2
- package/app/apps/github/src/routes/$owner/$repo/labels.tsx +2 -1
- package/app/apps/github/src/routes/$owner/$repo/milestones.tsx +36 -0
- package/app/apps/github/src/routes/$owner/$repo/pull/$number/route.tsx +4 -2
- package/app/apps/github/src/routes/$owner/$repo/pulls/index.tsx +2 -2
- package/app/apps/github/src/routes/$owner/$repo/queue.tsx +2 -1
- package/app/apps/github/src/routes/$owner/$repo/releases/edit/$.tsx +5 -2
- package/app/apps/github/src/routes/$owner/$repo/releases/new.tsx +2 -1
- package/app/apps/github/src/routes/$owner/$repo/releases/tag/$.tsx +4 -2
- package/app/apps/github/src/routes/$owner/$repo/route.tsx +9 -5
- package/app/apps/github/src/routes/$owner/$repo/settings/hooks/index.tsx +3 -1
- package/app/apps/github/src/routes/$owner/$repo/settings/index.tsx +3 -1
- package/app/apps/github/src/routes/-nav.tsx +10 -2
- package/app/apps/github/src/routes/-root-testing.ts +29 -6
- package/app/apps/github/src/routes/__root.tsx +9 -4
- package/app/apps/github/src/routes/index.tsx +3 -1
- package/app/apps/github/src/routes/orgs/$owner/route.tsx +4 -1
- package/app/apps/github/src/routes/orgs/$owner/settings.tsx +4 -1
- package/app/apps/github/src/seed/acme.ts +1 -1
- package/app/apps/github/src/seed/seed.ts +199 -120
- package/app/apps/github/src/server.ts +24 -15
- package/app/apps/github/src/settings/account-avatar.tsx +4 -1
- package/app/apps/github/src/settings/general-settings.tsx +3 -1
- package/app/apps/github/src/settings/general.ts +4 -4
- package/app/apps/github/src/settings/hook-form.tsx +3 -1
- package/app/apps/github/src/settings/hook-list.tsx +5 -2
- package/app/apps/github/src/settings/hooks.ts +7 -7
- package/app/apps/github/src/settings/org-settings.tsx +3 -1
- package/app/apps/github/src/settings/orgs.ts +21 -11
- package/app/apps/github/src/settings/settings-layout.tsx +3 -1
- package/app/apps/github/src/signin/approval.ts +4 -3
- package/app/apps/github/src/signin/auth.ts +9 -2
- package/app/apps/github/src/signin/device-code.ts +8 -3
- package/app/apps/github/src/signin/device-prompt.ts +28 -3
- package/app/apps/github/src/signin/revoke.ts +36 -0
- package/app/apps/github/tsconfig.json +4 -1
- package/app/apps/github/vite.config.ts +8 -0
- package/app/pnpm-workspace.yaml +9 -5
- package/app/tsconfig.base.json +1 -0
- package/dist/cli/child.mjs +1 -1
- package/dist/cli/credentials.mjs +4 -4
- package/dist/cli/documents.mjs +32 -22
- package/dist/cli/events.mjs +1 -1
- package/dist/cli/failure.mjs +20 -7
- package/dist/cli/folders.mjs +2 -2
- package/dist/cli/git-remote-ref0.mjs +47 -22
- package/dist/cli/git.mjs +26 -5
- package/dist/cli/helpers.mjs +168 -35
- package/dist/cli/hosts.mjs +3 -3
- package/dist/cli/output.mjs +2 -2
- package/dist/cli/prompt.mjs +1 -1
- package/dist/cli/queue.mjs +7 -7
- package/dist/cli/ref0-git.mjs +2 -2
- package/dist/cli/repos.mjs +35 -18
- package/dist/cli/resources.mjs +5 -5
- package/dist/cli/retry-after.mjs +8 -0
- package/dist/cli/setup.mjs +172 -66
- package/dist/cli/sign-in.mjs +65 -23
- package/dist/cli/sign-ins.mjs +70 -13
- package/dist/cli/sqlite.mjs +2 -2
- package/dist/cli/tokens.mjs +3 -3
- package/dist/cli/vendor.mjs +1 -1
- package/dist/init/app.mjs +18 -20
- package/dist/init/choices.mjs +1 -1
- package/dist/init/cloudflare.mjs +15 -19
- package/dist/init/create.mjs +4 -3
- package/dist/init/detect.mjs +4 -4
- package/dist/init/files.mjs +121 -9
- package/dist/init/frameworks.mjs +16 -0
- package/dist/init/git-module.mjs +22 -7
- package/dist/init/jsonc.mjs +9 -7
- package/dist/init/metadata.mjs +9 -3
- package/dist/init/mounts.mjs +13 -10
- package/dist/init/next.mjs +3 -5
- package/dist/init/node-app.mjs +3 -3
- package/dist/init/node.mjs +41 -42
- package/dist/init/nuxt.mjs +153 -27
- package/dist/init/stores.mjs +14 -9
- package/dist/init/sveltekit.mjs +4 -2
- package/dist/init/template.mjs +9 -6
- package/dist/init/templates.mjs +64 -48
- package/dist/init/vercel.mjs +37 -36
- package/dist/init/versions.mjs +3 -3
- package/package.json +6 -5
package/dist/cli/queue.mjs
CHANGED
|
@@ -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"));
|
package/dist/cli/ref0-git.mjs
CHANGED
|
@@ -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";
|
package/dist/cli/repos.mjs
CHANGED
|
@@ -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
|
-
|
|
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.
|
|
28
|
-
done: `Created repo ${printable(made.value.
|
|
29
|
-
fields: [["Clone", `${made.endpoint}/${printable(made.value.
|
|
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.
|
|
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
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
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.
|
|
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.
|
|
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",
|
package/dist/cli/resources.mjs
CHANGED
|
@@ -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 };
|