@sulala/agent-os 0.1.35 → 0.1.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/docs/CLI.md ADDED
@@ -0,0 +1,50 @@
1
+ # Sulala CLI reference
2
+
3
+ How the CLI is structured and how to extend it.
4
+
5
+ ## Entry and dispatch
6
+
7
+ - **Binary:** `package.json` → `"bin": { "sulala": "dist/cli.js" }` so `sulala` runs the built CLI.
8
+ - **Source:** `src/cli.ts` (Bun); build: `bun build src/cli.ts --outdir=dist --target=bun`.
9
+ - **Entry:** `main()` at the bottom of `src/cli.ts`:
10
+ - Requires Bun (`process.versions.bun`); exits with a message otherwise.
11
+ - `argv = process.argv.slice(2)`, `command = argv[0]?.toLowerCase()`, `rest = argv.slice(1)`.
12
+ - Single `switch (command)` → one `cmd*` function per command; no subcommand parsing.
13
+
14
+ ## Commands
15
+
16
+ | Command | Handler | Notes |
17
+ |----------------|---------------|--------|
18
+ | `version`, `-v`, `--version` | `cmdVersion()` | Reads version from `package.json` next to CLI (e.g. `import.meta.dir/../package.json`). |
19
+ | `start` | `cmdStart(rest)` | No args: runs server in foreground via `import("./server.js")` → `startServer()`. With `--daemon`: spawns `bun run dist/index.js` (or `src/index.ts` if no dist) from **package root** (`import.meta.dir/..`), writes PID to `~/.agent-os/sulala.pid`. |
20
+ | `stop` | `cmdStop()` | Reads PID from `~/.agent-os/sulala.pid`, sends SIGTERM, deletes PID file. |
21
+ | `onboard` | `cmdOnboard()` | Creates `~/.agent-os`, DB dir, `config.json` if missing; sets up `MemoryStore`, runs `seedAgentsIfEmpty()` + `installSystemAgents()` (no system skills); starts server daemon if needed, opens dashboard in browser. |
22
+ | `update` | `cmdUpdate()` | Runs `bun install -g @sulala/agent-os@latest`; then if DB exists, runs `installSystemAgents()` and `installSystemSkills()`. |
23
+ | `run` | `cmdRun(rest)` | `rest[0]` = agent id, `rest.slice(1).join(" ")` = task; uses same DB as server; loads agent, runs `runAgent()`, prints result. |
24
+ | `help`, `-h`, `--help`, or no command | `printHelp()` | Prints usage and exits. |
25
+ | Anything else | Error + `printHelp()` + `process.exit(1)`. |
26
+
27
+ ## Paths and environment
28
+
29
+ - **Package root:** Resolved as `join(import.meta.dir, "..")` (when running `dist/cli.js`, `import.meta.dir` is `dist/`).
30
+ - **Config / home:** `getAgentOsHome()` from `./core/config.js` → `AGENT_OS_HOME` or `~/.agent-os`.
31
+ - **PID file:** `join(getAgentOsHome(), "sulala.pid")`.
32
+ - **Server entry for daemon:** Prefer `dist/index.js` if present, else `src/index.ts`; process is started with `cwd: projectRoot` (package root).
33
+ - **Port:** `process.env.PORT ?? 3010` (e.g. for `openDashboard()`).
34
+
35
+ ## Adding a new command
36
+
37
+ 1. Implement `async function cmdMycommand(args: string[]): Promise<void>` in `src/cli.ts`.
38
+ 2. In `main()`, add a `case "mycommand": await cmdMycommand(rest); break;`.
39
+ 3. Update `printHelp()` with the new command and an example.
40
+ 4. Rebuild: `npm run build` (or `bun build src/cli.ts --outdir=dist --target=bun`).
41
+
42
+ ## Dependencies
43
+
44
+ - **Config:** `getAgentOsHome()`, `getMemoryDbPath()` from `./core/config.js`.
45
+ - **Agents:** `setAgentStore`, `seedAgentsIfEmpty`, `installSystemAgents`, `getAgent` from `./core/agent-registry.js`.
46
+ - **Skills:** `installSystemSkills` from `./skills/loader.js`.
47
+ - **Runtime:** `runAgent` from `./core/runtime.js`.
48
+ - **Server:** Dynamic `import("./server.js")` only for `start` (foreground).
49
+
50
+ No framework or CLI parser; everything is a single switch on the first argument.
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sulala/agent-os",
3
- "version": "0.1.35",
3
+ "version": "0.1.36",
4
4
  "description": "Lightweight Bun-based Agent Operating System — micro-agents, skills, workflows",
5
5
  "repository": {
6
6
  "type": "git",
@@ -31,6 +31,8 @@
31
31
  "prepublishOnly": "bun run build && (cd dashboard && npm install && VITE_AGENT_OS_API= npm run build) && node -e \"require('fs').cpSync('dashboard/dist','dashboard-dist',{recursive:true})\""
32
32
  },
33
33
  "files": [
34
+ "README.md",
35
+ "docs",
34
36
  "dist",
35
37
  "dashboard-dist",
36
38
  "data/agents",