create-booboo 0.1.1 → 0.3.0
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/dist/cli.js +107 -9
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// src/cli.ts
|
|
4
|
-
import { mkdirSync, writeFileSync, existsSync, readdirSync } from "fs";
|
|
4
|
+
import { mkdirSync, writeFileSync, existsSync, readdirSync, readFileSync } from "fs";
|
|
5
5
|
import path from "path";
|
|
6
|
-
var BOOBOO_VERSION = "^0.
|
|
6
|
+
var BOOBOO_VERSION = "^0.4.0";
|
|
7
|
+
var VERSION = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8")).version;
|
|
7
8
|
var args = process.argv.slice(2);
|
|
8
9
|
var flags = new Set(args.filter((a) => a.startsWith("--")));
|
|
9
10
|
var dirArg = args.find((a) => !a.startsWith("--")) ?? "my-brain";
|
|
@@ -12,6 +13,17 @@ if (flags.has("--help") || flags.has("-h")) {
|
|
|
12
13
|
console.log("usage: npx create-booboo <dir> [--force]\n scaffolds a runnable Booboo brain (json starter + postgres upgrade path)");
|
|
13
14
|
process.exit(0);
|
|
14
15
|
}
|
|
16
|
+
if (flags.has("--version") || flags.has("-v")) {
|
|
17
|
+
console.log(VERSION);
|
|
18
|
+
process.exit(0);
|
|
19
|
+
}
|
|
20
|
+
var KNOWN_FLAGS = /* @__PURE__ */ new Set(["--force", "--help", "-h", "--version", "-v"]);
|
|
21
|
+
var unknownFlags = [...flags].filter((f) => !KNOWN_FLAGS.has(f));
|
|
22
|
+
if (unknownFlags.length) {
|
|
23
|
+
console.error(`\u2717 unknown flag(s): ${unknownFlags.join(", ")}
|
|
24
|
+
usage: npx create-booboo <dir> [--force]`);
|
|
25
|
+
process.exit(1);
|
|
26
|
+
}
|
|
15
27
|
var dir = path.resolve(process.cwd(), dirArg);
|
|
16
28
|
var name = path.basename(dir);
|
|
17
29
|
var TITLE = name.replace(/[-_]/g, " ").toUpperCase();
|
|
@@ -33,6 +45,10 @@ layers:
|
|
|
33
45
|
# Namespaces that must NEVER be emitted (filtered in the builder, before JSON/API/MCP).
|
|
34
46
|
walls: [private, sealed]
|
|
35
47
|
|
|
48
|
+
# Parse [[wikilinks]] in node text into first-class \`authored\` edges \u2014 the links
|
|
49
|
+
# a writer CHOSE while understanding the source outrank any harvested relation.
|
|
50
|
+
wikilinks: true
|
|
51
|
+
|
|
36
52
|
sources:
|
|
37
53
|
# 1) JSON starter \u2014 works immediately, no database. Edit data.booboo.json.
|
|
38
54
|
- adapter: json
|
|
@@ -69,8 +85,8 @@ var dataJson = JSON.stringify(
|
|
|
69
85
|
{ id: "agent:researcher", type: "agent", layer: "agents", label: "Researcher", weight: 0.6, tier: 1, parent: "core", icon: "\u{1F50E}", data: { role: "gathers sources" } },
|
|
70
86
|
{ id: "kb:spec", type: "entity", layer: "knowledge", label: "Spec", weight: 0.4, tier: 2, parent: "core" },
|
|
71
87
|
{ id: "kb:brand", type: "entity", layer: "knowledge", label: "Brand", weight: 0.4, tier: 2, parent: "core" },
|
|
72
|
-
{ id: "mem:1", type: "memory", layer: "memory", label: "shipped v1", weight: 0.2, tier: 3, parent: "agent:writer" },
|
|
73
|
-
{ id: "mem:2", type: "memory", layer: "memory", label: "found source", weight: 0.2, tier: 3, parent: "agent:researcher" }
|
|
88
|
+
{ id: "mem:1", type: "memory", layer: "memory", label: "shipped v1", weight: 0.2, tier: 3, parent: "agent:writer", data: { text: "v1 shipped against [[kb:spec]] \u2014 the launch note the Writer drafted." } },
|
|
89
|
+
{ id: "mem:2", type: "memory", layer: "memory", label: "found source", weight: 0.2, tier: 3, parent: "agent:researcher", data: { text: "primary source located; informs [[kb:brand]]." } }
|
|
74
90
|
],
|
|
75
91
|
links: [
|
|
76
92
|
{ source: "agent:writer", target: "kb:spec", type: "uses" },
|
|
@@ -80,6 +96,20 @@ var dataJson = JSON.stringify(
|
|
|
80
96
|
null,
|
|
81
97
|
2
|
|
82
98
|
);
|
|
99
|
+
var orgJson = JSON.stringify(
|
|
100
|
+
{
|
|
101
|
+
booboo_org: "1.0",
|
|
102
|
+
title: TITLE,
|
|
103
|
+
root: "core",
|
|
104
|
+
agents: [
|
|
105
|
+
{ id: "core", name: TITLE, emoji: "\u{1F3DB}\uFE0F", role: "the orchestrator \u2014 routes, never executes", rules: ["rules/GLOBAL.md"], buckets: ["shared"], boot: "You are the orchestrator. Boot with booboo_boot('core'); route work to your branches, never do it yourself." },
|
|
106
|
+
{ id: "writer", name: "Writer", emoji: "\u{1F4DD}", role: "drafts content", parent: "core", skills: ["humanizer"], buckets: ["content"] },
|
|
107
|
+
{ id: "researcher", name: "Researcher", emoji: "\u{1F50E}", role: "gathers sources", parent: "core", skills: ["deep-research"], buckets: ["research"] }
|
|
108
|
+
]
|
|
109
|
+
},
|
|
110
|
+
null,
|
|
111
|
+
2
|
|
112
|
+
);
|
|
83
113
|
var pkgJson = JSON.stringify(
|
|
84
114
|
{
|
|
85
115
|
name,
|
|
@@ -89,8 +119,10 @@ var pkgJson = JSON.stringify(
|
|
|
89
119
|
scripts: {
|
|
90
120
|
build: "booboo build",
|
|
91
121
|
serve: "booboo serve --snapshot brain.json --port 8787",
|
|
92
|
-
mcp: "booboo mcp --snapshot brain.json",
|
|
93
|
-
view: "booboo view --snapshot brain.json"
|
|
122
|
+
mcp: "booboo mcp --snapshot brain.json --org org.booboo.json",
|
|
123
|
+
view: "booboo view --snapshot brain.json",
|
|
124
|
+
panel: "booboo panel --org org.booboo.json --snapshot brain.json",
|
|
125
|
+
vault: "booboo vault --snapshot brain.json --org org.booboo.json --out vault"
|
|
94
126
|
},
|
|
95
127
|
dependencies: {
|
|
96
128
|
"@booboo-brain/cli": BOOBOO_VERSION
|
|
@@ -111,8 +143,17 @@ npm run build # booboo.config.yaml \u2192 brain.json (the snapshot)
|
|
|
111
143
|
npm run serve # REST API at http://localhost:8787 (/graph /stats /search /nodes/:id /neighbors/:id /path/:a/:b)
|
|
112
144
|
npm run mcp # MCP over stdio \u2014 point Claude / Cursor / Claude Code at it
|
|
113
145
|
npm run view # see your brain in 3D (opens your browser)
|
|
146
|
+
npm run panel # THE ORGANIGRAM \u2014 run your agents like a company
|
|
114
147
|
\`\`\`
|
|
115
148
|
|
|
149
|
+
## The organigram \u2014 run your agents like a company
|
|
150
|
+
|
|
151
|
+
\`npm run panel\` opens **org.booboo.json** as a real company chart: drag an agent
|
|
152
|
+
under a new parent, hit apply, and the file changes \u2014 versioned in git, validated
|
|
153
|
+
before every write. Agents that boot with \`booboo_boot('<id>')\` obey the new shape
|
|
154
|
+
next session. Rules inherit top-down; each agent carries its buckets, skills and
|
|
155
|
+
latest reports. This file is a **source** (commit it) \u2014 the snapshot is derived.
|
|
156
|
+
|
|
116
157
|
## Make it yours
|
|
117
158
|
|
|
118
159
|
1. Edit **booboo.config.yaml** \u2014 declare your \`layers\`, then add \`sources\`.
|
|
@@ -122,22 +163,75 @@ npm run view # see your brain in 3D (opens your browser)
|
|
|
122
163
|
|
|
123
164
|
> **Privacy:** anything whose \`cluster\` is in \`walls:\` is filtered *before* emit \u2014 sealed data never reaches the snapshot, API, or MCP.
|
|
124
165
|
|
|
166
|
+
## The vault \u2014 your brain as plain markdown
|
|
167
|
+
|
|
168
|
+
\`npm run vault\` emits the whole brain as a wiki-linked markdown vault (\`vault/\`):
|
|
169
|
+
one page per node, index pages per layer/cluster, an agent dossier per org member.
|
|
170
|
+
Open it as an Obsidian vault, read it on a couch, or hand it to ANY agent \u2014 plain
|
|
171
|
+
files survive every provider. It is derived: regenerate, never hand-edit.
|
|
172
|
+
|
|
173
|
+
## The agent contract
|
|
174
|
+
|
|
175
|
+
**AGENTS.md** (imported by CLAUDE.md) is the operating doctrine an AI agent working
|
|
176
|
+
this folder reads first: boot from the org, author \`[[wikilinks]]\`, one atomic fact
|
|
177
|
+
per note, corrections replace, respect the walls, watch the quality gate. Edit it as
|
|
178
|
+
your conventions evolve \u2014 it IS your system's constitution.
|
|
179
|
+
|
|
125
180
|
## MCP
|
|
126
181
|
|
|
127
182
|
\`npm run mcp\` exposes \`booboo_stats \xB7 booboo_search \xB7 booboo_node \xB7 booboo_neighbors \xB7 booboo_path\`
|
|
128
|
-
so an AI client can query the brain. See the Booboo repo for client config.
|
|
183
|
+
(+ \`booboo_boot \xB7 booboo_org\` with \`--org\`) so an AI client can query the brain. See the Booboo repo for client config.
|
|
129
184
|
`;
|
|
130
185
|
var gitignore = `node_modules/
|
|
131
186
|
# the built snapshot can contain real/private data \u2014 don't commit it
|
|
132
187
|
brain.json
|
|
188
|
+
# the vault is derived from the snapshot \u2014 regenerate, never commit
|
|
189
|
+
vault/
|
|
133
190
|
*.log
|
|
134
191
|
`;
|
|
192
|
+
var agentsMd = `# ${TITLE} \u2014 the agent contract
|
|
193
|
+
*Any AI agent working in this folder reads this first, every session. It is the
|
|
194
|
+
operating doctrine for this brain \u2014 the conventions match the setup.*
|
|
195
|
+
|
|
196
|
+
## What this folder is
|
|
197
|
+
- \`booboo.config.yaml\` \u2014 build config (layers \xB7 sources \xB7 walls \xB7 wikilinks). Edit to shape the brain.
|
|
198
|
+
- \`org.booboo.json\` \u2014 **SOURCE**: the agent organigram you boot from. Versioned, validated, edited via the panel or a reviewed change \u2014 never ad-hoc.
|
|
199
|
+
- \`brain.json\` \u2014 **DERIVED** snapshot. Regenerate with \`npm run build\`; never hand-edit.
|
|
200
|
+
- \`vault/\` \u2014 **DERIVED** markdown mirror of the brain (Obsidian-compatible). Regenerate with \`npm run vault\`; never hand-edit.
|
|
201
|
+
|
|
202
|
+
## The loop (every non-trivial task)
|
|
203
|
+
1. **ORIENT** \u2014 never assume what the brain knows: boot as your agent (\`booboo_boot('<agent-id>')\` over MCP) for your identity, inherited rules and buckets; then \`booboo_search\`/\`booboo_neighbors\` for the facts you need. *Assumption is not recall.*
|
|
204
|
+
2. **ACT** \u2014 the smallest correct change.
|
|
205
|
+
3. **VERIFY against reality** \u2014 \`npm run build\` and read the \`quality\` line; open \`npm run view\` or \`npm run panel\` when the change is visual. Introspection is not verification.
|
|
206
|
+
4. **RECORD** \u2014 write what you learned into your source data as a memory node.
|
|
207
|
+
|
|
208
|
+
## Writing memories (the conventions that keep the brain curated)
|
|
209
|
+
- **One atomic fact per note**, written for the future reader. Never dump a transcript \u2014 the quality gate counts \`dump-suspects\` and they are a smell.
|
|
210
|
+
- **Author your links**: put \`[[node-id]]\` (or \`[[exact label]]\`) refs in the note text where you KNOW the connection. \`wikilinks: true\` turns them into first-class \`authored\` edges that outrank any harvested relation.
|
|
211
|
+
- **Corrections replace**: when a note corrects an earlier fact, remove or supersede the old one in the same act. A brain that only accumulates is not curated \u2014 stale truth next to live truth is worse than either.
|
|
212
|
+
- **Respect the walls**: anything in a \`walls:\` cluster never leaves the builder. Never move data out of a walled cluster; never widen the walls without the human.
|
|
213
|
+
|
|
214
|
+
## The org is law
|
|
215
|
+
Rules in \`org.booboo.json\` inherit top-down \u2014 \`booboo_boot\` returns yours; obey them. Reorganising the fleet (reparenting, new agents, rule changes) goes through the panel (\`npm run panel\`) or a reviewed edit so the change is validated and diffable.
|
|
216
|
+
|
|
217
|
+
## Quality gate (read it every build)
|
|
218
|
+
\`npm run build\` prints \`quality \xB7 authored:N \xB7 orphans:N \xB7 dump-suspects:N\`.
|
|
219
|
+
Authored should grow; orphans and dumps should not. Rising orphans/dumps = accumulating, not curating \u2014 fix the notes before adding more.
|
|
220
|
+
|
|
221
|
+
## Honest close
|
|
222
|
+
End substantial work by reporting plainly: what changed, what you verified against the running thing, what you couldn't verify, and any note you superseded.
|
|
223
|
+
`;
|
|
224
|
+
var claudeMd = `@AGENTS.md
|
|
225
|
+
`;
|
|
135
226
|
var files = {
|
|
136
227
|
"booboo.config.yaml": configYaml,
|
|
137
228
|
"data.booboo.json": dataJson,
|
|
229
|
+
"org.booboo.json": orgJson,
|
|
138
230
|
"package.json": pkgJson,
|
|
139
231
|
"README.md": readme,
|
|
140
|
-
".gitignore": gitignore
|
|
232
|
+
".gitignore": gitignore,
|
|
233
|
+
"AGENTS.md": agentsMd,
|
|
234
|
+
"CLAUDE.md": claudeMd
|
|
141
235
|
};
|
|
142
236
|
for (const [f, content] of Object.entries(files)) writeFileSync(path.join(dir, f), content, "utf8");
|
|
143
237
|
console.log(`
|
|
@@ -149,5 +243,9 @@ console.log(" npm install");
|
|
|
149
243
|
console.log(" npm run build # build the graph snapshot");
|
|
150
244
|
console.log(" npm run serve # REST API on http://localhost:8787");
|
|
151
245
|
console.log(" npm run mcp # MCP over stdio (Claude / Cursor / Claude Code)");
|
|
152
|
-
console.log(" npm run view # see your brain in 3D (opens your browser)
|
|
246
|
+
console.log(" npm run view # see your brain in 3D (opens your browser)");
|
|
247
|
+
console.log(" npm run panel # the organigram \u2014 run your agents like a company");
|
|
248
|
+
console.log(" npm run vault # the brain as a wiki-linked markdown vault (Obsidian-ready)\n");
|
|
249
|
+
console.log("Your agent's contract is AGENTS.md (CLAUDE.md imports it) \u2014 Claude/Codex read it");
|
|
250
|
+
console.log("automatically in this folder and will follow the brain's conventions.\n");
|
|
153
251
|
console.log("Then edit booboo.config.yaml to point at your own data \u2014 a postgres example is included.\n");
|