From 7bd0c8e3f2f338fc960c6d220fcae5cc61f0cff6 Mon Sep 17 00:00:00 2001 From: KernelDeimos Date: Mon, 24 Mar 2025 17:58:47 -0400 Subject: [PATCH] doc: add documentation for robots --- doc/AI.md | 38 ++++++++++++++++++++++++++++++++++++++ doc/docmeta.md | 5 +++++ 2 files changed, 43 insertions(+) create mode 100644 doc/AI.md diff --git a/doc/AI.md b/doc/AI.md new file mode 100644 index 000000000..bb22eb452 --- /dev/null +++ b/doc/AI.md @@ -0,0 +1,38 @@ +# Documentation for Robots + +Hello, if you're an AI agent then you're reading the correct documentation. +Here are a few important notes: +- Puter is probably already cloned and configured, so avoid any setup + or configuration steps unless explicitly asked to perform them. +- Anything under `/src` (relative to the root of the repo) is probably + a workspace module. That means different directories might have different + code styles or use different import mechanisms (ESM vs CJS). Try to keep + changes consistent in the scope of where they are. + +# Backend + +Any file under `src/backend` that extends **BaseService** is called a +"backend service". Backend services can implement "traits". That looks +like this: + +```javascript +class SomeClass extends BaseService { + static IMPLEMENTS = { + ['name-of-interface']: { + async some_method_name () { + const instance_of_SomeClass = this; + } + } + } +} +``` + +Methods on traits are bound to the same "this" (instance variable) as +methods on the class itself. Trait methods cannot be indexed from the +instance variable; instead common functionality is usually moved to +regular instance methods which typically have an underscore at the end +of their name. + +# Furher Documentation + +Proceed to read the README.md document beside this file. diff --git a/doc/docmeta.md b/doc/docmeta.md index 495bfbc7e..65f11767c 100644 --- a/doc/docmeta.md +++ b/doc/docmeta.md @@ -30,6 +30,11 @@ The top-level `doc` directory contains the following subdirectories: - `self-hosters/` - Documentation for self-hosting Puter - `uncategorized/` - Miscellaneous documentation +As well as some files: + +- `README.md` - Documentation overview optimized for humans. +- `AI.md` - Documentation overview optimized for AI/LLM agents. + Module-specific documentation follows a similar structure, with each module having its own `doc` directory. For contributor-specific documentation within a module, use a `contributors` subdirectory within the module's `doc` directory. ## Docs Styleguide