Repo rules (CONTRIBUTING.md)
You can find the basics in the root CONTRIBUTING.md file.
Just fork develop, create your branch, and open your pull
requests against develop. If you are looking to customize
things or build third party extensions, check out the rest of these
docs. Want to add built in engines or bang commands? Just copy the
patterns we already use in the codebase. If you are using AI to write
code, please get it reviewed to make sure it follows our standards and
isn't overly complicated.
Coding standards
Here is a quick summary from CONTRIBUTING.md. Please
follow these so our codebase stays consistent.
-
Functions that return a value: use arrow functions
(e.g.
const getX = () => value,const map = (x) => x.id). -
Functions that do not return (side effects only):
use regular
functiondeclarations (e.g.function init() { ... }). -
Internal or private helpers: prepend these with
_(e.g._parseQuery,_formatDate). This rule applies to any function or symbol that is not part of a public API. -
CSS: Try to reuse our existing app classes whenever
possible so your plugins and themes match the rest of the UI. You
can look at
Styling
for a list of classes and variables. Try sticking to CSS variables
(like
var(--text-primary)orvar(--bg-light)) to make sure themes and light or dark modes work correctly. -
Structure: Keep everything modular. Follow our
current folder structure which means one folder per plugin
(including
index.jsorindex.ts, and optional files liketemplate.html,style.css, orscript.js). Engines should be either single files or organized as one folder per engine inside the engines directory.
Built in plugins (commands and slots)
You will find the default plugins in
src/server/extensions/commands/builtins/. Each one is its
own folder (for example help,
ip, or ai-summary) using the exact same
structure as the plugins inside
data/plugins/:
-
index.jsorindex.tsfor your required entry point. -
Optional files like
template.html,style.css, andscript.js.
Just export a bang command (using export default or
export const command) or a slot or
slotPlugin. This follows the exact same contract as
plugin bang commands and
slot plugins. The
application will scan
src/server/extensions/commands/builtins/ automatically at
startup.
Built in engines
These live in
src/server/extensions/engines/ as either TypeScript or
JavaScript files and folders. You should use the same contract as
custom engines. This includes
name, executeSearch, an optional
bangShortcut, settingsSchema,
configure, and outgoingHosts. Make sure to
register your engine in the registry so it shows up under Settings and
then Engines, as well as in the normal search.