@time-machine-lab/tmlbrain 0.1.0 → 0.1.1
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/README.md +30 -12
- package/bin/tmlbrain.js +123 -5
- package/docs/install.md +27 -12
- package/docs/runtime.md +8 -5
- package/docs/server-api.md +8 -8
- package/docs/sync.md +1 -1
- package/package.json +1 -1
- package/scripts/docker/server-entrypoint.sh +1 -1
- package/scripts/release/parse-auto-release.js +1 -1
- package/skills/tmlbrain/SKILL.md +12 -5
package/README.md
CHANGED
|
@@ -34,12 +34,29 @@ TMLBrain/
|
|
|
34
34
|
docs/ Architecture, decisions, and operating docs.
|
|
35
35
|
```
|
|
36
36
|
|
|
37
|
-
##
|
|
37
|
+
## Client Install
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
Recommended npm install:
|
|
40
|
+
|
|
41
|
+
```text
|
|
42
|
+
npm install -g @time-machine-lab/tmlbrain@latest
|
|
43
|
+
tmlbrain client install
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
The installer asks for a server URL. Leave it empty to start in local-only
|
|
47
|
+
mode, or provide the TMLBrain server URL and token to enable team sync and
|
|
48
|
+
server-side writes.
|
|
49
|
+
|
|
50
|
+
Non-interactive npm install:
|
|
51
|
+
|
|
52
|
+
```text
|
|
53
|
+
npm install -g @time-machine-lab/tmlbrain@latest
|
|
54
|
+
tmlbrain client install --server http://server-host:8477 --token <token> --yes
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
After installation:
|
|
40
58
|
|
|
41
59
|
```text
|
|
42
|
-
npx @time-machine-lab/tmlbrain client install
|
|
43
60
|
tmlbrain find "keyword"
|
|
44
61
|
tmlbrain save --title "Title" --content "Content"
|
|
45
62
|
```
|
|
@@ -49,23 +66,22 @@ need Git. Server-side writes use Node plus Git from the server worktree.
|
|
|
49
66
|
Python-based CocoIndex and LightRAG support are optional graph retrieval
|
|
50
67
|
enhancements.
|
|
51
68
|
|
|
52
|
-
|
|
53
|
-
local-only mode, or provide the TMLBrain server URL and token to enable team
|
|
54
|
-
sync and server-side writes.
|
|
55
|
-
|
|
56
|
-
Non-interactive client install:
|
|
69
|
+
Update an existing client without re-entering the setup flow:
|
|
57
70
|
|
|
58
71
|
```text
|
|
59
|
-
|
|
72
|
+
tmlbrain update
|
|
60
73
|
```
|
|
61
74
|
|
|
75
|
+
Use `npx -y @time-machine-lab/tmlbrain@latest client install` only when you
|
|
76
|
+
want a one-time install without keeping a global `tmlbrain` command.
|
|
77
|
+
|
|
62
78
|
## Server Docker
|
|
63
79
|
|
|
64
80
|
The server is deployed separately from clients and requires a token:
|
|
65
81
|
|
|
66
82
|
```text
|
|
67
83
|
docker run -d --name tmlbrain-server \
|
|
68
|
-
-p
|
|
84
|
+
-p 8477:8477 \
|
|
69
85
|
-e TMLBRAIN_SERVER_TOKEN=change-me \
|
|
70
86
|
-e TMLBRAIN_KNOWLEDGE_REPO=https://github.com/Time-Machine-Lab/TMLBrainKnowledge.git \
|
|
71
87
|
-e TMLBRAIN_KNOWLEDGE_REF=main \
|
|
@@ -87,13 +103,13 @@ Only pushes to `main` are considered. A release runs when the HEAD commit
|
|
|
87
103
|
message contains `<Auto>` and a version flag:
|
|
88
104
|
|
|
89
105
|
```text
|
|
90
|
-
[tml-brain]<Auto> release server and client -v:0.1.0 -rp:
|
|
106
|
+
[tml-brain]<Auto> release server and client -v:0.1.0 -rp:8477 -de:<-e KEY=value>
|
|
91
107
|
```
|
|
92
108
|
|
|
93
109
|
- `-v` is required and becomes both the npm package version and Docker image
|
|
94
110
|
version; use a Docker-compatible value such as `0.1.0` or `0.1.0-beta.1`.
|
|
95
111
|
- `-rp` sets the default server port baked into the Docker image; it defaults
|
|
96
|
-
to `
|
|
112
|
+
to `8477`.
|
|
97
113
|
- `-de` is optional runtime Docker argument metadata recorded in
|
|
98
114
|
the commit message and may also be copied into `prod_deploy.log` manually.
|
|
99
115
|
|
|
@@ -101,6 +117,8 @@ The workflow publishes `@time-machine-lab/tmlbrain` to npm, pushes the server
|
|
|
101
117
|
image to the Docker repository configured by `DOCKER_REPO`, and then deploys
|
|
102
118
|
that image to the configured server with `SERVER_HOST`, `SERVER_USER`, and
|
|
103
119
|
`SERVER_PWD`. Docker images are tagged as `latest`, `version`, and `vversion`.
|
|
120
|
+
The server deploy step skips Docker login by default and directly pulls the
|
|
121
|
+
public image. Only set `TMLBRAIN_SERVER_DOCKER_LOGIN=true` for private images.
|
|
104
122
|
The workflow does not mutate repository files; if
|
|
105
123
|
maintainers want a production release note, update `prod_deploy.log` manually
|
|
106
124
|
before committing the auto-release instruction.
|
package/bin/tmlbrain.js
CHANGED
|
@@ -19,11 +19,12 @@ const CONFLICT_DIR = path.join(LOCAL_DIR, "conflicts");
|
|
|
19
19
|
const PATCH_DIR = path.join(LOCAL_DIR, "patches");
|
|
20
20
|
const LOG_DIR = path.join(LOCAL_DIR, "logs");
|
|
21
21
|
const STATE_FILE = path.join(LOCAL_DIR, "state.json");
|
|
22
|
+
const PACKAGE_INFO = readPackageInfo();
|
|
22
23
|
|
|
23
24
|
const VALID_TYPES = new Set(["project", "area", "resource", "reference", "meeting", "decision"]);
|
|
24
25
|
const VALID_STATUSES = new Set(["draft", "active", "stale", "archived"]);
|
|
25
26
|
const DEFAULT_SERVER_HOST = "127.0.0.1";
|
|
26
|
-
const DEFAULT_SERVER_PORT =
|
|
27
|
+
const DEFAULT_SERVER_PORT = 8477;
|
|
27
28
|
|
|
28
29
|
main().catch((error) => fail(error.message || String(error)));
|
|
29
30
|
|
|
@@ -38,10 +39,18 @@ async function main() {
|
|
|
38
39
|
case "--help":
|
|
39
40
|
printHelp();
|
|
40
41
|
break;
|
|
42
|
+
case "version":
|
|
43
|
+
case "-v":
|
|
44
|
+
case "--version":
|
|
45
|
+
console.log(PACKAGE_INFO.version);
|
|
46
|
+
break;
|
|
41
47
|
case "install":
|
|
42
48
|
case "init":
|
|
43
49
|
cmdInstall(args);
|
|
44
50
|
break;
|
|
51
|
+
case "update":
|
|
52
|
+
await cmdUpdate(args);
|
|
53
|
+
break;
|
|
45
54
|
case "client":
|
|
46
55
|
await cmdClient(args);
|
|
47
56
|
break;
|
|
@@ -109,6 +118,8 @@ function printHelp() {
|
|
|
109
118
|
|
|
110
119
|
Usage:
|
|
111
120
|
tmlbrain client install [--server <http-url>] [--token <token>] [--local] [--yes]
|
|
121
|
+
tmlbrain update [latest|<version>] [--sync] [--dry-run]
|
|
122
|
+
tmlbrain version|--version
|
|
112
123
|
tmlbrain install [--server <http-url>] [--token <token>] [--graph] [--with-git]
|
|
113
124
|
tmlbrain config show|set-server|clear-token
|
|
114
125
|
tmlbrain doctor
|
|
@@ -143,6 +154,7 @@ async function cmdClient(args) {
|
|
|
143
154
|
|
|
144
155
|
Usage:
|
|
145
156
|
tmlbrain client install [--server <http-url>] [--token <token>] [--local] [--yes]
|
|
157
|
+
tmlbrain client update [latest|<version>] [--sync] [--dry-run]
|
|
146
158
|
tmlbrain client doctor
|
|
147
159
|
|
|
148
160
|
If --server is omitted, interactive install asks for one. Press Enter to start
|
|
@@ -153,6 +165,10 @@ in local-only mode.`);
|
|
|
153
165
|
await cmdClientInstall(args);
|
|
154
166
|
return;
|
|
155
167
|
}
|
|
168
|
+
if (action === "update") {
|
|
169
|
+
await cmdUpdate(args);
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
156
172
|
if (action === "doctor") {
|
|
157
173
|
cmdDoctor(args);
|
|
158
174
|
return;
|
|
@@ -164,9 +180,10 @@ async function cmdClientInstall(args) {
|
|
|
164
180
|
const opts = parseArgs(args);
|
|
165
181
|
const interactive = !opts.yes && !opts["non-interactive"];
|
|
166
182
|
ensureLocalDirs();
|
|
183
|
+
const existingState = readState();
|
|
167
184
|
|
|
168
|
-
let server = opts.local ? "" : (opts.server || "");
|
|
169
|
-
let token = opts.token || "";
|
|
185
|
+
let server = opts.local ? "" : (opts.server || existingState.server || "");
|
|
186
|
+
let token = opts.local ? "" : (opts.token || existingState.token || "");
|
|
170
187
|
let graph = Boolean(opts.graph);
|
|
171
188
|
|
|
172
189
|
if (interactive) {
|
|
@@ -180,6 +197,7 @@ async function cmdClientInstall(args) {
|
|
|
180
197
|
if (server && !token) fail("Server token is required when a server URL is configured. Use --token <token> or leave the server URL empty for local-only mode.");
|
|
181
198
|
|
|
182
199
|
const installArgs = [];
|
|
200
|
+
if (opts.local) installArgs.push("--local");
|
|
183
201
|
if (server) installArgs.push("--server", server);
|
|
184
202
|
if (token) installArgs.push("--token", token);
|
|
185
203
|
if (graph) installArgs.push("--graph");
|
|
@@ -207,9 +225,17 @@ function cmdInstall(args) {
|
|
|
207
225
|
? ensureGit({ install: true, dryRun: Boolean(opts["dry-run"]) })
|
|
208
226
|
: checkCommand("git", ["--version"]);
|
|
209
227
|
const state = readState();
|
|
228
|
+
if (opts.local) {
|
|
229
|
+
delete state.server;
|
|
230
|
+
delete state.token;
|
|
231
|
+
}
|
|
210
232
|
if (opts.server) state.server = opts.server;
|
|
211
233
|
if (opts.token) state.token = opts.token;
|
|
212
234
|
if (!state.workspaceVersion) state.workspaceVersion = 1;
|
|
235
|
+
state.package = {
|
|
236
|
+
name: PACKAGE_INFO.name,
|
|
237
|
+
version: PACKAGE_INFO.version
|
|
238
|
+
};
|
|
213
239
|
state.git = { detected: gitInfo.ok, version: gitInfo.version || null };
|
|
214
240
|
state.updatedAt = new Date().toISOString();
|
|
215
241
|
writeJson(STATE_FILE, state);
|
|
@@ -218,6 +244,59 @@ function cmdInstall(args) {
|
|
|
218
244
|
console.log("TMLBrain workspace is ready.");
|
|
219
245
|
}
|
|
220
246
|
|
|
247
|
+
async function cmdUpdate(args) {
|
|
248
|
+
const opts = parseArgs(args);
|
|
249
|
+
ensureLocalDirs();
|
|
250
|
+
const state = readState();
|
|
251
|
+
const target = opts.version || opts.tag || opts._[0] || "latest";
|
|
252
|
+
const packageSpec = `${PACKAGE_INFO.name}@${target}`;
|
|
253
|
+
const dryRun = Boolean(opts["dry-run"]);
|
|
254
|
+
const skipNpm = Boolean(opts["skip-npm"]);
|
|
255
|
+
const server = opts.local ? "" : (opts.server || state.server || "");
|
|
256
|
+
const token = opts.local ? "" : (opts.token || state.token || "");
|
|
257
|
+
const installArgs = ["install"];
|
|
258
|
+
|
|
259
|
+
if (opts.local) installArgs.push("--local");
|
|
260
|
+
if (opts.server) installArgs.push("--server", opts.server);
|
|
261
|
+
if (opts.token) installArgs.push("--token", opts.token);
|
|
262
|
+
if (opts.graph) installArgs.push("--graph");
|
|
263
|
+
if (dryRun) installArgs.push("--dry-run");
|
|
264
|
+
|
|
265
|
+
if (dryRun) {
|
|
266
|
+
console.log(`Would update npm package: npm install -g ${packageSpec}`);
|
|
267
|
+
console.log(`Would refresh local runtime: tmlbrain ${redactArgs(installArgs).join(" ")}`);
|
|
268
|
+
if (server && !opts.server) console.log("Would preserve the existing configured server.");
|
|
269
|
+
if (token && !opts.token) console.log("Would preserve the existing configured token.");
|
|
270
|
+
return;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
if (!skipNpm) {
|
|
274
|
+
if (!checkCommand("npm", ["--version"]).ok) {
|
|
275
|
+
fail("npm is required for `tmlbrain update`. Install Node.js/npm first, or use `npx -y @time-machine-lab/tmlbrain@latest client install`.");
|
|
276
|
+
}
|
|
277
|
+
console.log(`Updating ${packageSpec} with npm...`);
|
|
278
|
+
const npmResult = runCommand("npm", ["install", "-g", packageSpec], { stdio: "inherit" });
|
|
279
|
+
if (npmResult.status !== 0) fail(`npm update failed for ${packageSpec}.`);
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
console.log("Refreshing TMLBrain workspace runtime and skill from the installed package...");
|
|
283
|
+
const cliPath = path.join(PACKAGE_ROOT, "bin", "tmlbrain.js");
|
|
284
|
+
const refreshResult = fs.existsSync(cliPath)
|
|
285
|
+
? spawnSync(process.execPath, [cliPath, ...installArgs], { cwd: ROOT, stdio: "inherit" })
|
|
286
|
+
: runCommand("tmlbrain", installArgs, { cwd: ROOT, stdio: "inherit" });
|
|
287
|
+
|
|
288
|
+
if (refreshResult.status !== 0) {
|
|
289
|
+
console.warn("Updated package, but automatic runtime refresh failed. Falling back to current CLI runtime.");
|
|
290
|
+
cmdInstall(installArgs.slice(1));
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
if (opts.sync && server) {
|
|
294
|
+
await cmdSync(["--pull", ...(opts.json ? ["--json"] : [])]);
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
console.log("TMLBrain update is complete.");
|
|
298
|
+
}
|
|
299
|
+
|
|
221
300
|
function cmdDoctor(args) {
|
|
222
301
|
const opts = parseArgs(args);
|
|
223
302
|
const state = readState();
|
|
@@ -788,6 +867,7 @@ function capabilities() {
|
|
|
788
867
|
configuredServer: state.server || null,
|
|
789
868
|
config: safeConfigView(state),
|
|
790
869
|
userCommands: [
|
|
870
|
+
{ command: "tmlbrain update", role: "client", description: "Update the npm package, refresh the local Skill/runtime, and preserve existing client configuration." },
|
|
791
871
|
{ command: "tmlbrain config show", role: "client", description: "Show the configured server without printing the token." },
|
|
792
872
|
{ command: "tmlbrain config set-server <http-url> --token <token>", role: "client", description: "Switch this client to another TMLBrain server." },
|
|
793
873
|
{ command: "tmlbrain sync --pull", role: "client", description: "Refresh the local read-only knowledge snapshot from the configured server." },
|
|
@@ -797,6 +877,7 @@ function capabilities() {
|
|
|
797
877
|
{ command: "tmlbrain remote update --file <path> --replace <old> --with <new>", role: "client-request", description: "Ask the server to update a precise text region." }
|
|
798
878
|
],
|
|
799
879
|
commands: [
|
|
880
|
+
{ command: "tmlbrain update", role: "client", description: "Update the globally installed package and refresh local runtime files without asking for setup again." },
|
|
800
881
|
{ command: "tmlbrain sync --pull", role: "client", description: "Fetch a read-only knowledge snapshot from the configured HTTP server." },
|
|
801
882
|
{ command: "tmlbrain search <query>", role: "client", description: "Search local Markdown snapshot." },
|
|
802
883
|
{ command: "tmlbrain find <query>", role: "client", description: "Alias for local search." },
|
|
@@ -1071,7 +1152,7 @@ async function requestServerJson(endpoint, body, opts) {
|
|
|
1071
1152
|
async function requestServer(method, endpoint, body, opts) {
|
|
1072
1153
|
const state = readState();
|
|
1073
1154
|
const base = opts.server || state.server;
|
|
1074
|
-
if (!base || !isHttpUrl(base)) fail("Configure an HTTP TMLBrain server first: tmlbrain install --server http://host:
|
|
1155
|
+
if (!base || !isHttpUrl(base)) fail("Configure an HTTP TMLBrain server first: tmlbrain install --server http://host:8477");
|
|
1075
1156
|
const token = opts.token || state.token || process.env.TMLBRAIN_TOKEN || null;
|
|
1076
1157
|
const url = new URL(endpoint, base.endsWith("/") ? base : `${base}/`);
|
|
1077
1158
|
const transport = url.protocol === "https:" ? https : http;
|
|
@@ -1399,6 +1480,18 @@ function parseArgs(args) {
|
|
|
1399
1480
|
return opts;
|
|
1400
1481
|
}
|
|
1401
1482
|
|
|
1483
|
+
function redactArgs(args) {
|
|
1484
|
+
const redacted = [];
|
|
1485
|
+
for (let i = 0; i < args.length; i += 1) {
|
|
1486
|
+
redacted.push(args[i]);
|
|
1487
|
+
if (args[i] === "--token" && i + 1 < args.length) {
|
|
1488
|
+
redacted.push("<token>");
|
|
1489
|
+
i += 1;
|
|
1490
|
+
}
|
|
1491
|
+
}
|
|
1492
|
+
return redacted;
|
|
1493
|
+
}
|
|
1494
|
+
|
|
1402
1495
|
function promptText(label, defaultValue = "") {
|
|
1403
1496
|
const suffix = defaultValue ? ` [${defaultValue}]` : "";
|
|
1404
1497
|
return promptLine(`${label}${suffix}: `).then((answer) => {
|
|
@@ -1556,6 +1649,21 @@ function parseRgLine(line) {
|
|
|
1556
1649
|
return { path: match[1], line: Number(match[2]), text: match[3] };
|
|
1557
1650
|
}
|
|
1558
1651
|
|
|
1652
|
+
function readPackageInfo() {
|
|
1653
|
+
try {
|
|
1654
|
+
const pkg = JSON.parse(fs.readFileSync(path.join(PACKAGE_ROOT, "package.json"), "utf8"));
|
|
1655
|
+
return {
|
|
1656
|
+
name: pkg.name || "@time-machine-lab/tmlbrain",
|
|
1657
|
+
version: pkg.version || "0.0.0"
|
|
1658
|
+
};
|
|
1659
|
+
} catch {
|
|
1660
|
+
return {
|
|
1661
|
+
name: "@time-machine-lab/tmlbrain",
|
|
1662
|
+
version: "0.0.0"
|
|
1663
|
+
};
|
|
1664
|
+
}
|
|
1665
|
+
}
|
|
1666
|
+
|
|
1559
1667
|
function readState() {
|
|
1560
1668
|
return fs.existsSync(STATE_FILE) ? JSON.parse(fs.readFileSync(STATE_FILE, "utf8")) : {};
|
|
1561
1669
|
}
|
|
@@ -1610,10 +1718,20 @@ function checkCommand(command, args = []) {
|
|
|
1610
1718
|
if (process.env.TMLBRAIN_SIMULATE_MISSING_GIT === "1" && command === "git") {
|
|
1611
1719
|
return { ok: false, version: null };
|
|
1612
1720
|
}
|
|
1613
|
-
const result =
|
|
1721
|
+
const result = runCommand(command, args, { encoding: "utf8" });
|
|
1614
1722
|
return { ok: result.status === 0, version: result.stdout ? result.stdout.split(/\r?\n/)[0] : null };
|
|
1615
1723
|
}
|
|
1616
1724
|
|
|
1725
|
+
function runCommand(command, args = [], opts = {}) {
|
|
1726
|
+
const spawnOpts = {
|
|
1727
|
+
cwd: opts.cwd || ROOT,
|
|
1728
|
+
shell: process.platform === "win32"
|
|
1729
|
+
};
|
|
1730
|
+
if (opts.stdio) spawnOpts.stdio = opts.stdio;
|
|
1731
|
+
else spawnOpts.encoding = opts.encoding || "utf8";
|
|
1732
|
+
return spawnSync(command, args, spawnOpts);
|
|
1733
|
+
}
|
|
1734
|
+
|
|
1617
1735
|
function git(args, opts = {}) {
|
|
1618
1736
|
const result = spawnSync("git", args, { cwd: ROOT, encoding: "utf8" });
|
|
1619
1737
|
const out = { ok: result.status === 0, stdout: result.stdout || "", stderr: result.stderr || "" };
|
package/docs/install.md
CHANGED
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
## Client
|
|
4
4
|
|
|
5
|
-
Recommended
|
|
5
|
+
Recommended npm install:
|
|
6
6
|
|
|
7
7
|
```text
|
|
8
|
-
|
|
8
|
+
npm install -g @time-machine-lab/tmlbrain@latest
|
|
9
|
+
tmlbrain client install
|
|
9
10
|
```
|
|
10
11
|
|
|
11
12
|
The installer asks for:
|
|
@@ -19,21 +20,31 @@ search, index, and save Markdown under the local `knowledge/` folder. They can
|
|
|
19
20
|
connect to a team server later:
|
|
20
21
|
|
|
21
22
|
```text
|
|
22
|
-
tmlbrain config set-server http://server-host:
|
|
23
|
+
tmlbrain config set-server http://server-host:8477 --token <token>
|
|
23
24
|
tmlbrain sync --pull
|
|
24
25
|
```
|
|
25
26
|
|
|
26
|
-
Non-interactive
|
|
27
|
+
Non-interactive npm install:
|
|
27
28
|
|
|
28
29
|
```text
|
|
29
|
-
|
|
30
|
+
npm install -g @time-machine-lab/tmlbrain@latest
|
|
31
|
+
tmlbrain client install --server http://server-host:8477 --token <token> --yes
|
|
30
32
|
```
|
|
31
33
|
|
|
32
|
-
|
|
34
|
+
Update an existing npm-installed client:
|
|
33
35
|
|
|
34
36
|
```text
|
|
35
|
-
|
|
36
|
-
|
|
37
|
+
tmlbrain update
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
`tmlbrain update` runs `npm install -g @time-machine-lab/tmlbrain@latest`,
|
|
41
|
+
refreshes the local Skill/runtime, and preserves the existing server URL and
|
|
42
|
+
token. Use `tmlbrain update 0.1.1` to update to a specific version.
|
|
43
|
+
|
|
44
|
+
Optional one-time npx install without keeping a global command:
|
|
45
|
+
|
|
46
|
+
```text
|
|
47
|
+
npx -y @time-machine-lab/tmlbrain@latest client install
|
|
37
48
|
```
|
|
38
49
|
|
|
39
50
|
## Server
|
|
@@ -45,7 +56,7 @@ skeleton.
|
|
|
45
56
|
|
|
46
57
|
```text
|
|
47
58
|
docker run -d --name tmlbrain-server \
|
|
48
|
-
-p
|
|
59
|
+
-p 8477:8477 \
|
|
49
60
|
-e TMLBRAIN_SERVER_TOKEN=<required-token> \
|
|
50
61
|
-e TMLBRAIN_KNOWLEDGE_REPO=https://github.com/Time-Machine-Lab/TMLBrainKnowledge.git \
|
|
51
62
|
-e TMLBRAIN_KNOWLEDGE_REF=main \
|
|
@@ -89,7 +100,11 @@ repository configured in GitHub Actions secret `DOCKER_REPO`. The npm client
|
|
|
89
100
|
package is published by the same workflow with the `NPM_TOKEN` repository
|
|
90
101
|
secret. The workflow then logs in to the target server with
|
|
91
102
|
`SERVER_HOST`, `SERVER_USER`, and `SERVER_PWD`, pulls the new image, and
|
|
92
|
-
restarts the `tmlbrain-server` container.
|
|
103
|
+
restarts the `tmlbrain-server` container. Server-side Docker login is skipped
|
|
104
|
+
by default because the runtime image is expected to be public; only the GitHub
|
|
105
|
+
Actions runner needs Docker credentials to push the image. For a private image,
|
|
106
|
+
set `TMLBRAIN_SERVER_DOCKER_LOGIN=true` and provide
|
|
107
|
+
`TMLBRAIN_SERVER_DOCKER_USERNAME` plus `TMLBRAIN_SERVER_DOCKER_PASSWORD`.
|
|
93
108
|
|
|
94
109
|
```text
|
|
95
110
|
<DOCKER_REPO>:latest
|
|
@@ -135,7 +150,7 @@ commits that do not contain `<Auto>`.
|
|
|
135
150
|
Example:
|
|
136
151
|
|
|
137
152
|
```text
|
|
138
|
-
[tml-brain]<Auto> release server and client -v:0.1.0 -rp:
|
|
153
|
+
[tml-brain]<Auto> release server and client -v:0.1.0 -rp:8477 -de:<-e KEY=value>
|
|
139
154
|
```
|
|
140
155
|
|
|
141
156
|
Fields:
|
|
@@ -143,7 +158,7 @@ Fields:
|
|
|
143
158
|
- `<Auto>` is required to trigger publishing.
|
|
144
159
|
- `-v:<semver>` is required and is used for both npm and Docker versions. Use a
|
|
145
160
|
Docker-compatible value such as `0.1.0` or `0.1.0-beta.1`.
|
|
146
|
-
- `-rp:<port>` is optional and defaults to `
|
|
161
|
+
- `-rp:<port>` is optional and defaults to `8477`; it becomes the Docker image
|
|
147
162
|
default `TMLBRAIN_PORT`.
|
|
148
163
|
- `-de:<...>` is optional single-line Docker runtime metadata, such as
|
|
149
164
|
additional `docker run -e` arguments. It stays in the commit message and is
|
package/docs/runtime.md
CHANGED
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
TMLBrain should feel like one product to the user:
|
|
6
6
|
|
|
7
7
|
```text
|
|
8
|
-
|
|
8
|
+
npm install -g @time-machine-lab/tmlbrain@latest
|
|
9
|
+
tmlbrain client install
|
|
9
10
|
@TMLBrain search or update knowledge
|
|
10
11
|
```
|
|
11
12
|
|
|
@@ -43,7 +44,8 @@ If Python, CocoIndex, or LightRAG cannot be activated, core TMLBrain remains usa
|
|
|
43
44
|
Recommended npm client entry:
|
|
44
45
|
|
|
45
46
|
```text
|
|
46
|
-
|
|
47
|
+
npm install -g @time-machine-lab/tmlbrain@latest
|
|
48
|
+
tmlbrain client install
|
|
47
49
|
```
|
|
48
50
|
|
|
49
51
|
The client installer asks for a server URL. Leaving it empty starts local-only
|
|
@@ -66,7 +68,8 @@ Both scripts call the same CLI bootstrap flow and keep the user away from raw Gi
|
|
|
66
68
|
Non-interactive client install:
|
|
67
69
|
|
|
68
70
|
```text
|
|
69
|
-
|
|
71
|
+
npm install -g @time-machine-lab/tmlbrain@latest
|
|
72
|
+
tmlbrain client install --server http://server-host:8477 --token secret --yes
|
|
70
73
|
```
|
|
71
74
|
|
|
72
75
|
## Server Runtime
|
|
@@ -74,7 +77,7 @@ npx @time-machine-lab/tmlbrain client install --server http://server-host:7389 -
|
|
|
74
77
|
Run with Docker:
|
|
75
78
|
|
|
76
79
|
```text
|
|
77
|
-
docker run -d --name tmlbrain-server -p
|
|
80
|
+
docker run -d --name tmlbrain-server -p 8477:8477 -e TMLBRAIN_SERVER_TOKEN=secret -e TMLBRAIN_KNOWLEDGE_REPO=https://github.com/Time-Machine-Lab/TMLBrainKnowledge.git -v tmlbrain-data:/data <DOCKER_REPO>:latest
|
|
78
81
|
```
|
|
79
82
|
|
|
80
83
|
The image contains tooling and templates only. Real knowledge is restored from
|
|
@@ -86,7 +89,7 @@ port with `-e TMLBRAIN_PORT=<port>` and the corresponding Docker `-p` mapping.
|
|
|
86
89
|
Manual development mode from the server worktree:
|
|
87
90
|
|
|
88
91
|
```text
|
|
89
|
-
node bin/tmlbrain.js serve --host 0.0.0.0 --port
|
|
92
|
+
node bin/tmlbrain.js serve --host 0.0.0.0 --port 8477
|
|
90
93
|
```
|
|
91
94
|
|
|
92
95
|
Only the server runtime should mutate Markdown, commit repository changes, or
|
package/docs/server-api.md
CHANGED
|
@@ -13,7 +13,7 @@ Recommended Docker deployment:
|
|
|
13
13
|
|
|
14
14
|
```text
|
|
15
15
|
docker run -d --name tmlbrain-server \
|
|
16
|
-
-p
|
|
16
|
+
-p 8477:8477 \
|
|
17
17
|
-e TMLBRAIN_SERVER_TOKEN=secret \
|
|
18
18
|
-e TMLBRAIN_KNOWLEDGE_REPO=https://github.com/Time-Machine-Lab/TMLBrainKnowledge.git \
|
|
19
19
|
-v tmlbrain-data:/data \
|
|
@@ -27,19 +27,19 @@ worktree instead of cloning again.
|
|
|
27
27
|
Run from the server worktree:
|
|
28
28
|
|
|
29
29
|
```text
|
|
30
|
-
node bin/tmlbrain.js serve --host 0.0.0.0 --port
|
|
30
|
+
node bin/tmlbrain.js serve --host 0.0.0.0 --port 8477
|
|
31
31
|
```
|
|
32
32
|
|
|
33
33
|
Optional token protection:
|
|
34
34
|
|
|
35
35
|
```text
|
|
36
|
-
TMLBRAIN_SERVER_TOKEN=secret node bin/tmlbrain.js serve --host 0.0.0.0 --port
|
|
36
|
+
TMLBRAIN_SERVER_TOKEN=secret node bin/tmlbrain.js serve --host 0.0.0.0 --port 8477
|
|
37
37
|
```
|
|
38
38
|
|
|
39
39
|
Clients then install with:
|
|
40
40
|
|
|
41
41
|
```text
|
|
42
|
-
npx @time-machine-lab/tmlbrain client install --server http://server-host:
|
|
42
|
+
npx -y @time-machine-lab/tmlbrain@latest client install --server http://server-host:8477 --token secret --yes
|
|
43
43
|
```
|
|
44
44
|
|
|
45
45
|
The client stores this in `.tmlbrain/state.json`. The token is not shown by
|
|
@@ -54,19 +54,19 @@ node bin/tmlbrain.js config show
|
|
|
54
54
|
Switch a client to a different server:
|
|
55
55
|
|
|
56
56
|
```text
|
|
57
|
-
node bin/tmlbrain.js config set-server http://new-server-host:
|
|
57
|
+
node bin/tmlbrain.js config set-server http://new-server-host:8477 --token secret
|
|
58
58
|
node bin/tmlbrain.js sync --pull
|
|
59
59
|
```
|
|
60
60
|
|
|
61
61
|
`--server` and `--token` can also be passed to one command for temporary
|
|
62
62
|
overrides.
|
|
63
63
|
|
|
64
|
-
If the cloud security group does not expose port `
|
|
64
|
+
If the cloud security group does not expose port `8477`, keep the API private
|
|
65
65
|
and use a tunnel from the client machine:
|
|
66
66
|
|
|
67
67
|
```text
|
|
68
|
-
ssh -N -L
|
|
69
|
-
npx @time-machine-lab/tmlbrain client install --server http://127.0.0.1:
|
|
68
|
+
ssh -N -L 8478:127.0.0.1:8477 tmlbrain-1007
|
|
69
|
+
npx -y @time-machine-lab/tmlbrain@latest client install --server http://127.0.0.1:8478 --token secret --yes
|
|
70
70
|
```
|
|
71
71
|
|
|
72
72
|
## Client Commands
|
package/docs/sync.md
CHANGED
package/package.json
CHANGED
|
@@ -12,7 +12,7 @@ BARE_REPO="${TMLBRAIN_BARE_REPO:-$DATA_DIR/tmlbrain.git}"
|
|
|
12
12
|
KNOWLEDGE_REPO="${TMLBRAIN_KNOWLEDGE_REPO:-}"
|
|
13
13
|
KNOWLEDGE_REF="${TMLBRAIN_KNOWLEDGE_REF:-main}"
|
|
14
14
|
HOST="${TMLBRAIN_HOST:-0.0.0.0}"
|
|
15
|
-
PORT="${TMLBRAIN_PORT:-
|
|
15
|
+
PORT="${TMLBRAIN_PORT:-8477}"
|
|
16
16
|
|
|
17
17
|
mkdir -p "$DATA_DIR"
|
|
18
18
|
|
package/skills/tmlbrain/SKILL.md
CHANGED
|
@@ -82,10 +82,17 @@ for newly saved knowledge.
|
|
|
82
82
|
Initialize or repair local runtime:
|
|
83
83
|
|
|
84
84
|
```text
|
|
85
|
-
|
|
85
|
+
npm install -g @time-machine-lab/tmlbrain@latest
|
|
86
|
+
tmlbrain client install
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Update an existing npm-installed client without re-entering setup:
|
|
90
|
+
|
|
91
|
+
```text
|
|
92
|
+
tmlbrain update
|
|
86
93
|
```
|
|
87
94
|
|
|
88
|
-
Run local CLI after
|
|
95
|
+
Run local CLI after package installation:
|
|
89
96
|
|
|
90
97
|
```text
|
|
91
98
|
tmlbrain client install
|
|
@@ -143,19 +150,19 @@ Show or change the configured server:
|
|
|
143
150
|
|
|
144
151
|
```text
|
|
145
152
|
tmlbrain config show
|
|
146
|
-
tmlbrain config set-server http://server-host:
|
|
153
|
+
tmlbrain config set-server http://server-host:8477 --token <token>
|
|
147
154
|
```
|
|
148
155
|
|
|
149
156
|
Start the server API from the server worktree:
|
|
150
157
|
|
|
151
158
|
```text
|
|
152
|
-
tmlbrain serve --host 0.0.0.0 --port
|
|
159
|
+
tmlbrain serve --host 0.0.0.0 --port 8477
|
|
153
160
|
```
|
|
154
161
|
|
|
155
162
|
Deploy the server with Docker:
|
|
156
163
|
|
|
157
164
|
```text
|
|
158
|
-
docker run -d --name tmlbrain-server -p
|
|
165
|
+
docker run -d --name tmlbrain-server -p 8477:8477 -e TMLBRAIN_SERVER_TOKEN=<token> -e TMLBRAIN_KNOWLEDGE_REPO=<git-url> -v tmlbrain-data:/data <DOCKER_REPO>:latest
|
|
159
166
|
```
|
|
160
167
|
|
|
161
168
|
Back up server state:
|