~ knotless Search/
↑↓ move↵ open⇧↵ all results
0
0

Scaffold the host: workspace, console shell, lexicons and checks

Merged chadtmiller.com asked to merge into main from chadtmiller.com/group-host:scaffold
.knotless/workflows/check.ymlnew+17−0
@@ -0,0 +1,17 @@
# Formatting and lints, as `just lint` checks the Rust, on every pull and
# push to main; test.yml runs the tests.
#
# The image is the Rust `just lint` runs locally, so a newer release's new
# lints land on purpose. The build and the toolchain's components are kept
# between runs, so a push lints only what it changed.
image: rust:1.98
# A pre-flight: the merge queue takes a pull into a batch only once this
# has passed at its head, so one that does not build fails no batch.
queue: first
on:
push: {refs: [refs/heads/main]}
pull: {base: [refs/heads/main, refs/heads/feature/*]}
cache: [target, /usr/local/cargo/registry, /usr/local/rustup]
steps:
# cargo fmt --check, then clippy over the workspace, warnings denied.
- uses: chadtmiller.com/steps/rust-lint@1
.knotless/workflows/lexicons.ymlnew+17−0
@@ -0,0 +1,17 @@
# The lexicons, as `just lex` checks them: goat's lint, what it does not
# see, and that they only grow from main's (harness/lexicons.mjs). goat is
# kept between runs.
image: node:24.22.1
on:
push: {refs: [refs/heads/main]}
pull:
base: [refs/heads/main, refs/heads/feature/*]
paths: [lexicons/**, harness/lexicons.mjs, .knotless/workflows/lexicons.yml]
cache: [/opt/goat]
steps:
- name: goat
run: |
[ "$(/opt/goat/goat --version 2>/dev/null)" = "goat version 0.2.8" ] || curl -fsSL https://github.com/bluesky-social/goat/releases/download/v0.2.8/goat_Linux_x86_64.tar.gz | tar -xz -C /opt/goat goat
/opt/goat/goat --version
- name: lexicons
run: PATH=/opt/goat:$PATH node harness/lexicons.mjs
.knotless/workflows/test.ymlnew+19−0
@@ -0,0 +1,19 @@
# The tests, under `just cov`'s gate: every test binary, failing under 100%
# of lines or functions. A binary the tests start (the host, the command)
# is counted as it runs, so it is told to stop rather than killed.
image: rust:1.98
# A pre-flight, as check is: the merge queue takes a pull into a batch only
# once this has passed at its head.
queue: first
on:
push: {refs: [refs/heads/main]}
pull: {base: [refs/heads/main, refs/heads/feature/*]}
cache: [target, /usr/local/cargo/registry, /usr/local/rustup, /opt/tools]
steps:
- uses: chadtmiller.com/steps/cargo-llvm-cov@1
with: {version: 0.9.1}
- name: test
run: |
export PATH=/opt/tools:$PATH
cargo llvm-cov --workspace --ignore-filename-regex '(tests/|harness/)' \
--fail-under-lines 100 --fail-under-functions 100 --show-missing-lines
.knotless/workflows/web.ymlnew+24−0
@@ -0,0 +1,24 @@
# The console's checks, as `just lint` runs them: that each component uses
# only its own layer and those below (harness/layers.mjs), and svelte-check,
# which fails on any warning. The packages are kept between runs and
# installed again only when the lockfile changes.
image: node:24.22.1
# Pushes to main, and pulls that change the pages, the lexicons their types
# are made from, the layers' check or this file. A pull changing none passes
# at once, noted as skipped.
on:
push: {refs: [refs/heads/main]}
pull:
base: [refs/heads/main, refs/heads/feature/*]
paths: [web/**, lexicons/**, harness/layers.mjs, .knotless/workflows/web.yml, .knotless/uses.lock]
cache: [web/node_modules]
steps:
- uses: chadtmiller.com/steps/npm-ci@1
name: packages
with: {dir: web}
- name: layers
run: node harness/layers.mjs
- name: svelte-check
run: cd web && npm run check
- name: build
run: cd web && npm run build
.knotless/issue.mdnew+25−0
@@ -0,0 +1,25 @@
<!-- Title: the symptom, not the cure, at most 72 characters: "A group
created with no roles lists no members". For a request, what
you cannot do: "No way to move a group's handle", and keep
only "What happened", as what you were trying to do and what
stopped you. -->
## What happened
<!-- The command, tool call or page, and exactly what it said: paste
errors and output as text, not a paraphrase. -->
## How to see it
<!-- Steps someone else can follow, from a fresh login if they can, and
the repository, pull or run's URI. This matters most and is the
hardest part to give: say which steps you are unsure of. A pull or
issue of this repository named by its bare at:// URI, not in
`code`, shows as a link with its title. -->
## What you expected
## Where
<!-- a local host or a deployed one; the console, the opensocial command, or
MCP; the commit you built from. -->
.knotless/pull.mdnew+37−0
@@ -0,0 +1,37 @@
<!-- Title: what the host does once this lands, as main's log reads:
"Groups are created with their spaces and roles". At most 72
characters, an optional crate prefix ("atproto: …"), no
period, never only the activity ("Fix bug", "Update host").
The squash commit takes this title and body as its message, so
say everything here: a link is no substitute for the reason.
Delete a section that has nothing to say, but keep at least one:
a body with none of these headings is refused.
Name a pull or issue of this repository by its at:// URI, bare,
not in `code`: its page shows it as a link with its title, and an
issue named so lists this pull on its own page. -->
## What changes
<!-- What someone running a group, calling the host, or reading the code, finds different.
One bold-led paragraph per part when there are several. -->
## Why
<!-- The problem, and why this way over the others considered.
"Fixes <issue's page or at:// URI>" closes it as this merges; say
what it was all the same. -->
## How it was checked
<!-- Tests added or run, and which of the TypeScript host's tests they
port. What is left to CI. -->
## Shortcomings
<!-- What it does not do yet that the TypeScript host does, what was not
run, what could go wrong. -->
## Review
<!-- Optional: the kind of review wanted (a quick look, the design,
one risky part) and where to start reading. -->
.knotless/uses.locknew+17−0
@@ -0,0 +1,17 @@
# Written by `knotless uses update`. Commit it: runs read it.
chadtmiller.com/steps/cargo-llvm-cov@1:
version: 1.0.0
commit: 686cdbb38978730bb1ba5d1c999967e48497ce15
release: at://did:plc:bcgltzqazw5tb6k2g3ttenbj/dev.knotless.release/3mza7iq7tundv.tbnmqntp7ufhx7yd6i3rdqewys.sjjb7q6l3fsl3spvqsuzdoe73w
chadtmiller.com/steps/node@1:
version: 1.0.0
commit: 686cdbb38978730bb1ba5d1c999967e48497ce15
release: at://did:plc:bcgltzqazw5tb6k2g3ttenbj/dev.knotless.release/3mza7iq7tundv.qespbvwvof6xwjdaedpzq3koia.sjjb7q6l3fsl3spvqsuzdoe73w
chadtmiller.com/steps/npm-ci@1:
version: 1.0.0
commit: 686cdbb38978730bb1ba5d1c999967e48497ce15
release: at://did:plc:bcgltzqazw5tb6k2g3ttenbj/dev.knotless.release/3mza7iq7tundv.dzyz2ceqihhxzgk2f2637ygpfw.sjjb7q6l3fsl3spvqsuzdoe73w
chadtmiller.com/steps/rust-lint@1:
version: 1.0.0
commit: 686cdbb38978730bb1ba5d1c999967e48497ce15
release: at://did:plc:bcgltzqazw5tb6k2g3ttenbj/dev.knotless.release/3mza7iq7tundv.zvxvlxa6fe7s4pnwsnmgmm63aj.sjjb7q6l3fsl3spvqsuzdoe73w
crates/atproto/src/lib.rsnew+8−0
@@ -0,0 +1,8 @@
//! The atproto a group host needs, written for it rather than taken from a
//! framework, as knotless writes its own: DRISL (DAG-CBOR) and CIDs, the
//! keys a repo and a PLC operation are signed with, the Merkle search tree
//! a repo's records hang from, CAR files, PLC operations, and the
//! service-auth tokens one server hands another.
//!
//! Each part arrives with the pull that first needs it; see
//! `docs/design/README.md` for the order.
crates/atproto/Cargo.tomlnew+9−0
@@ -0,0 +1,9 @@
[package]
name = "atproto"
description = "The atproto a group host needs, kept small: DRISL, CIDs, keys, the MST, CAR files, PLC operations and service auth"
version.workspace = true
edition.workspace = true
license.workspace = true
rust-version.workspace = true
[dependencies]
crates/group-host/src/config.rsnew+62−0
@@ -0,0 +1,62 @@
//! What the host is told by its environment: where it answers, who it is,
//! and where its groups' handles and data live. Every variable is in
//! `docs/reference/config.md`.
use anyhow::{Context, Result, bail};
use std::path::PathBuf;
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Config {
/// The port it listens on, `PORT`; 0 for any free one.
pub port: u16,
/// Its origin, `PUBLIC_URL`, with no trailing slash.
pub public_url: String,
/// Its own DID, `SERVICE_DID`: `did:web:` of the public URL's host
/// unless set.
pub service_did: String,
/// The domain its groups' handles are made under, `HANDLE_DOMAIN`,
/// with its leading dot: `.groups.example.com`.
pub handle_domain: String,
/// The database, blobs and keys, `DATA_DIR`.
pub data_dir: PathBuf,
}
impl Config {
/// The config `var` names, as `std::env::var` would read it; the
/// environment's own with [`Config::from_env`].
pub fn from(var: impl Fn(&str) -> Option<String>) -> Result<Config> {
let port = match var("PORT") {
Some(p) => p.parse().with_context(|| format!("PORT is no port: {p}"))?,
None => 2600,
};
let public_url = var("PUBLIC_URL")
.unwrap_or_else(|| format!("http://localhost:{port}"))
.trim_end_matches('/')
.to_string();
let Some(host) = public_url
.strip_prefix("https://")
.or_else(|| public_url.strip_prefix("http://"))
.filter(|h| !h.is_empty() && !h.contains('/'))
else {
bail!("PUBLIC_URL is no origin: {public_url}");
};
let service_did =
var("SERVICE_DID").unwrap_or_else(|| format!("did:web:{}", host.replace(':', "%3A")));
let handle_domain = var("HANDLE_DOMAIN").unwrap_or_else(|| ".test".into());
if !handle_domain.starts_with('.') {
bail!("HANDLE_DOMAIN starts with a dot: .{handle_domain}");
}
let data_dir = var("DATA_DIR").unwrap_or_else(|| "data".into()).into();
Ok(Config {
port,
public_url,
service_did,
handle_domain,
data_dir,
})
}
pub fn from_env() -> Result<Config> {
Config::from(|name| std::env::var(name).ok())
}
}
crates/group-host/src/lib.rsnew+63−0
crates/group-host/src/main.rsnew+12−0
crates/group-host/src/xrpc.rsnew+41−0
crates/group-host/tests/config.rsnew+58−0
crates/group-host/tests/serve.rsnew+71−0
crates/group-host/Cargo.tomlnew+22−0
crates/group-host-mcp/src/lib.rsnew+6−0
crates/group-host-mcp/Cargo.tomlnew+10−0
crates/opensocial/src/bin/opensocial.rsnew+12−0
crates/opensocial/src/lib.rsnew+20−0
crates/opensocial/tests/cli.rsnew+26−0
crates/opensocial/Cargo.tomlnew+14−0
docs/design/README.mdnew+88−0
docs/reference/cli.mdnew+23−0
docs/reference/config.mdnew+18−0
docs/development.mdnew+26−0
docs/README.mdnew+14−0
harness/layers.mjsnew+42−0
harness/lexicons.mjsnew+232−0
harness/package.jsonnew+6−0
lexicons/community/lexicon/location/address.jsonnew+39−0
lexicons/community/lexicon/location/fsq.jsonnew+27−0
lexicons/community/lexicon/location/geo.jsonnew+26−0
lexicons/community/lexicon/location/hthree.jsonnew+21−0
lexicons/fyi/opensocial/acceptance.jsonnew+21−0
lexicons/fyi/opensocial/access.jsonnew+74−0
lexicons/fyi/opensocial/activateGroup.jsonnew+38−0
lexicons/fyi/opensocial/addRecoveryKey.jsonnew+56−0
lexicons/fyi/opensocial/admitMember.jsonnew+46−0
lexicons/fyi/opensocial/applyLabel.jsonnew+60−0
lexicons/fyi/opensocial/approveAuthorization.jsonnew+53−0
lexicons/fyi/opensocial/assignRoles.jsonnew+51−0
lexicons/fyi/opensocial/basePermissions.jsonnew+126−0
lexicons/fyi/opensocial/cancelJoinRequest.jsonnew+33−0
lexicons/fyi/opensocial/checkGroupHandle.jsonnew+62−0
lexicons/fyi/opensocial/checkImport.jsonnew+74−0
lexicons/fyi/opensocial/completeImport.jsonnew+71−0
lexicons/fyi/opensocial/configure.jsonnew+32−0
lexicons/fyi/opensocial/createAppPassword.jsonnew+55−0
lexicons/fyi/opensocial/createGroup.jsonnew+94−0
lexicons/fyi/opensocial/createInvite.jsonnew+60−0
lexicons/fyi/opensocial/createSpace.jsonnew+79−0
lexicons/fyi/opensocial/deactivateGroup.jsonnew+38−0
lexicons/fyi/opensocial/declaration.jsonnew+26−0
lexicons/fyi/opensocial/declineAuthorization.jsonnew+45−0
lexicons/fyi/opensocial/declineInvite.jsonnew+38−0
lexicons/fyi/opensocial/defs.jsonnew+797−0
797 lines changed: not loaded until asked for.
lexicons/fyi/opensocial/deleteGroup.jsonnew+37−0
lexicons/fyi/opensocial/deleteRole.jsonnew+43−0
lexicons/fyi/opensocial/deleteRule.jsonnew+38−0
lexicons/fyi/opensocial/deleteSpace.jsonnew+43−0
lexicons/fyi/opensocial/denyJoinRequest.jsonnew+44−0
lexicons/fyi/opensocial/ejectMember.jsonnew+48−0
lexicons/fyi/opensocial/getActor.jsonnew+33−0
lexicons/fyi/opensocial/getActorGroups.jsonnew+48−0
lexicons/fyi/opensocial/getActorInvites.jsonnew+57−0
lexicons/fyi/opensocial/getAuthorization.jsonnew+158−0
lexicons/fyi/opensocial/getGroup.jsonnew+75−0
lexicons/fyi/opensocial/getGroupAuth.jsonnew+87−0
lexicons/fyi/opensocial/getJoinRequest.jsonnew+34−0
lexicons/fyi/opensocial/getSpaceBlob.jsonnew+22−0
lexicons/fyi/opensocial/getSubjectHistory.jsonnew+46−0
lexicons/fyi/opensocial/importAccount.jsonnew+105−0
lexicons/fyi/opensocial/importAccountSpace.jsonnew+58−0
lexicons/fyi/opensocial/inbox.jsonnew+15−0
lexicons/fyi/opensocial/invite.jsonnew+35−0
lexicons/fyi/opensocial/label.jsonnew+40−0
lexicons/fyi/opensocial/labeler.jsonnew+76−0
lexicons/fyi/opensocial/leaveGroup.jsonnew+33−0
lexicons/fyi/opensocial/listAppPasswords.jsonnew+50−0
lexicons/fyi/opensocial/listConnectedApps.jsonnew+65−0
lexicons/fyi/opensocial/listGroups.jsonnew+30−0
lexicons/fyi/opensocial/listGroupTokens.jsonnew+128−0
lexicons/fyi/opensocial/listInvites.jsonnew+48−0
lexicons/fyi/opensocial/listJoinRequests.jsonnew+48−0
lexicons/fyi/opensocial/listRecoveryKeys.jsonnew+71−0
lexicons/fyi/opensocial/listSpaceRecords.jsonnew+115−0
lexicons/fyi/opensocial/listSubjects.jsonnew+52−0
lexicons/fyi/opensocial/members.jsonnew+20−0
lexicons/fyi/opensocial/membership.jsonnew+36−0
lexicons/fyi/opensocial/meta.jsonnew+18−0
lexicons/fyi/opensocial/migrateActivate.jsonnew+36−0
lexicons/fyi/opensocial/migrateComplete.jsonnew+38−0
lexicons/fyi/opensocial/migrateExport.jsonnew+50−0
lexicons/fyi/opensocial/migratePrepare.jsonnew+48−0
lexicons/fyi/opensocial/migrateReceive.jsonnew+62−0
lexicons/fyi/opensocial/negateLabel.jsonnew+59−0
lexicons/fyi/opensocial/permissions.jsonnew+66−0
lexicons/fyi/opensocial/profile.jsonnew+97−0
lexicons/fyi/opensocial/provisionGroup.jsonnew+123−0
lexicons/fyi/opensocial/putRole.jsonnew+95−0
lexicons/fyi/opensocial/putRule.jsonnew+60−0
lexicons/fyi/opensocial/removeRecoveryKey.jsonnew+53−0
lexicons/fyi/opensocial/requestJoin.jsonnew+61−0
lexicons/fyi/opensocial/resolveSubject.jsonnew+53−0
lexicons/fyi/opensocial/revokeAppPassword.jsonnew+45−0
lexicons/fyi/opensocial/revokeGroupToken.jsonnew+37−0
lexicons/fyi/opensocial/revokeInvite.jsonnew+38−0
lexicons/fyi/opensocial/role.jsonnew+39−0
lexicons/fyi/opensocial/rule.jsonnew+36−0
lexicons/fyi/opensocial/space.jsonnew+32−0
lexicons/fyi/opensocial/updateGroupHandle.jsonnew+67−0
lexicons/fyi/opensocial/updateProfile.jsonnew+120−0
lexicons/fyi/opensocial/updateSpace.jsonnew+66−0
lexicons/fyi/opensocial/uploadImage.jsonnew+36−0
lexicons/upstream/com/atproto/admin/defs.jsonnew+71−0
lexicons/upstream/com/atproto/label/defs.jsonnew+153−0
lexicons/upstream/com/atproto/managedspace/checkUserAccess.jsonnew+48−0
lexicons/upstream/com/atproto/managedspace/policy.jsonnew+22−0
lexicons/upstream/com/atproto/moderation/createReport.jsonnew+90−0
lexicons/upstream/com/atproto/moderation/defs.jsonnew+99−0
lexicons/upstream/com/atproto/repo/strongRef.jsonnew+15−0
lexicons/upstream/com/atproto/server/defs.jsonnew+38−0
web/src/lib/atoms/Avatar.sveltenew+7−0
web/src/lib/molecules/Empty.sveltenew+14−0
web/src/lib/molecules/GroupRow.sveltenew+13−0
web/src/lib/organisms/GroupList.sveltenew+12−0
web/src/lib/organisms/SiteFooter.sveltenew+1−0
web/src/lib/organisms/SiteHeader.sveltenew+3−0
web/src/lib/templates/Page.sveltenew+10−0
web/src/lib/data.tsnew+40−0
web/src/routes/+layout.sveltenew+10−0
web/src/routes/+page.sveltenew+11−0
web/src/routes/+page.tsnew+12−0
web/src/app.cssnew+47−0
web/src/app.d.tsnew+5−0
web/src/app.htmlnew+12−0
web/src/env.tsnew+8−0
web/src/hooks.server.tsnew+22−0
web/src/tokens.cssnew+121−0
web/static/robots.txtnew+2−0
web/package-lock.jsonnew+2245−0
A large diff, not shown.
web/package.jsonnew+41−0
web/tsconfig.jsonnew+7−0
web/vite.config.tsnew+34−0
.node-versionnew+1−0
AGENTS.mdnew+159−0
Cargo.locknew+1673−0
1673 lines changed: not loaded until asked for.
Cargo.tomlnew+44−0
CLAUDE.mdnew+1−0
Justfilenew+54−0
README.md+16−3