ref0-git 0.12.0 → 0.20.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/generated/git-rest.ts +320 -4
- package/app/apps/github/generated/routeTree.gen.ts +42 -21
- package/app/apps/github/migrations/postgres/0001_auth.sql +8 -1
- package/app/apps/github/migrations/sql/0005_repo_grants.sql +10 -0
- package/app/apps/github/src/clients/allowed.ts +9 -4
- package/app/apps/github/src/clients/host-calls.ts +59 -34
- package/app/apps/github/src/components/repos/your-repos.tsx +57 -11
- package/app/apps/github/src/components/states/states.tsx +1 -19
- package/app/apps/github/src/components/view-tabs.tsx +6 -2
- package/app/apps/github/src/context/context.ts +51 -5
- package/app/apps/github/src/context/host.ts +72 -36
- package/app/apps/github/src/context/repo-grants.ts +35 -0
- package/app/apps/github/src/hooks/repos.ts +14 -3
- package/app/apps/github/src/issues/issue-list.tsx +11 -3
- package/app/apps/github/src/issues/issues.ts +11 -8
- package/app/apps/github/src/lists/across-list.tsx +358 -0
- package/app/apps/github/src/lists/across.ts +239 -0
- package/app/apps/github/src/names/owners.ts +3 -1
- package/app/apps/github/src/palette/targets.ts +3 -2
- package/app/apps/github/src/policy.ts +493 -102
- package/app/apps/github/src/private-repos.ts +24 -24
- package/app/apps/github/src/pulls/pulls.ts +2 -1
- package/app/apps/github/src/routes/$owner/$repo/settings/access.tsx +1 -1
- package/app/apps/github/src/routes/-nav.tsx +40 -12
- package/app/apps/github/src/routes/index.tsx +2 -1
- package/app/apps/github/src/routes/issues.tsx +15 -0
- package/app/apps/github/src/routes/orgs/$owner/-org-list.ts +31 -0
- package/app/apps/github/src/routes/orgs/$owner/issues.tsx +10 -3
- package/app/apps/github/src/routes/orgs/$owner/pulls.tsx +10 -3
- package/app/apps/github/src/routes/pulls.tsx +15 -0
- package/app/apps/github/src/seed/seed.ts +104 -52
- package/app/apps/github/src/server.ts +17 -7
- package/app/apps/github/src/settings/access-page.tsx +308 -0
- package/app/apps/github/src/settings/access.ts +156 -0
- package/app/apps/github/src/settings/settings-layout.tsx +0 -16
- package/app/apps/github/src/signin/approval.ts +24 -16
- package/app/apps/github/src/signin/auth.ts +29 -19
- package/app/apps/github/src/signin/orgs.ts +57 -14
- package/app/apps/github/src/signin/repo-grants.ts +141 -0
- package/app/apps/github/src/signin/revoke.ts +9 -17
- package/app/apps/github/src/signin/unborn.ts +33 -20
- package/app/pnpm-workspace.yaml +2 -2
- package/dist/cli/child.mjs +73 -3
- package/dist/cli/commands.mjs +2 -0
- package/dist/cli/documents.mjs +42 -2
- package/dist/cli/keys.mjs +431 -0
- package/dist/cli/main.mjs +148 -0
- package/dist/cli/prompt.mjs +40 -1
- package/dist/cli/ref0-git.mjs +4 -141
- package/dist/cli/setup.mjs +118 -16
- package/dist/cli/sign-in.mjs +1 -1
- package/dist/cli/tools-node.mjs +20 -0
- package/dist/cli/tools.mjs +12 -0
- package/dist/init/app.mjs +5 -2
- package/dist/init/cloudflare.mjs +8 -3
- package/dist/init/git-module.mjs +13 -8
- package/dist/init/metadata.mjs +1 -1
- package/dist/init/node.mjs +1 -1
- package/dist/init/template.mjs +1 -0
- package/dist/init/templates.mjs +24 -19
- package/dist/init/versions.mjs +1 -1
- package/package.json +5 -5
- package/app/apps/github/src/routes/orgs/$owner/releases.tsx +0 -8
package/dist/init/templates.mjs
CHANGED
|
@@ -3,7 +3,7 @@ var templates_default = {
|
|
|
3
3
|
appGit: [
|
|
4
4
|
{
|
|
5
5
|
"slot": "gitImport",
|
|
6
|
-
"text": "import {
|
|
6
|
+
"text": "import { Git, Lfs, Merges, MergeQueue, Objects, Repos, Rest, SignIn, Tokens } from '@ref0/git';"
|
|
7
7
|
},
|
|
8
8
|
"\n",
|
|
9
9
|
{
|
|
@@ -12,14 +12,19 @@ var templates_default = {
|
|
|
12
12
|
},
|
|
13
13
|
{
|
|
14
14
|
"slot": "githubImport",
|
|
15
|
-
"text": "import {\n Apps,\n Deployments,\n GitHub,\n Inbox,\n Releases,\n Search,\n Streams,\n Webhooks,\n} from '@ref0/github';"
|
|
15
|
+
"text": "import {\n Apps,\n Deployments,\n GitHub,\n Inbox,\n IssueLists,\n Releases,\n RepoGrants,\n Search,\n Streams,\n Webhooks,\n} from '@ref0/github';"
|
|
16
16
|
},
|
|
17
|
-
"\nimport * as Languages from '@ref0/github/languages';\n",
|
|
17
|
+
"\nimport * as Collaborators from '@ref0/github/collaborators';\nimport * as Languages from '@ref0/github/languages';\n",
|
|
18
18
|
{
|
|
19
19
|
"slot": "infraImport",
|
|
20
20
|
"text": "import {\n layer,\n layerR2,\n layerR2Signed,\n toJobObject,\n toRecordsObject,\n} from '@ref0/infra/cloudflare';"
|
|
21
21
|
},
|
|
22
|
-
"\nimport xdiff from '@ref0/xdiff-wasm/xdiff.wasm';\nimport { env as bindings } from 'cloudflare:workers';\
|
|
22
|
+
"\nimport xdiff from '@ref0/xdiff-wasm/xdiff.wasm';\nimport { env as bindings } from 'cloudflare:workers';\n",
|
|
23
|
+
{
|
|
24
|
+
"slot": "effectImport",
|
|
25
|
+
"text": "import * as Effect from 'effect/Effect';\n"
|
|
26
|
+
},
|
|
27
|
+
"import * as FetchHttpClient from 'effect/http/FetchHttpClient';\nimport * as Layer from 'effect/Layer';\n\nimport {\n hostLayer,\n onHost,\n type OnHost,\n peopleOver,\n repoRecordsOn,\n tokensOn,\n} from './context/host.ts';\nimport { repoGrantsDropped } from './context/repo-grants.ts';\nimport { repoIcons } from './context/repo-icons.ts';\nimport type { Env } from './env.ts';\nimport {\n admin,\n approvalPage,\n type GrantsPolicy,\n hostPolicy,\n hostRules,\n type Identify,\n} from './policy.ts';\nimport { privateReposOf } from './private-repos.ts';\nimport { readyAdapter, readyAuth, starterAuth } from './signin/auth.ts';\nimport { avatars } from './signin/avatars.ts';\nimport { appAuth } from './signin/host-session.ts';\nimport { orgsOver } from './signin/orgs.ts';\nimport { grantsOver } from './signin/repo-grants.ts';\nimport { sealKey } from './signin/seal.ts';\n\n// SAFETY: `wrangler.jsonc` ",
|
|
23
28
|
{
|
|
24
29
|
"slot": "safety",
|
|
25
30
|
"text": "binds the objects, the bucket and D1"
|
|
@@ -27,13 +32,13 @@ var templates_default = {
|
|
|
27
32
|
" and sets `APP_ORIGIN`; the\n// secrets come from `wrangler secret put`, or `.dev.vars` locally.\nexport const env = bindings as Env;\n\n",
|
|
28
33
|
{
|
|
29
34
|
"slot": "bucket",
|
|
30
|
-
"text": "const {\n R2_ACCOUNT_ID: accountId,\n R2_ACCESS_KEY_ID: accessKeyId,\n R2_SECRET_ACCESS_KEY: secretAccessKey,\n} = env;\n\n// With R2's S3 credentials, the bucket signs parts, and a push's pack past 64 MiB may upload to\n// it in parts, past Workers' 100 MB body.\nconst signed =\n accountId === undefined || accessKeyId === undefined || secretAccessKey === undefined\n ? undefined\n : layerR2Signed(env.PACKS, {\n accountId,\n bucket: env.PACKS_BUCKET,\n accessKeyId,\n secretAccessKey,\n });\n\nconst bucket = signed ?? layerR2(env.PACKS);\n\nconst uploads =\n signed === undefined\n ? Layer.empty\n : Layer.provide(Git.layerUploads({ above: 64 * 1024 * 1024 }), signed);\n\n"
|
|
35
|
+
"text": "const {\n R2_ACCOUNT_ID: accountId,\n R2_ACCESS_KEY_ID: accessKeyId,\n R2_SECRET_ACCESS_KEY: secretAccessKey,\n} = env;\n\n// With R2's S3 credentials, the bucket signs parts, and a push's pack past 64 MiB may upload to\n// it in parts, past Workers' 100 MB body.\nconst signed =\n accountId === undefined || accessKeyId === undefined || secretAccessKey === undefined\n ? undefined\n : layerR2Signed(env.PACKS, {\n accountId,\n bucket: env.PACKS_BUCKET,\n accessKeyId,\n secretAccessKey,\n });\n\n// With none, Git LFS's bytes go through the Worker, under its CPU and body limits: a warning\n// says so once an isolate, as the runtime builds the bucket.\nconst unsigned = Layer.effectDiscard(\n Effect.logWarning(\n \"LFS: through the Worker (no signing key). Run `ref0-git keys` in the Worker's folder to sign its links straight to R2\",\n ),\n);\n\nconst bucket = signed ?? Layer.merge(layerR2(env.PACKS), unsigned);\n\nconst uploads =\n signed === undefined\n ? Layer.empty\n : Layer.provide(Git.layerUploads({ above: 64 * 1024 * 1024 }), signed);\n\n"
|
|
31
36
|
},
|
|
32
37
|
{
|
|
33
38
|
"slot": "queueMerge",
|
|
34
39
|
"text": "/**\n * How the queue writes an entry's link onto `main`: a merge commit, by the person who added it, as\n * a pull request's merge button writes one, and titled as GitHub titles it for a pull request's\n * entry, keyed `pr-<number>`.\n */\nconst queueMerge = ({ entry, at }: MergeInput): MergePlan => {\n const [owner = ''] = entry.repo.split('/');\n const branch = entry.source.replace(/^refs\\/heads\\//, '');\n const pull = /^pr-([1-9]\\d*)$/.exec(entry.key)?.[1];\n const title =\n pull === undefined ? `Merge ${branch}` : `Merge pull request #${pull} from ${owner}/${branch}`;\n const login = entry.subject?.id ?? entry.actor.id;\n const hostname = new URL(env.APP_ORIGIN).hostname;\n\n return {\n method: 'merge',\n message: `${title}\\n`,\n author: { name: login, email: `${login}@users.noreply.${hostname}`, at, offset: 0 },\n };\n};\n\n"
|
|
35
40
|
},
|
|
36
|
-
"/** The key sessions and host sessions are sealed under, derived once an isolate from its secret. */\nexport const sessionKey = sealKey(env.SESSION_SECRET);\n\n/**\n * Who owns what, and the drop-in's people and orgs, over Better Auth's tables, which `auth` makes\n * at the first request that reads them.\n */\nexport const directory = orgsOver(async () => readyAdapter(await auth()));\n\n/** People's, orgs' and repos' pictures, in Better Auth's database, as `directory` reads it. */\nexport const pictures = avatars(async () => readyAdapter(await auth()));\n\nexport const policy = hostPolicy(directory, {\n origin: env.APP_ORIGIN,\n avatars: pictures,\n privateRepos:
|
|
41
|
+
"/** The key sessions and host sessions are sealed under, derived once an isolate from its secret. */\nexport const sessionKey = sealKey(env.SESSION_SECRET);\n\n/**\n * Who owns what, and the drop-in's people and orgs, over Better Auth's tables, which `auth` makes\n * at the first request that reads them.\n */\nexport const directory = orgsOver(async () => readyAdapter(await auth()));\n\n/** People's, orgs' and repos' pictures, in Better Auth's database, as `directory` reads it. */\nexport const pictures = avatars(async () => readyAdapter(await auth()));\n\n/** Each repo's grants to people, its collaborators, in Better Auth's database, as `directory` reads it. */\nexport const grants = grantsOver(async () => readyAdapter(await auth()));\n\n/**\n * Git's services on the runtime below, in the caller's fiber: the policy reads its repos' records\n * through it within the request it decides, its store calls counted on that request's.\n */\nexport const host: OnHost = onHost(() => runtime);\n\nconst { repoName, repoId } = repoRecordsOn(host);\n\nexport const policy: GrantsPolicy = hostPolicy(directory, {\n origin: env.APP_ORIGIN,\n avatars: pictures,\n privateRepos: privateReposOf(host),\n repoName,\n // Who else may do what on a repo, by its grants, and which repo a token over one names now.\n grants,\n repoId,\n});\n\n",
|
|
37
42
|
{
|
|
38
43
|
"slot": "adapter",
|
|
39
44
|
"text": "/** The records and job objects, and the bucket. */\nconst adapter = Layer.merge(layer({ records: env.RECORDS, jobs: env.JOBS }), bucket);"
|
|
@@ -48,7 +53,7 @@ var templates_default = {
|
|
|
48
53
|
"slot": "releases",
|
|
49
54
|
"text": " // A release's assets, in the bucket beside the packs.\n Releases.layer(),\n"
|
|
50
55
|
},
|
|
51
|
-
" // `org:` and `user:` search an owner's repos, its private ones by the policy's hook.\n Search.layer({ readableRepos: policy.readableRepos }),\n // Without it, a repo's `language` and `license` answer null.\n Languages.layer(),\n // A repo's and an org's hooks, each delivery a `fetch`, and GitHub Apps, whose hooks they send.\n // @effect-diagnostics-next-line unstableApiUsage:off\n Layer.provideMerge(Apps.layer(), Webhooks.layer().pipe(Layer.provide(FetchHttpClient.layer))),\n // GitHub's Event Streams over Git's event feeds, which a pull request's page follows.\n Streams.layer(),\n // A deleted repo's icon, removed however the repo was deleted.\n repoIcons(pictures),\n).pipe(\n Layer.provideMerge(GitHub.layer()),\n Layer.provideMerge(peopleOver(policy.people)),\n Layer.provideMerge(\n Layer.mergeAll(\n Rest.layer(),\n",
|
|
56
|
+
" // `org:` and `user:` search an owner's repos, its private ones by the policy's hook.\n Search.layer({ readableRepos: policy.readableRepos }),\n // Each person's index of the issues and pull requests they take part in, across every repo:\n // `/issues`, an org's issues, and a search that names no repo read it.\n IssueLists.layer(),\n // Without it, a repo's `language` and `license` answer null.\n Languages.layer(),\n // A repo's and an org's hooks, each delivery a `fetch`, and GitHub Apps, whose hooks they send.\n // @effect-diagnostics-next-line unstableApiUsage:off\n Layer.provideMerge(Apps.layer(), Webhooks.layer().pipe(Layer.provide(FetchHttpClient.layer))),\n // GitHub's Event Streams over Git's event feeds, which a pull request's page follows.\n Streams.layer(),\n // A deleted repo's icon, removed however the repo was deleted.\n repoIcons(pictures),\n // A repo's collaborators and teams, which its settings list and change.\n Collaborators.layer(),\n // A deleted repo's collaborators, removed however the repo was deleted.\n repoGrantsDropped(grants),\n).pipe(\n Layer.provideMerge(GitHub.layer()),\n // The directory, and a repo's collaborators, which its settings list and change: the drop-in\n // takes both as it's built.\n Layer.provideMerge(Layer.merge(peopleOver(policy.people), RepoGrants.layer(policy.repoGrants))),\n Layer.provideMerge(\n Layer.mergeAll(\n Rest.layer(),\n",
|
|
52
57
|
{
|
|
53
58
|
"slot": "lfs",
|
|
54
59
|
"text": " // Git LFS, its objects in the bucket beside the packs. An upload through the Worker may use\n // `limits.cpu_ms` from wrangler.jsonc: raise both together.\n Lfs.layer({ cpuMs: 300_000 }),\n"
|
|
@@ -61,18 +66,18 @@ var templates_default = {
|
|
|
61
66
|
"slot": "queue",
|
|
62
67
|
"text": " // Each repo's `main` has a merge queue, beside the merge button: its protection still takes\n // a direct merge, as GitHub's does on a branch whose rules don't ask for the queue.\n MergeQueue.layer({ target: 'refs/heads/main', keys: 'once', merge: queueMerge }),\n"
|
|
63
68
|
},
|
|
64
|
-
" // The device flow's sign-in for `gh` and `ref0-git login`, which the page decides in the\n // person's session, from the Better Auth below and Git's own `identify`.\n SignIn.layer({\n approvalPage: approvalPage({\n auth: () => auth(),\n sealKey: sessionKey,\n identify: (request): ReturnType<Identify> =>
|
|
69
|
+
" // The device flow's sign-in for `gh` and `ref0-git login`, which the page decides in the\n // person's session, from the Better Auth below and Git's own `identify`.\n SignIn.layer({\n approvalPage: approvalPage({\n auth: () => auth(),\n sealKey: sessionKey,\n identify: (request): ReturnType<Identify> => host(Git.identify(request)),\n origin: env.APP_ORIGIN,\n }),\n }),\n ),\n ),\n Layer.provideMerge(Tokens.layer()),\n Layer.provideMerge(Merges.layer({ xdiff })),\n);\n\n/**\n * The whole host, one runtime a process: Git and its features over the records, the jobs and the\n * bucket, as the policy decides, with `hostRules` its push rules.\n */\nexport const runtime = Git.runtime(\n hostLayer(adapter, objects, features, {\n authorize: policy.authorize,\n auth: appAuth({ adminToken: env.ADMIN_TOKEN, admin, key: sessionKey }),\n authorizeGitHub: policy.authorizeGitHub,\n rules: hostRules.map((each) => each.rule),\n }),\n);\n\n/**\n * Better Auth, made at a request that needs it, not the isolate's start: who signs up and in, in\n * `AUTH_DB`, each session with a Git token of its own. It's kept once a request's check settles.\n */\nexport const auth = readyAuth(() =>\n starterAuth({\n database: env.AUTH_DB,\n secret: env.SESSION_SECRET,\n origin: env.APP_ORIGIN,\n signUp: env.SIGN_UP !== 'closed',\n key: sessionKey,\n tokens: tokensOn(host),\n // Cloudflare's own, which it sets on every request in place of any the caller sent.\n ipHeader: 'cf-connecting-ip',\n ownsRepos: (login) =>\n Effect.match(host(Repos.list({ actor: admin, prefix: `${login}/`, page: { limit: 1 } })), {\n onFailure: () => true,\n onSuccess: (listed) => listed.items.length > 0,\n }),\n }),\n);\n\n/** The records objects, one per scope, as `wrangler.jsonc`'s `class_name`s name them. */\nexport const Records = toRecordsObject(runtime);\n\n/** The job objects, one per scope and job, which a records object's alarm rings. */\nexport const Jobs = toJobObject(runtime);\n"
|
|
65
70
|
],
|
|
66
71
|
appGitNode: [
|
|
67
72
|
{
|
|
68
73
|
"slot": "head",
|
|
69
|
-
"text": "import {
|
|
74
|
+
"text": "import { Git, Lfs, Merges, MergeQueue, Objects, Repos, Rest, SignIn, Tokens } from '@ref0/git';\nimport type { MergeInput, MergePlan } from '@ref0/git';\nimport {\n Apps,\n Deployments,\n GitHub,\n Inbox,\n IssueLists,\n Releases,\n RepoGrants,\n Search,\n Streams,\n Webhooks,\n} from '@ref0/github';\nimport * as Collaborators from '@ref0/github/collaborators';\nimport * as Languages from '@ref0/github/languages';\nimport {\n layer,\n layerR2,\n layerR2Signed,\n toJobObject,\n toRecordsObject,\n} from '@ref0/infra/cloudflare';\nimport xdiff from '@ref0/xdiff-wasm/xdiff.wasm';\nimport { env as bindings } from 'cloudflare:workers';\nimport * as Effect from 'effect/Effect';\nimport * as FetchHttpClient from 'effect/http/FetchHttpClient';\nimport * as Layer from 'effect/Layer';\n\nimport {\n hostLayer,\n onHost,\n type OnHost,\n peopleOver,\n repoRecordsOn,\n tokensOn,\n} from './context/host.ts';\nimport { repoGrantsDropped } from './context/repo-grants.ts';\nimport { repoIcons } from './context/repo-icons.ts';\nimport type { Env } from './env.ts';\nimport {\n admin,\n approvalPage,\n type GrantsPolicy,\n hostPolicy,\n hostRules,\n type Identify,\n} from './policy.ts';\nimport { privateReposOf } from './private-repos.ts';\nimport { readyAdapter, readyAuth, starterAuth } from './signin/auth.ts';\nimport { avatars } from './signin/avatars.ts';\nimport { appAuth } from './signin/host-session.ts';\nimport { orgsOver } from './signin/orgs.ts';\nimport { grantsOver } from './signin/repo-grants.ts';\nimport { sealKey } from './signin/seal.ts';\n\n// SAFETY: `wrangler.jsonc` binds the objects, the bucket and D1 and sets `APP_ORIGIN`; the\n// secrets come from `wrangler secret put`, or `.dev.vars` locally.\nexport const env = bindings as Env;\n\nconst {\n R2_ACCOUNT_ID: accountId,\n R2_ACCESS_KEY_ID: accessKeyId,\n R2_SECRET_ACCESS_KEY: secretAccessKey,\n} = env;\n\n// With R2's S3 credentials, the bucket signs parts, and a push's pack past 64 MiB may upload to\n// it in parts, past Workers' 100 MB body.\nconst signed =\n accountId === undefined || accessKeyId === undefined || secretAccessKey === undefined\n ? undefined\n : layerR2Signed(env.PACKS, {\n accountId,\n bucket: env.PACKS_BUCKET,\n accessKeyId,\n secretAccessKey,\n });\n\n// With none, Git LFS's bytes go through the Worker, under its CPU and body limits: a warning\n// says so once an isolate, as the runtime builds the bucket.\nconst unsigned = Layer.effectDiscard(\n Effect.logWarning(\n \"LFS: through the Worker (no signing key). Run `ref0-git keys` in the Worker's folder to sign its links straight to R2\",\n ),\n);\n\nconst bucket = signed ?? Layer.merge(layerR2(env.PACKS), unsigned);\n\nconst uploads =\n signed === undefined\n ? Layer.empty\n : Layer.provide(Git.layerUploads({ above: 64 * 1024 * 1024 }), signed);\n\n"
|
|
70
75
|
},
|
|
71
76
|
{
|
|
72
77
|
"slot": "queueMerge",
|
|
73
78
|
"text": "/**\n * How the queue writes an entry's link onto `main`: a merge commit, by the person who added it, as\n * a pull request's merge button writes one, and titled as GitHub titles it for a pull request's\n * entry, keyed `pr-<number>`.\n */\nconst queueMerge = ({ entry, at }: MergeInput): MergePlan => {\n const [owner = ''] = entry.repo.split('/');\n const branch = entry.source.replace(/^refs\\/heads\\//, '');\n const pull = /^pr-([1-9]\\d*)$/.exec(entry.key)?.[1];\n const title =\n pull === undefined ? `Merge ${branch}` : `Merge pull request #${pull} from ${owner}/${branch}`;\n const login = entry.subject?.id ?? entry.actor.id;\n const hostname = new URL(env.APP_ORIGIN).hostname;\n\n return {\n method: 'merge',\n message: `${title}\\n`,\n author: { name: login, email: `${login}@users.noreply.${hostname}`, at, offset: 0 },\n };\n};\n\n"
|
|
74
79
|
},
|
|
75
|
-
"/** The key sessions and host sessions are sealed under, derived once an isolate from its secret. */\nexport const sessionKey = sealKey(env.SESSION_SECRET);\n\n/**\n * Who owns what, and the drop-in's people and orgs, over Better Auth's tables, which `auth` makes\n * at the first request that reads them.\n */\nexport const directory = orgsOver(async () => readyAdapter(await auth()));\n\n/** People's, orgs' and repos' pictures, in Better Auth's database, as `directory` reads it. */\nexport const pictures = avatars(async () => readyAdapter(await auth()));\n\nexport const policy = hostPolicy(directory, {\n origin: env.APP_ORIGIN,\n avatars: pictures,\n privateRepos:
|
|
80
|
+
"/** The key sessions and host sessions are sealed under, derived once an isolate from its secret. */\nexport const sessionKey = sealKey(env.SESSION_SECRET);\n\n/**\n * Who owns what, and the drop-in's people and orgs, over Better Auth's tables, which `auth` makes\n * at the first request that reads them.\n */\nexport const directory = orgsOver(async () => readyAdapter(await auth()));\n\n/** People's, orgs' and repos' pictures, in Better Auth's database, as `directory` reads it. */\nexport const pictures = avatars(async () => readyAdapter(await auth()));\n\n/** Each repo's grants to people, its collaborators, in Better Auth's database, as `directory` reads it. */\nexport const grants = grantsOver(async () => readyAdapter(await auth()));\n\n/**\n * Git's services on the runtime below, in the caller's fiber: the policy reads its repos' records\n * through it within the request it decides, its store calls counted on that request's.\n */\nexport const host: OnHost = onHost(() => runtime);\n\nconst { repoName, repoId } = repoRecordsOn(host);\n\nexport const policy: GrantsPolicy = hostPolicy(directory, {\n origin: env.APP_ORIGIN,\n avatars: pictures,\n privateRepos: privateReposOf(host),\n repoName,\n // Who else may do what on a repo, by its grants, and which repo a token over one names now.\n grants,\n repoId,\n});\n\n",
|
|
76
81
|
{
|
|
77
82
|
"slot": "adapter",
|
|
78
83
|
"text": "/** The records and job objects, and the bucket. */\nconst adapter = Layer.merge(layer({ records: env.RECORDS, jobs: env.JOBS }), bucket);"
|
|
@@ -87,7 +92,7 @@ var templates_default = {
|
|
|
87
92
|
"slot": "releases",
|
|
88
93
|
"text": " // A release's assets, in the bucket beside the packs.\n Releases.layer(),\n"
|
|
89
94
|
},
|
|
90
|
-
" // `org:` and `user:` search an owner's repos, its private ones by the policy's hook.\n Search.layer({ readableRepos: policy.readableRepos }),\n // Without it, a repo's `language` and `license` answer null.\n Languages.layer(),\n // A repo's and an org's hooks, each delivery a `fetch`, and GitHub Apps, whose hooks they send.\n // @effect-diagnostics-next-line unstableApiUsage:off\n Layer.provideMerge(Apps.layer(), Webhooks.layer().pipe(Layer.provide(FetchHttpClient.layer))),\n // GitHub's Event Streams over Git's event feeds, which a pull request's page follows.\n Streams.layer(),\n // A deleted repo's icon, removed however the repo was deleted.\n repoIcons(pictures),\n).pipe(\n Layer.provideMerge(GitHub.layer()),\n Layer.provideMerge(peopleOver(policy.people)),\n Layer.provideMerge(\n Layer.mergeAll(\n Rest.layer(),\n",
|
|
95
|
+
" // `org:` and `user:` search an owner's repos, its private ones by the policy's hook.\n Search.layer({ readableRepos: policy.readableRepos }),\n // Each person's index of the issues and pull requests they take part in, across every repo:\n // `/issues`, an org's issues, and a search that names no repo read it.\n IssueLists.layer(),\n // Without it, a repo's `language` and `license` answer null.\n Languages.layer(),\n // A repo's and an org's hooks, each delivery a `fetch`, and GitHub Apps, whose hooks they send.\n // @effect-diagnostics-next-line unstableApiUsage:off\n Layer.provideMerge(Apps.layer(), Webhooks.layer().pipe(Layer.provide(FetchHttpClient.layer))),\n // GitHub's Event Streams over Git's event feeds, which a pull request's page follows.\n Streams.layer(),\n // A deleted repo's icon, removed however the repo was deleted.\n repoIcons(pictures),\n // A repo's collaborators and teams, which its settings list and change.\n Collaborators.layer(),\n // A deleted repo's collaborators, removed however the repo was deleted.\n repoGrantsDropped(grants),\n).pipe(\n Layer.provideMerge(GitHub.layer()),\n // The directory, and a repo's collaborators, which its settings list and change: the drop-in\n // takes both as it's built.\n Layer.provideMerge(Layer.merge(peopleOver(policy.people), RepoGrants.layer(policy.repoGrants))),\n Layer.provideMerge(\n Layer.mergeAll(\n Rest.layer(),\n",
|
|
91
96
|
{
|
|
92
97
|
"slot": "lfs",
|
|
93
98
|
"text": " // Git LFS, its objects in the bucket beside the packs. An upload through the Worker may use\n // `limits.cpu_ms` from wrangler.jsonc: raise both together.\n Lfs.layer({ cpuMs: 300_000 }),\n"
|
|
@@ -100,22 +105,22 @@ var templates_default = {
|
|
|
100
105
|
"slot": "queue",
|
|
101
106
|
"text": " // Each repo's `main` has a merge queue, beside the merge button: its protection still takes\n // a direct merge, as GitHub's does on a branch whose rules don't ask for the queue.\n MergeQueue.layer({ target: 'refs/heads/main', keys: 'once', merge: queueMerge }),\n"
|
|
102
107
|
},
|
|
103
|
-
" // The device flow's sign-in for `gh` and `ref0-git login`, which the page decides in the\n // person's session, from the Better Auth below and Git's own `identify`.\n SignIn.layer({\n approvalPage: approvalPage({\n auth: () => auth(),\n sealKey: sessionKey,\n identify: (request): ReturnType<Identify> =>
|
|
108
|
+
" // The device flow's sign-in for `gh` and `ref0-git login`, which the page decides in the\n // person's session, from the Better Auth below and Git's own `identify`.\n SignIn.layer({\n approvalPage: approvalPage({\n auth: () => auth(),\n sealKey: sessionKey,\n identify: (request): ReturnType<Identify> => host(Git.identify(request)),\n origin: env.APP_ORIGIN,\n }),\n }),\n ),\n ),\n Layer.provideMerge(Tokens.layer()),\n",
|
|
104
109
|
{
|
|
105
110
|
"slot": "xdiff",
|
|
106
111
|
"text": " Layer.provideMerge(Merges.layer({ xdiff })),"
|
|
107
112
|
},
|
|
108
|
-
"\n);\n\n/**\n * The whole host, one runtime a process: Git and its features over the records, the jobs and the\n * bucket, as the policy decides, with `hostRules` its push rules.\n */\nexport const runtime =
|
|
113
|
+
"\n);\n\n/**\n * The whole host, one runtime a process: Git and its features over the records, the jobs and the\n * bucket, as the policy decides, with `hostRules` its push rules.\n */\nexport const runtime = Git.runtime(\n hostLayer(adapter, objects, features, {\n authorize: policy.authorize,\n auth: appAuth({ adminToken: env.ADMIN_TOKEN, admin, key: sessionKey }),\n authorizeGitHub: policy.authorizeGitHub,\n rules: hostRules.map((each) => each.rule),\n }),\n);\n\n/**\n * Better Auth, made at a request that needs it, not the isolate's start: who signs up and in, in\n * `AUTH_DB`, each session with a Git token of its own. It's kept once a request's check settles.\n */\nexport const auth = readyAuth(() =>\n starterAuth({\n",
|
|
109
114
|
{
|
|
110
115
|
"slot": "database",
|
|
111
116
|
"text": " database: env.AUTH_DB,"
|
|
112
117
|
},
|
|
113
|
-
"\n secret: env.SESSION_SECRET,\n origin: env.APP_ORIGIN,\n signUp: env.SIGN_UP !== 'closed',\n key: sessionKey,\n tokens:
|
|
118
|
+
"\n secret: env.SESSION_SECRET,\n origin: env.APP_ORIGIN,\n signUp: env.SIGN_UP !== 'closed',\n key: sessionKey,\n tokens: tokensOn(host),\n",
|
|
114
119
|
{
|
|
115
120
|
"slot": "ipHeader",
|
|
116
121
|
"text": " // Cloudflare's own, which it sets on every request in place of any the caller sent.\n ipHeader: 'cf-connecting-ip',\n"
|
|
117
122
|
},
|
|
118
|
-
" ownsRepos:
|
|
123
|
+
" ownsRepos: (login) =>\n Effect.match(host(Repos.list({ actor: admin, prefix: `${login}/`, page: { limit: 1 } })), {\n onFailure: () => true,\n onSuccess: (listed) => listed.items.length > 0,\n }),\n }),\n);\n",
|
|
119
124
|
{
|
|
120
125
|
"slot": "classes",
|
|
121
126
|
"text": "\n/** The records objects, one per scope, as `wrangler.jsonc`'s `class_name`s name them. */\nexport const Records = toRecordsObject(runtime);\n\n/** The job objects, one per scope and job, which a records object's alarm rings. */\nexport const Jobs = toJobObject(runtime);\n"
|
|
@@ -180,7 +185,7 @@ var templates_default = {
|
|
|
180
185
|
"tsconfig.json": "// The app's pages, routes, clients and sign-in: DOM, as a browser runs them, and Start's server\n// functions beside them. The Worker's entry and Git are `tsconfig.worker.json`'s, typed by\n// workers-types with no DOM, and the tests `tsconfig.test.json`'s, in Node. Each file is in the\n// one whose globals it runs with, and the root's `tsconfig.json` references all three.\n{\n \"extends\": \"./tsconfig.base.json\",\n \"compilerOptions\": {\n \"composite\": true,\n \"jsx\": \"react-jsx\",\n \"lib\": [\"ES2023\", \"DOM\", \"DOM.Iterable\"],\n \"tsBuildInfoFile\": \"./node_modules/.cache/tsconfig.tsbuildinfo\",\n \"types\": [\"vite-plus/client\"]\n },\n \"include\": [\"src/**/*.ts\", \"src/**/*.tsx\", \"generated/**/*.ts\"],\n \"exclude\": [\n \"src/**/*.test.ts\",\n \"src/**/testing/**\",\n \"src/seed/**\",\n \"src/server.ts\",\n \"src/git.ts\",\n \"src/policy.ts\",\n \"src/env.ts\",\n \"src/signin/approval.ts\",\n \"src/camo/lookup.ts\",\n \"src/camo/node.ts\",\n \"src/markdown/words-plugin.ts\"\n ]\n}\n",
|
|
181
186
|
"tsconfig.worker.json": "// The Worker, typed as Cloudflare types one: workers-types' globals and no DOM, so `Request` and\n// `Response` are a Worker's. The pages are `tsconfig.app.json`'s, and the files both run, sealing\n// and names, are in each.\n{\n \"extends\": \"./tsconfig.base.json\",\n \"compilerOptions\": {\n \"composite\": true,\n \"lib\": [\"ES2023\"],\n \"tsBuildInfoFile\": \"./node_modules/.cache/tsconfig.worker.tsbuildinfo\",\n \"types\": [\"@cloudflare/workers-types\", \"vite-plus/client\"]\n },\n \"include\": [\n \"src/server.ts\",\n \"src/git.ts\",\n \"src/policy.ts\",\n \"src/env.ts\",\n \"src/context/**/*.ts\",\n \"src/names/**/*.ts\",\n \"src/seed/**/*.ts\",\n \"src/signin/approval.ts\",\n \"src/signin/seal.ts\"\n ],\n \"exclude\": [\"src/**/*.test.ts\", \"src/seed/testing/built-app.ts\"]\n}\n"
|
|
182
187
|
},
|
|
183
|
-
nodeServer: "import { Git } from '@ref0/git';\nimport { Records } from '@ref0/infra';\nimport handler, { createServerEntry } from '@tanstack/react-start/server-entry';\nimport * as Effect from 'effect/Effect';\n\nimport { nodeFetch } from './camo/node.ts';\nimport { imageProxy } from './camo/proxy.ts';\nimport type { AppContext } from './context/context.ts';\nimport { auth, directory, env, pictures, policy,
|
|
188
|
+
nodeServer: "import { Git, Repos } from '@ref0/git';\nimport { Records } from '@ref0/infra';\nimport handler, { createServerEntry } from '@tanstack/react-start/server-entry';\nimport * as Effect from 'effect/Effect';\n\nimport { nodeFetch } from './camo/node.ts';\nimport { imageProxy } from './camo/proxy.ts';\nimport type { AppContext, HostGit } from './context/context.ts';\nimport { auth, directory, env, host, pictures, policy, runtime, sessionKey } from './git.ts';\nimport { routeOn, tokensOn } from './context/host.ts';\nimport { ingressOf } from './ingress.ts';\nimport { hostRules } from './policy.ts';\nimport { shownRules } from './settings/rules.ts';\nimport { deviceAttemptAnswer, deviceAttemptGate } from './signin/attempts.ts';\nimport { sessionCookieOf, sessionEnder, sessionFrom, sessionIdFrom } from './signin/auth.ts';\nimport { clientIpHeader, withClientIp } from './signin/client-ip.ts';\nimport { withoutHostSession } from './signin/host-session.ts';\n\n/**\n * The device page's attempts (#1962), counted in Git's records, by the address the platform sets\n * and the session Better Auth checks, before Git reads a code.\n */\nconst gate = deviceAttemptGate({\n answer: (who) => runtime.runPromise(deviceAttemptAnswer(who)),\n addressHeader: clientIpHeader,\n session: async (request) => sessionIdFrom(await auth())(request),\n});\n\n/** The front door, then Git's routes, the drop-in's among them, for outside and the app alike. */\nconst { owned, api } = ingressOf({ gate, git: routeOn(runtime) });\n\n/** Git's own calls, as host calls read them, each an Effect, which the server function runs. */\nconst git = {\n repos: { list: (input) => host(Repos.list(input)) },\n tokens: tokensOn(host),\n} satisfies HostGit;\n\n/**\n * The image proxy (Q860): a text's remote images load through `/_camo/`, and the pages' CSP loads\n * no other. Without it, and with `IMAGE_PROXY=off`, they load from their own origin.\n */\nconst images = imageProxy({\n secret: env.SESSION_SECRET,\n appOrigin: env.APP_ORIGIN,\n setting: env.IMAGE_PROXY,\n fetch: nodeFetch,\n});\n\n/** The host's push rules, as a repo's settings show them. */\nconst rules = shownRules(hostRules);\n\n/** Whether the dev seed runs: `vite.config.ts` sets it true only under the dev server. */\ndeclare const __DEV_SEED__: boolean;\n\nlet seeding: Promise<void> | undefined;\n\n/**\n * In dev only, the seed, once an isolate, before its first answer: Pip and Mo sign up with\n * `DEMO_PASSWORD` and make the demo org `acme`, a host with no repos gets its repos, and a seed cut\n * off finishes. It signs them up in whatever database `AUTH_DB` points at under the dev server,\n * the local D1 unless the host sets `\"remote\": true` on it, so `.dev.vars.example`'s known\n * `DEMO_PASSWORD` is changed before the dev server points at a remote database.\n */\nconst seeded = () => {\n seeding ??= Promise.all([import('./signin/seed-people.ts'), import('./seed/seed.ts')])\n .then(async ([{ seedPeople }, { seed }]) => {\n if (env.DEMO_PASSWORD === undefined) throw new Error('Set DEMO_PASSWORD in .env');\n\n await seedPeople(await auth(), { origin: env.APP_ORIGIN, password: env.DEMO_PASSWORD });\n\n return seed({\n fetch: api,\n origin: env.APP_ORIGIN,\n adminToken: env.ADMIN_TOKEN,\n // Git's records, on its runtime, keep the seed's progress beside Git's own.\n store: {\n read: (scope, reads) => runtime.runPromise(Records.read(scope, reads)),\n commit: (scope, change) => runtime.runPromise(Records.commit(scope, change)),\n },\n });\n })\n .then(\n () => undefined,\n (cause: unknown) =>\n runtime.runPromise(\n Effect.logError('The seed stopped, and goes on at the next start', cause),\n ),\n );\n\n return seeding;\n};\n\n/** Q8's order: the drop-in, then Git, then the app. A URL one owns never falls through. */\nexport default createServerEntry({\n fetch: images.around(async (incoming) => {\n // A host session is the app's server's to set in this Worker, never a caller's to send\n // (Q520): every route, the APIs, the app and any upgrade, sees the request without one.\n // The caller's address, for the rate limit, set by this server in place of any the caller sent.\n const request = withoutHostSession(withClientIp(incoming, env.CLIENT_IP_HEADER));\n if (__DEV_SEED__) await seeded();\n\n const answered = await owned(request);\n if (answered !== undefined) return answered;\n\n const context: AppContext = {\n api,\n sealKey: await sessionKey,\n // Better Auth is made only for a request that reads it, and checked in that request (#480).\n auth: async (each) => (await auth()).handler(each),\n session: async (each) => sessionFrom(await auth(), sessionKey)(each),\n endSession: async (each) => sessionEnder(await auth())(each),\n sessionCookie: async () => sessionCookieOf(await auth())(),\n // The server functions' own edge: who a credential names, as their Promise reads it.\n identify: (each) =>\n runtime.runPromise(\n Effect.match(Git.identify(each), {\n onFailure: (error) => ({ kind: 'error', error }) as const,\n onSuccess: (value) => ({ kind: 'success', value }) as const,\n }),\n ),\n authorize: policy.authorize,\n authorizeGitHub: policy.authorizeGitHub,\n rules,\n avatars: pictures,\n accounts: directory,\n git,\n images,\n };\n\n return handler.fetch(request, { context });\n }),\n});\n",
|
|
184
189
|
nodeConfigs: { "tsconfig.json": "// The app's pages, routes, clients and sign-in: DOM, as a browser runs them, and Start's server\n// functions beside them. The server and Git are `tsconfig.server.json`'s, typed by\n// Node's types with no DOM, and the tests `tsconfig.test.json`'s, in Node. Each file is in the\n// one whose globals it runs with, and the root's `tsconfig.json` references all three.\n{\n \"extends\": \"./tsconfig.base.json\",\n \"compilerOptions\": {\n \"composite\": true,\n \"jsx\": \"react-jsx\",\n \"lib\": [\"ES2023\", \"DOM\", \"DOM.Iterable\"],\n \"tsBuildInfoFile\": \"./node_modules/.cache/tsconfig.tsbuildinfo\",\n \"types\": [\"vite-plus/client\"]\n },\n \"include\": [\"src/**/*.ts\", \"src/**/*.tsx\", \"generated/**/*.ts\"],\n \"exclude\": [\n \"src/**/*.test.ts\",\n \"src/**/testing/**\",\n \"src/seed/**\",\n \"src/server.ts\",\n \"src/git.ts\",\n \"src/policy.ts\",\n \"src/env.ts\",\n \"src/signin/approval.ts\",\n \"src/camo/lookup.ts\",\n \"src/camo/node.ts\",\n \"src/markdown/words-plugin.ts\"\n ]\n}\n" },
|
|
185
190
|
nodeServerConfig: "// The server, typed as Node runs it: Node's globals and no DOM. The pages are `tsconfig.json`'s,\n// and the files both run, sealing and names, are in each.\n{\n \"extends\": \"./tsconfig.base.json\",\n \"compilerOptions\": {\n \"composite\": true,\n \"lib\": [\"ES2023\"],\n \"tsBuildInfoFile\": \"./node_modules/.cache/tsconfig.server.tsbuildinfo\",\n \"types\": [\"node\", \"vite-plus/client\"]\n },\n \"include\": [\n \"src/server.ts\",\n \"src/camo/lookup.ts\",\n \"src/camo/node.ts\",\n \"server/**/*.ts\",\n \"scripts/**/*.ts\",\n \"src/git.ts\",\n \"src/policy.ts\",\n \"src/env.ts\",\n \"src/context/**/*.ts\",\n \"src/names/**/*.ts\",\n \"src/seed/**/*.ts\",\n \"src/signin/approval.ts\",\n \"src/signin/seal.ts\"\n ],\n \"exclude\": [\"src/**/*.test.ts\", \"src/seed/testing/built-app.ts\"]\n}\n",
|
|
186
191
|
nodeVite: "import tailwindcss from '@tailwindcss/vite';\nimport { tanstackStart } from '@tanstack/react-start/plugin/vite';\nimport viteReact from '@vitejs/plugin-react';\nimport { nitro } from 'nitro/vite';\nimport { defineConfig } from 'vite-plus';\n\nimport { wordsMemoryMax } from './src/markdown/words-plugin.ts';\n\n// Start's server build runs in Node through Nitro, which scans `server/` for the jobs' plugin.\nexport default defineConfig(({ command }) => ({\n // The dev seed is on only under the dev server, `vp dev`: every build drops it and its imports,\n // whatever its mode or `NODE_ENV`.\n define: { __DEV_SEED__: JSON.stringify(command === 'serve') },\n // The diff and highlight Workers are modules: `@pierre/diffs`' loads its highlighter lazily.\n worker: { format: 'es' },\n plugins: [\n // Words' WebAssembly under the drop-in's most on its memory (#1098): in Node, the module is\n // compiled at load from words' own bytes, edited.\n wordsMemoryMax(),\n tanstackStart({\n // NodeNext, as the repo types it, resolves only imports that name their extension.\n router: { generatedRouteTree: '../generated/routeTree.gen.ts', addExtensions: true },\n }),\n nitro({ serverDir: './server' }),\n viteReact(),\n tailwindcss(),\n ],\n}));\n",
|
|
@@ -200,7 +205,7 @@ var templates_default = {
|
|
|
200
205
|
"\nimport xdiff from '@ref0/xdiff-wasm/xdiff.wasm';\nimport { env as bindings } from 'cloudflare:workers';\n",
|
|
201
206
|
{
|
|
202
207
|
"slot": "effectImports",
|
|
203
|
-
"text": "import * as Context from 'effect/Context';\nimport * as Effect from 'effect/Effect';\nimport * as Layer from 'effect/Layer';\nimport * as
|
|
208
|
+
"text": "import * as Context from 'effect/Context';\nimport * as Effect from 'effect/Effect';\nimport * as Layer from 'effect/Layer';\nimport * as Option from 'effect/Option';\nimport * as Redacted from 'effect/Redacted';\n"
|
|
204
209
|
},
|
|
205
210
|
"\nimport type { Env } from ",
|
|
206
211
|
{
|
|
@@ -215,7 +220,7 @@ var templates_default = {
|
|
|
215
220
|
", and sets `ADMINS`.\nconst env = bindings as Env;\n\n/**\n * Who `ADMIN_TOKEN` signs in as, while it's set: it mints a listed admin's first `admin` token, and\n * nothing else. No login can be it.\n */\nconst bootstrap = { id: '_admin' };\n\n/**\n * The host's admins: `ADMINS`, from `wrangler.jsonc`'s vars, logins between commas. Each signs in\n * as themselves with an `admin` token, and makes repos, mints tokens and pushes. Adding one is a\n * vars edit and a deploy. A login that can't be one stops the Worker's start, so a deploy that\n * names it fails.\n */\nconst admins = new Set(\n (env.ADMINS ?? '')\n .split(',')\n .map((login) => login.trim())\n .filter((login) => login !== ''),\n);\n\nfor (const login of admins) {\n if (login === bootstrap.id || new TextEncoder().encode(login).length > maxActorIdLength) {\n throw new Error(`ADMINS names '${login}', which can't be a login`);\n }\n}\n\n",
|
|
216
221
|
{
|
|
217
222
|
"slot": "bucket",
|
|
218
|
-
"text": "const {\n R2_ACCOUNT_ID: accountId,\n R2_ACCESS_KEY_ID: accessKeyId,\n R2_SECRET_ACCESS_KEY: secretAccessKey,\n} = env;\n\n// With R2's S3 credentials, the bucket signs parts, and a push's pack past 64 MiB may upload to\n// it in parts, past Workers' 100 MB body.\nconst signed =\n accountId === undefined || accessKeyId === undefined || secretAccessKey === undefined\n ? undefined\n : layerR2Signed(env.PACKS, {\n accountId,\n bucket: env.PACKS_BUCKET,\n accessKeyId,\n secretAccessKey,\n });\n\n/** The records and job objects, and the packs' bucket. */\nconst adapter = Layer.merge(\n layer({ records: env.RECORDS, jobs: env.JOBS }),\n signed ?? layerR2(env.PACKS),\n);\n\n"
|
|
223
|
+
"text": "const {\n R2_ACCOUNT_ID: accountId,\n R2_ACCESS_KEY_ID: accessKeyId,\n R2_SECRET_ACCESS_KEY: secretAccessKey,\n} = env;\n\n// With R2's S3 credentials, the bucket signs parts, and a push's pack past 64 MiB may upload to\n// it in parts, past Workers' 100 MB body.\nconst signed =\n accountId === undefined || accessKeyId === undefined || secretAccessKey === undefined\n ? undefined\n : layerR2Signed(env.PACKS, {\n accountId,\n bucket: env.PACKS_BUCKET,\n accessKeyId,\n secretAccessKey,\n });\n\n// With none, Git LFS's bytes go through the Worker, under its CPU and body limits: a warning\n// says so once an isolate, as the runtime builds the bucket.\nconst unsigned = Layer.effectDiscard(\n Effect.logWarning(\n \"LFS: through the Worker (no signing key). Run `ref0-git keys` in the Worker's folder to sign its links straight to R2\",\n ),\n);\n\n/** The records and job objects, and the packs' bucket. */\nconst adapter = Layer.merge(\n layer({ records: env.RECORDS, jobs: env.JOBS }),\n signed ?? Layer.merge(layerR2(env.PACKS), unsigned),\n);\n\n"
|
|
219
224
|
},
|
|
220
225
|
{
|
|
221
226
|
"slot": "merge",
|
|
@@ -228,7 +233,7 @@ var templates_default = {
|
|
|
228
233
|
},
|
|
229
234
|
{
|
|
230
235
|
"slot": "runtime",
|
|
231
|
-
"text": "/** The bootstrap's sign-in, while `ADMIN_TOKEN` holds one: a Bearer token, or Basic's password. */\nconst auth =\n env.ADMIN_TOKEN === undefined || env.ADMIN_TOKEN === ''\n ? Layer.empty\n : Auth.layer(Auth.bearer({ token: Redacted.make(env.ADMIN_TOKEN), actor: bootstrap }));\n\n/**\n * The whole host, one runtime that every request and job shares: Git and its features over the\n * adapter, deciding with `policy`, and the bootstrap signing in with `auth`.\n */\nexport const runtime =
|
|
236
|
+
"text": "/** The bootstrap's sign-in, while `ADMIN_TOKEN` holds one: a Bearer token, or Basic's password. */\nconst auth =\n env.ADMIN_TOKEN === undefined || env.ADMIN_TOKEN === ''\n ? Layer.empty\n : Auth.layer(Auth.bearer({ token: Redacted.make(env.ADMIN_TOKEN), actor: bootstrap }));\n\n/**\n * The whole host, one runtime that every request and job shares: Git and its features over the\n * adapter, deciding with `policy`, and the bootstrap signing in with `auth`.\n */\nexport const runtime = Git.runtime(\n Git.layer({}, features).pipe(\n Layer.provide(Policy.layer(policy)),\n Layer.provide(auth),\n Layer.provide(Objects.layer()),\n Layer.provideMerge(adapter),\n ),\n);\n\n"
|
|
232
237
|
},
|
|
233
238
|
"/** The records objects, one per scope, as `wrangler.jsonc`'s `class_name`s name them. */\nexport const Records = toRecordsObject(runtime);\n\n/** The job objects, one per scope and job, which a records object's alarm rings. */\nexport const Jobs = toJobObject(runtime);\n"
|
|
234
239
|
],
|
package/dist/init/versions.mjs
CHANGED
|
@@ -56,5 +56,5 @@ const initPacked = (name, at) => {
|
|
|
56
56
|
* the release, or the tarball `--from-checkout` names for that package. One it wrote moves to this
|
|
57
57
|
* run's spec; any other is the person's, a tarball of their own in `vendor/` too, and stays.
|
|
58
58
|
*/
|
|
59
|
-
const initWrote = (name, spec) => spec === "0.
|
|
59
|
+
const initWrote = (name, spec) => spec === "0.20.0" || spec !== void 0 && packedPath(name).test(spec);
|
|
60
60
|
export { catalog, contentNamed, frameworkPackages, initPacked, initWrote, nodeAppPackages, nodePackages, peerPackages, published, release, specOf, storePackages, unpacked, vercelPackages };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ref0-git",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.20.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "ref0-git, the CLI for a Git host built on @ref0/git, and git-remote-ref0, its remote helper",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@effect/platform-node-shared": "4.1.7",
|
|
27
|
-
"@ref0/git": "0.
|
|
28
|
-
"@ref0/infra": "0.
|
|
27
|
+
"@ref0/git": "0.20.0",
|
|
28
|
+
"@ref0/infra": "0.20.0",
|
|
29
29
|
"diff": "9.0.0",
|
|
30
30
|
"effect": "^4.1.7"
|
|
31
31
|
},
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
"@effect/vitest": "4.1.7",
|
|
35
35
|
"@libsql/client": "0.18.0",
|
|
36
36
|
"@libsql/kysely-libsql": "0.4.1",
|
|
37
|
-
"@ref0/github": "0.
|
|
38
|
-
"@ref0/xdiff-wasm": "0.
|
|
37
|
+
"@ref0/github": "0.20.0",
|
|
38
|
+
"@ref0/xdiff-wasm": "0.20.0",
|
|
39
39
|
"@tanstack/react-start": "1.169.7",
|
|
40
40
|
"@types/node": "24.19.4",
|
|
41
41
|
"@types/pg": "8.23.1",
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { createFileRoute } from '@tanstack/react-router';
|
|
2
|
-
|
|
3
|
-
import { AcrossRepos } from '../../../components/states/states.tsx';
|
|
4
|
-
|
|
5
|
-
/** An owner's releases across its repos, which waits on one read across them. */
|
|
6
|
-
export const Route = createFileRoute('/orgs/$owner/releases')({
|
|
7
|
-
component: () => <AcrossRepos what="releases" />,
|
|
8
|
-
});
|