secure-scuttlebot classic
Repository Guidelines#
Project Structure & Module Organization#
- Core entry:
index.jsexports the defaultssb-serverinstance. CLI entry:bin.js(exposed asssb-server/sbot). - Library helpers live in
lib/(CLI aliases, progress, validation). Prefer adding new shared logic here rather than inbin.js. - Tests live in
test/and are plain Node scripts (mostly usingtape). Use descriptive filenames likecaps.js,defaults.js. - System integration artifacts live in
systemd/. Keep them minimal and distro-agnostic. - Do not edit
node_modules/; send fixes upstream and update dependencies instead.
Build, Test, and Development Commands#
npm install– install dependencies (run once before development).npm test– run the full test suite (node test/*.js).npm run test:pretty– run tests withtap-specoutput.npm run coverage– generate coverage vianyc(outputscoverage/).npm start– run the CLI locally (node bin start), equivalent tossb-server startwhen installed globally.
Coding Style & Naming Conventions#
- Language: Node.js, CommonJS (
require,module.exports), callback-style APIs and pull-streams. - Indentation: 2 spaces, no hard tabs. Prefer single quotes and omit semicolons (match existing files).
- Use
varand classic function declarations in existing modules; introduceconst/letonly when touching newer code paths consistently. - File and symbol names: camelCase for functions/variables, kebab-case for CLI commands, lowerCamelCase JSON/config keys.
Testing Guidelines#
- Tests use
tape. Structure astest('description', function (t) { ... })and ensure all async work callst.end()or ends via plan. - To run a single test file:
node test/<file>.js. - Prefer deterministic tests using temporary directories under
/tmp/andprocess.env.ssb_appname = 'test', as existing tests do. - When adding features or fixing bugs, include or update tests to cover the behavior; check
npm run coverageif changes are large.
Commit & Pull Request Guidelines#
- Commit messages: short, imperative summaries (e.g.
Update caps defaults,Fix bin.js IPv6 handling), with issue/PR references like(#762)when applicable. - Pull requests should explain the motivation, outline key changes, list how to reproduce and verify, and state which tests were run.
- For behavioral or CLI changes, update
README.mdand add small usage examples where helpful.
Security & Configuration Tips#
- Never commit secrets, private keys, or real-world
~/.ssbdata. Use throwaway keys and caps in tests and examples. - Be conservative with network- and replication-related changes; prefer opt-in configuration flags and document defaults clearly.