IF Commons GitHub

Serving a store from the command line

0006Active

0006-anyfs-cli-serve · owner if · domain commons

Requirements

FR-001checkpassing

serve LOCATION MUST host the store the word names as WebDAV through serveStore of anyfs-serve, on the loopback by default, on --port N (a free port where left out; a port that is not a whole number from 0 to 65535 MUST be a usage error), and a directory below the root of the store MUST be served as the root of the server.

Enforced (check): .github: cd commons/anyfs-cli && bun run verify — suite/serve.test.ts

Proved by: anyfs-cli/suite/serve.test.ts

Written in: anyfs-cli/src/physical/verbs/serve.ts

Tests: passed: suite/serve.test.ts serve hosts a mount as WebDAV on the loopback, tells the address and the token on standard; passed: suite/serve.test.ts a directory below the root of a store is served as the root, and a port that is not a port

Cited by: AnyFS command line, physical/verbs/serve

FR-002checkpassing

The server MUST be told the token it made, and the verb MUST write the address and the token to standard error (never to the report, so that a pipe of the report does not carry it), and a request without the token MUST be refused.

Enforced (check): .github: cd commons/anyfs-cli && bun run verify — suite/serve.test.ts

Proved by: anyfs-cli/suite/serve.test.ts

Written in: anyfs-cli/src/physical/verbs/serve.ts

Tests: passed: suite/serve.test.ts serve hosts a mount as WebDAV on the loopback, tells the address and the token on standard

FR-003checkpassing

A mount that is read-only, and --read-only, MUST serve nothing that changes the store; an address other than the loopback (--listen ADDRESS) MUST need --allow-host for the names it may be asked for, and --allow-host without --listen MUST be a usage error.

Enforced (check): .github: cd commons/anyfs-cli && bun run verify — suite/serve.test.ts

Proved by: anyfs-cli/suite/serve.test.ts

Written in: anyfs-cli/src/physical/verbs/serve.ts

Tests: passed: suite/serve.test.ts --read-only serves nothing that changes the store, and an exposed address needs the hosts

FR-004checkpassing

The verb MUST wait until the context's signal (SIGINT, SIGTERM) or the world's stop ends the run, and then MUST close the server and end with the report that it stopped; --dry-run MUST say what it would serve and listen on nothing. The verb MUST come through the command line only, never through the tool server.

Enforced (check): .github: cd commons/anyfs-cli && bun run verify — suite/serve.test.ts

Proved by: anyfs-cli/suite/serve.test.ts

Written in: anyfs-cli/src/physical/verbs/serve.ts

Tests: passed: suite/serve.test.ts serve hosts a mount as WebDAV on the loopback, tells the address and the token on standard; passed: suite/serve.test.ts --dry-run says what it would serve and listens on nothing, and the verb is not a tool of t

Cited by: AnyFS command line, physical/verbs/serve

FR-005checkpassing

serve --nfs MUST host the store as NFS version 3 through serveNfs of anyfs-serve on the loopback, MUST let only the uid of the account that started it and root ask (where the computer has uids), MUST write the mount command and the callers to standard error, MUST end as the WebDAV server does, MUST take --nfs-attributes refuse|ignore (anything else a usage error, and without --nfs a usage error) whose default is ignore (a mode, an owner or a time that a client sets is accepted without effect and counted, so that touch and cp -p do not fail; decided by the owner on 2026-11-22), where the library's own default stays refuse (anyfs-serve 0006-anyfs-serve-nfs FR-009), MUST say which of the two applies on standard error, and MUST refuse --listen (a usage error).

Enforced (check): .github: cd commons/anyfs-cli && bun run verify — suite/serve.test.ts

Proved by: anyfs-cli/suite/serve.test.ts

Tests: passed: suite/serve.test.ts serve --nfs hosts the store as NFS on the loopback for the uid of the account and root, sa

Acceptance scenarios

  1. Given a mount of files, When anyfs serve scratch:/ runs, Then standard error holds the address and a token, a WebDAV PROPFIND with the token answers, and one without it is refused, per FR-001 and FR-002.

Out of scope

  • TLS, and a token that is chosen by the person (the server makes it).

Edge cases

  • A location that is not a store that can be read as files is an environment problem, not a server that starts and refuses everything, per FR-001.

Assumptions

  • The person who starts the server is the one who reads standard error.

Open questions

  • None.

Key entities

  • Server - a running serveStore with its address and token.

Success criteria

SC-001success criterion

A person can mount any store of a configuration as a WebDAV folder with one command.

Review & acceptance checklist

  • [x] Every requirement is testable (MUST / MUST NOT), not aspirational
  • [x] No implementation language beyond what the requirement needs
  • [x] Out of scope is stated

Cited by

AnyFS command line, physical/verbs/serve

Titles, headings, exports, tables, columns and requirements. Esc closes.