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

The opensocial command starts, inspects, runs, moves and seeds groups

Merged
Merged chadtmiller.com asked to merge into main from chadtmiller.com/group-host:cli/commands

What changes

The opensocial command starts, inspects, runs, moves and seeds groups (crates/opensocial, docs/reference/cli.md). It acts as a person: it signs in at their own PDS (OPENSOCIAL_AS, OPENSOCIAL_PASSWORD, at PDS_URL; an app password is enough), and asks that PDS for a service token for each method it calls on the host (OPENSOCIAL_HOST, its DID OPENSOCIAL_HOST_DID, by default the did:web of its address), as an app does. The commands:

  • create-group <handle> [--name] [--description] [--join]
  • inspect <group>: its roles, members and spaces, as you may see them;
  • membership assign|eject|invite;
  • migrate <group> --to <address> [--to-did], which walks the four steps of moving a group;
  • seed <handle>: a group with two rules, a moderator role, and invites for OPENSOCIAL_SEED_INVITE.

A group or a person is named by handle or DID. A refusal says what the host said.

Why

This is step 9's first part, from the prototype's packages/cli (create-group, inspect, membership, migrate, seeds). Moving the host itself is group-host move-host, because it needs the host's own database and keys. The seed is small, a group to try things on: the prototype's seeds were mostly its sites module's content.

How it was checked

crates/opensocial/tests/commands.rs runs the commands in process. They sign in as the reference PDS's accounts (harness/pds.mjs) and act on hosts of this repo's own, at localhost, since the reference PDS makes service tokens only for a did:web of a name. The tests cover:

  • starting, inspecting, inviting, assigning roles, and a refused eject;
  • seeding, and an empty list said as such;
  • a migration between two hosts;
  • every usage error, a missing or wrong sign-in, and an unreachable PDS or host.

tests/cli.rs runs the binary. just cov is at 100% locally.

Shortcomings

  • There is no command for importing an account: it needs the account's own server to sign a PLC operation, which its owner confirms by email, and that is the console's to walk.
  • The command signs in with a password, not OAuth.

🤖 Generated with Claude Code

Approved

This adds the opensocial commands (create-group, inspect, membership, migrate, seed). They sign in at the person's PDS and get a per-method service token for the host. I read the whole diff and found no bugs. The usage errors, arity checks and the four migrate steps look right. The tests cover each command and each error path.

Two small things, neither blocking:

  • AGENTS.md says an environment variable goes in docs/reference/config.md. This pull lists OPENSOCIAL_AS, OPENSOCIAL_PASSWORD, PDS_URL, OPENSOCIAL_HOST, OPENSOCIAL_HOST_DID and OPENSOCIAL_SEED_INVITE only in cli.md. A search of docs/ for PDS_URL finds nothing. Add them to config.md, or link to cli.md from it.
  • --reason and --message are accepted by every membership subcommand, but only eject uses --reason and only invite uses --message. Elsewhere they are silently ignored, for example assign --reason x. This is harmless, and rejecting them would be a nicer failure.
Merged as 3f81f91