@andespindola/brainlink 0.1.0-beta.31 → 0.1.0-beta.32
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 +3 -0
- package/dist/cli/commands/write-commands.js +30 -1
- package/docs/AGENT_USAGE.md +2 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -553,6 +553,7 @@ blink server --host 127.0.0.1 --port 4321 --watch
|
|
|
553
553
|
```
|
|
554
554
|
|
|
555
555
|
By default, the server uses `$HOME/.brainlink/vault`. Pass `--vault ./vault` only when you want to inspect a custom vault.
|
|
556
|
+
By default, `blink server` also opens the graph URL in your default browser. Use `--no-open` to keep it headless.
|
|
556
557
|
|
|
557
558
|
The graph UI shows:
|
|
558
559
|
|
|
@@ -838,9 +839,11 @@ Watches Markdown files and rebuilds the index when notes change.
|
|
|
838
839
|
```bash
|
|
839
840
|
blink server --watch
|
|
840
841
|
blink server --vault ./vault --watch
|
|
842
|
+
blink server --vault ./vault --watch --no-open
|
|
841
843
|
```
|
|
842
844
|
|
|
843
845
|
Starts the local read-only graph UI and HTTP API.
|
|
846
|
+
By default, it opens the graph URL in your default browser. Use `--no-open` to skip that behavior.
|
|
844
847
|
|
|
845
848
|
The HTTP server only binds to loopback hosts such as `127.0.0.1`, `localhost` or `::1`.
|
|
846
849
|
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { readFileSync } from 'node:fs';
|
|
2
2
|
import { mkdir, writeFile } from 'node:fs/promises';
|
|
3
3
|
import { dirname, relative, resolve } from 'node:path';
|
|
4
|
+
import { platform } from 'node:os';
|
|
5
|
+
import { spawn } from 'node:child_process';
|
|
4
6
|
import { addNote } from '../../application/add-note.js';
|
|
5
7
|
import { buildContextPackage } from '../../application/build-context.js';
|
|
6
8
|
import { importLegacySqliteDatabase } from '../../application/import-legacy-sqlite.js';
|
|
@@ -24,6 +26,29 @@ const resolveAddContent = (options) => {
|
|
|
24
26
|
}
|
|
25
27
|
return readFileSync(options.contentFile, 'utf8');
|
|
26
28
|
};
|
|
29
|
+
const openUrlInBrowser = (url) => {
|
|
30
|
+
const openDisabled = process.env.BRAINLINK_NO_BROWSER === '1' ||
|
|
31
|
+
process.env.BRAINLINK_NO_BROWSER === 'true' ||
|
|
32
|
+
process.env.CI === 'true';
|
|
33
|
+
if (openDisabled) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
try {
|
|
37
|
+
if (platform() === 'darwin') {
|
|
38
|
+
const child = spawn('open', [url], { detached: true, stdio: 'ignore' });
|
|
39
|
+
child.unref();
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
if (platform() === 'win32') {
|
|
43
|
+
const child = spawn('cmd', ['/c', 'start', '', url], { detached: true, stdio: 'ignore' });
|
|
44
|
+
child.unref();
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
const child = spawn('xdg-open', [url], { detached: true, stdio: 'ignore' });
|
|
48
|
+
child.unref();
|
|
49
|
+
}
|
|
50
|
+
catch { }
|
|
51
|
+
};
|
|
27
52
|
export const registerWriteCommands = (program) => {
|
|
28
53
|
program
|
|
29
54
|
.command('init')
|
|
@@ -213,6 +238,7 @@ export const registerWriteCommands = (program) => {
|
|
|
213
238
|
.option('-h, --host <host>', 'server host', '127.0.0.1')
|
|
214
239
|
.option('-p, --port <port>', 'server port', '4321')
|
|
215
240
|
.option('--no-index', 'skip indexing before starting the server')
|
|
241
|
+
.option('--no-open', 'do not open the graph UI in the default browser')
|
|
216
242
|
.option('-w, --watch', 'watch markdown files and reindex on changes')
|
|
217
243
|
.option('--json', 'print machine-readable JSON')
|
|
218
244
|
.description('start a local web UI for the knowledge graph')
|
|
@@ -225,7 +251,10 @@ export const registerWriteCommands = (program) => {
|
|
|
225
251
|
shouldIndex: options.index,
|
|
226
252
|
shouldWatch: Boolean(options.watch)
|
|
227
253
|
});
|
|
228
|
-
|
|
254
|
+
if (options.open !== false) {
|
|
255
|
+
openUrlInBrowser(server.url);
|
|
256
|
+
}
|
|
257
|
+
print(options.json, { url: server.url, watch: Boolean(options.watch), readonly: true, openedInBrowser: options.open !== false }, () => `Brainlink graph server running at ${server.url}${options.open !== false ? ' (opened in browser)' : ''}`);
|
|
229
258
|
});
|
|
230
259
|
program
|
|
231
260
|
.command('quickstart')
|
package/docs/AGENT_USAGE.md
CHANGED
|
@@ -536,9 +536,11 @@ shared: 30 documents
|
|
|
536
536
|
```bash
|
|
537
537
|
blink server --host 127.0.0.1 --port 4321
|
|
538
538
|
blink server --vault ./vault --host 127.0.0.1 --port 4321
|
|
539
|
+
blink server --vault ./vault --host 127.0.0.1 --port 4321 --no-open
|
|
539
540
|
```
|
|
540
541
|
|
|
541
542
|
This starts a local frontend for inspecting the knowledge graph.
|
|
543
|
+
By default it opens the graph URL in your default browser. Use `--no-open` to keep the server headless.
|
|
542
544
|
|
|
543
545
|
Without `--vault`, the graph UI serves `$HOME/.brainlink/vault`.
|
|
544
546
|
|
package/package.json
CHANGED