backpack-ontology 0.7.13 → 0.8.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 +123 -0
- package/dist/bin/bp.d.ts +3 -0
- package/dist/bin/bp.d.ts.map +1 -0
- package/dist/bin/bp.js +6 -0
- package/dist/bin/bp.js.map +1 -0
- package/dist/cli/colors.d.ts +20 -0
- package/dist/cli/colors.d.ts.map +1 -0
- package/dist/cli/colors.js +34 -0
- package/dist/cli/colors.js.map +1 -0
- package/dist/cli/commands/auth.d.ts +4 -0
- package/dist/cli/commands/auth.d.ts.map +1 -0
- package/dist/cli/commands/auth.js +48 -0
- package/dist/cli/commands/auth.js.map +1 -0
- package/dist/cli/commands/cat.d.ts +3 -0
- package/dist/cli/commands/cat.d.ts.map +1 -0
- package/dist/cli/commands/cat.js +28 -0
- package/dist/cli/commands/cat.js.map +1 -0
- package/dist/cli/commands/cloud-admin.d.ts +7 -0
- package/dist/cli/commands/cloud-admin.d.ts.map +1 -0
- package/dist/cli/commands/cloud-admin.js +169 -0
- package/dist/cli/commands/cloud-admin.js.map +1 -0
- package/dist/cli/commands/completion.d.ts +3 -0
- package/dist/cli/commands/completion.d.ts.map +1 -0
- package/dist/cli/commands/completion.js +156 -0
- package/dist/cli/commands/completion.js.map +1 -0
- package/dist/cli/commands/containers.d.ts +3 -0
- package/dist/cli/commands/containers.d.ts.map +1 -0
- package/dist/cli/commands/containers.js +29 -0
- package/dist/cli/commands/containers.js.map +1 -0
- package/dist/cli/commands/context.d.ts +4 -0
- package/dist/cli/commands/context.d.ts.map +1 -0
- package/dist/cli/commands/context.js +59 -0
- package/dist/cli/commands/context.js.map +1 -0
- package/dist/cli/commands/doctor.d.ts +3 -0
- package/dist/cli/commands/doctor.d.ts.map +1 -0
- package/dist/cli/commands/doctor.js +65 -0
- package/dist/cli/commands/doctor.js.map +1 -0
- package/dist/cli/commands/graphs.d.ts +3 -0
- package/dist/cli/commands/graphs.d.ts.map +1 -0
- package/dist/cli/commands/graphs.js +57 -0
- package/dist/cli/commands/graphs.js.map +1 -0
- package/dist/cli/commands/init.d.ts +3 -0
- package/dist/cli/commands/init.d.ts.map +1 -0
- package/dist/cli/commands/init.js +46 -0
- package/dist/cli/commands/init.js.map +1 -0
- package/dist/cli/commands/kbs.d.ts +3 -0
- package/dist/cli/commands/kbs.d.ts.map +1 -0
- package/dist/cli/commands/kbs.js +247 -0
- package/dist/cli/commands/kbs.js.map +1 -0
- package/dist/cli/commands/ls.d.ts +3 -0
- package/dist/cli/commands/ls.d.ts.map +1 -0
- package/dist/cli/commands/ls.js +81 -0
- package/dist/cli/commands/ls.js.map +1 -0
- package/dist/cli/commands/mutate.d.ts +7 -0
- package/dist/cli/commands/mutate.d.ts.map +1 -0
- package/dist/cli/commands/mutate.js +241 -0
- package/dist/cli/commands/mutate.js.map +1 -0
- package/dist/cli/commands/open.d.ts +3 -0
- package/dist/cli/commands/open.d.ts.map +1 -0
- package/dist/cli/commands/open.js +88 -0
- package/dist/cli/commands/open.js.map +1 -0
- package/dist/cli/commands/search.d.ts +3 -0
- package/dist/cli/commands/search.d.ts.map +1 -0
- package/dist/cli/commands/search.js +59 -0
- package/dist/cli/commands/search.js.map +1 -0
- package/dist/cli/commands/show.d.ts +3 -0
- package/dist/cli/commands/show.d.ts.map +1 -0
- package/dist/cli/commands/show.js +74 -0
- package/dist/cli/commands/show.js.map +1 -0
- package/dist/cli/commands/version.d.ts +2 -0
- package/dist/cli/commands/version.d.ts.map +1 -0
- package/dist/cli/commands/version.js +16 -0
- package/dist/cli/commands/version.js.map +1 -0
- package/dist/cli/help.d.ts +3 -0
- package/dist/cli/help.d.ts.map +1 -0
- package/dist/cli/help.js +118 -0
- package/dist/cli/help.js.map +1 -0
- package/dist/cli/output.d.ts +23 -0
- package/dist/cli/output.d.ts.map +1 -0
- package/dist/cli/output.js +189 -0
- package/dist/cli/output.js.map +1 -0
- package/dist/cli/parser.d.ts +9 -0
- package/dist/cli/parser.d.ts.map +1 -0
- package/dist/cli/parser.js +106 -0
- package/dist/cli/parser.js.map +1 -0
- package/dist/cli/router.d.ts +2 -0
- package/dist/cli/router.d.ts.map +1 -0
- package/dist/cli/router.js +123 -0
- package/dist/cli/router.js.map +1 -0
- package/dist/cli/util/confirm.d.ts +3 -0
- package/dist/cli/util/confirm.d.ts.map +1 -0
- package/dist/cli/util/confirm.js +37 -0
- package/dist/cli/util/confirm.js.map +1 -0
- package/dist/core/backpack.d.ts +1 -92
- package/dist/core/backpack.d.ts.map +1 -1
- package/dist/core/backpack.js +23 -127
- package/dist/core/backpack.js.map +1 -1
- package/dist/core/backpacks-registry.d.ts +2 -2
- package/dist/core/backpacks-registry.js +2 -2
- package/dist/mcp/tools/cloud-tools.d.ts +2 -3
- package/dist/mcp/tools/cloud-tools.d.ts.map +1 -1
- package/dist/mcp/tools/cloud-tools.js +240 -81
- package/dist/mcp/tools/cloud-tools.js.map +1 -1
- package/dist/mcp/tools/share-tools.js +1 -1
- package/dist/mcp/tools/share-tools.js.map +1 -1
- package/dist/mcp/tools/signal-tools.js +1 -1
- package/dist/mcp/tools/signal-tools.js.map +1 -1
- package/dist/ops/auth.d.ts +25 -0
- package/dist/ops/auth.d.ts.map +1 -0
- package/dist/ops/auth.js +144 -0
- package/dist/ops/auth.js.map +1 -0
- package/dist/ops/containers.d.ts +25 -0
- package/dist/ops/containers.d.ts.map +1 -0
- package/dist/ops/containers.js +144 -0
- package/dist/ops/containers.js.map +1 -0
- package/dist/ops/context.d.ts +30 -0
- package/dist/ops/context.d.ts.map +1 -0
- package/dist/ops/context.js +133 -0
- package/dist/ops/context.js.map +1 -0
- package/dist/ops/graphs.d.ts +48 -0
- package/dist/ops/graphs.d.ts.map +1 -0
- package/dist/ops/graphs.js +249 -0
- package/dist/ops/graphs.js.map +1 -0
- package/dist/ops/kb.d.ts +28 -0
- package/dist/ops/kb.d.ts.map +1 -0
- package/dist/ops/kb.js +162 -0
- package/dist/ops/kb.js.map +1 -0
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -341,6 +341,129 @@ Claude always adds this metadata automatically. You never need to think about it
|
|
|
341
341
|
| `npx -p backpack-ontology@latest backpack-sync` | Upload local learning graphs to Backpack App |
|
|
342
342
|
| `npx backpack-viewer@latest` | Open the graph visualizer (http://localhost:5173). Always include `@latest` — `npx backpack-viewer` without the version suffix reuses a cached older version. |
|
|
343
343
|
| `npx -p backpack-ontology@latest backpack-init` | Remove any leftover Backpack hooks from `.claude/settings.json` |
|
|
344
|
+
| `bp` | The standalone `bp` CLI — see below |
|
|
345
|
+
|
|
346
|
+
### The `bp` CLI
|
|
347
|
+
|
|
348
|
+
`bp` is a standalone command-line interface for Backpack — the same kind of tool you reach for when you want to script against your knowledge graph, run a quick query, or pipe graph data into `jq`. Style is deliberately Unix-flavored (`bp ls`, `bp cat`, `bp rm`, `bp mv`) with a `gh`/`kubectl`-style canonical form for power users (`bp graphs list`, `bp containers create`).
|
|
349
|
+
|
|
350
|
+
Install (it ships in the same package as the MCP server):
|
|
351
|
+
|
|
352
|
+
```bash
|
|
353
|
+
npm install -g backpack-ontology
|
|
354
|
+
bp # prints a hint card with the most-used commands
|
|
355
|
+
bp help # full reference
|
|
356
|
+
bp completion zsh # tab completion for your shell (also: bash, fish)
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
#### Quick tour
|
|
360
|
+
|
|
361
|
+
```bash
|
|
362
|
+
# Where am I? Who am I?
|
|
363
|
+
bp where # current scope (local backpack or cloud container + identity)
|
|
364
|
+
bp whoami # signed-in email
|
|
365
|
+
bp doctor # auth, connectivity, version skew checks
|
|
366
|
+
|
|
367
|
+
# Sign in to Backpack App (shares the token with the viewer)
|
|
368
|
+
bp login
|
|
369
|
+
|
|
370
|
+
# Switch contexts — fuzzy matched, did-you-mean on typos
|
|
371
|
+
bp use # list available contexts
|
|
372
|
+
bp use cloud:my-container # switch to a cloud container
|
|
373
|
+
bp use local:work # switch to a local backpack
|
|
374
|
+
|
|
375
|
+
# List graphs in the active scope
|
|
376
|
+
bp ls # default tabular
|
|
377
|
+
bp ls --json | jq '.graphs[] | .name' # machine-readable
|
|
378
|
+
bp ls --names # names only, one per line
|
|
379
|
+
bp ls containers # cloud sync_backpacks
|
|
380
|
+
bp ls kbs # knowledge-base docs
|
|
381
|
+
|
|
382
|
+
# Read graph data
|
|
383
|
+
bp cat agent-capabilities > graph.json # JSON to stdout
|
|
384
|
+
bp cat agent-capabilities | jq '.nodes | length'
|
|
385
|
+
bp show agent-capabilities # human-friendly summary + type histogram
|
|
386
|
+
bp open agent-capabilities # launch the viewer
|
|
387
|
+
|
|
388
|
+
# Search across visible graphs
|
|
389
|
+
bp search "transformer"
|
|
390
|
+
bp search "Sarah Chen" --names
|
|
391
|
+
bp search "pgx" --max-graphs 100 # raise the fan-out cap
|
|
392
|
+
|
|
393
|
+
# Mutations — graphs
|
|
394
|
+
bp graphs create my-new-graph --description "scratchpad"
|
|
395
|
+
bp graphs apply -f exported.json # idempotent upsert from a file
|
|
396
|
+
bp graphs edit my-new-graph # opens in $EDITOR; structural-no-op detected
|
|
397
|
+
bp graphs rename old new # or: bp mv old new
|
|
398
|
+
bp graphs delete old # or: bp rm old (asks for confirmation)
|
|
399
|
+
bp rm old --yes # skip the confirm
|
|
400
|
+
|
|
401
|
+
# KB documents
|
|
402
|
+
bp kbs list
|
|
403
|
+
bp kbs get my-doc # body to stdout
|
|
404
|
+
bp kbs create -f notes.md --tags=alpha,beta
|
|
405
|
+
bp kbs edit my-doc
|
|
406
|
+
bp kbs delete my-doc
|
|
407
|
+
|
|
408
|
+
# Cloud admin (containers / sync_backpacks)
|
|
409
|
+
bp containers list
|
|
410
|
+
bp containers create client-acme --color "#7c3aed" --tags=client
|
|
411
|
+
bp containers rename client-acme client-acme-renamed
|
|
412
|
+
bp containers delete client-acme-renamed # refuses if non-empty
|
|
413
|
+
bp graphs move some-graph --to client-acme
|
|
414
|
+
bp kbs move doc-id --to client-acme
|
|
415
|
+
|
|
416
|
+
# Initialize a new local backpack root
|
|
417
|
+
mkdir -p ~/work-backpack && cd ~/work-backpack
|
|
418
|
+
bp init # registers and switches to it
|
|
419
|
+
```
|
|
420
|
+
|
|
421
|
+
#### Output formats
|
|
422
|
+
|
|
423
|
+
Pick one:
|
|
424
|
+
|
|
425
|
+
| Flag | Output | Stable contract? |
|
|
426
|
+
|---|---|---|
|
|
427
|
+
| (default) | human-friendly table with colors, narrows on small terminals | no — free to evolve |
|
|
428
|
+
| `--json` | full JSON | **yes** — script against this |
|
|
429
|
+
| `--yaml` | YAML | yes |
|
|
430
|
+
| `--names` | one name per line | yes |
|
|
431
|
+
| `--wide` | every column (still human) | no |
|
|
432
|
+
| `--no-color` | strip ANSI codes (also honors `NO_COLOR=1`) | n/a |
|
|
433
|
+
|
|
434
|
+
Scripts should always pipe `--json` to `jq` or use `--names`. The default human view is allowed to change between releases.
|
|
435
|
+
|
|
436
|
+
#### Exit codes
|
|
437
|
+
|
|
438
|
+
| Code | Meaning |
|
|
439
|
+
|---|---|
|
|
440
|
+
| 0 | success |
|
|
441
|
+
| 1 | failure (any kind — auth, validation, network, server error) |
|
|
442
|
+
| 130 | user-interrupted ($EDITOR session aborted with Ctrl-C) |
|
|
443
|
+
|
|
444
|
+
Destructive verbs (`rm`, `mv`, `containers delete`, `kbs delete`) prompt for confirmation in a TTY and refuse in non-TTY contexts unless you pass `-y` / `--yes`.
|
|
445
|
+
|
|
446
|
+
#### Context model
|
|
447
|
+
|
|
448
|
+
A `bp` "context" is one of:
|
|
449
|
+
|
|
450
|
+
* `local:<backpack-name>` — a directory of learning graphs on your machine
|
|
451
|
+
* `cloud:<container-name>` — a cloud sync_backpack on Backpack App
|
|
452
|
+
|
|
453
|
+
`bp where` shows your current context. `bp use <name>` switches it (fuzzy-matched against the suffix; `bp use projects` works as long as it's unambiguous, otherwise the CLI tells you the candidates and asks you to pick the full `local:foo` or `cloud:foo`).
|
|
454
|
+
|
|
455
|
+
#### Auth
|
|
456
|
+
|
|
457
|
+
`bp login` runs the OAuth flow against Backpack App. The token is stored in `~/.config/backpack/extensions/share/settings.json` — the same file the viewer's Sign In button writes to, so signing in once works for both the CLI and the viewer. `bp logout` clears every known token location and is loud if any clear fails (so you don't think you're signed out when you aren't).
|
|
458
|
+
|
|
459
|
+
#### Configuration
|
|
460
|
+
|
|
461
|
+
| Variable | Effect |
|
|
462
|
+
|---|---|
|
|
463
|
+
| `BACKPACK_APP_URL` | Override the relay endpoint (default: `https://app.backpackontology.com`) |
|
|
464
|
+
| `BACKPACK_INSECURE_RELAY=1` | Allow plaintext HTTP for the relay (only for local dev — non-localhost HTTP is refused by default) |
|
|
465
|
+
| `EDITOR` / `VISUAL` | Used by `bp graphs edit` / `bp kbs edit`. Multi-arg values like `code --wait` work. |
|
|
466
|
+
| `NO_COLOR=1` | Disable ANSI colors |
|
|
344
467
|
|
|
345
468
|
### Multiple backpacks
|
|
346
469
|
|
package/dist/bin/bp.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bp.d.ts","sourceRoot":"","sources":["../../src/bin/bp.ts"],"names":[],"mappings":""}
|
package/dist/bin/bp.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bp.js","sourceRoot":"","sources":["../../src/bin/bp.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AACvC,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACnC,MAAM,QAAQ,GAAG,MAAM,GAAG,CAAC,IAAI,CAAC,CAAC;AACjC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare function setColorEnabled(on: boolean): void;
|
|
2
|
+
export declare function isColorEnabled(): boolean;
|
|
3
|
+
export declare const bold: (s: string) => string;
|
|
4
|
+
export declare const dim: (s: string) => string;
|
|
5
|
+
export declare const red: (s: string) => string;
|
|
6
|
+
export declare const green: (s: string) => string;
|
|
7
|
+
export declare const yellow: (s: string) => string;
|
|
8
|
+
export declare const blue: (s: string) => string;
|
|
9
|
+
export declare const magenta: (s: string) => string;
|
|
10
|
+
export declare const cyan: (s: string) => string;
|
|
11
|
+
export declare const gray: (s: string) => string;
|
|
12
|
+
export declare function stripAnsi(s: string): string;
|
|
13
|
+
export declare function visibleWidth(s: string): number;
|
|
14
|
+
export declare const symbols: {
|
|
15
|
+
ok: () => string;
|
|
16
|
+
err: () => string;
|
|
17
|
+
warn: () => string;
|
|
18
|
+
bullet: () => string;
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=colors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"colors.d.ts","sourceRoot":"","sources":["../../src/cli/colors.ts"],"names":[],"mappings":"AAGA,wBAAgB,eAAe,CAAC,EAAE,EAAE,OAAO,GAAG,IAAI,CAEjD;AACD,wBAAgB,cAAc,IAAI,OAAO,CAExC;AAID,eAAO,MAAM,IAAI,MAFF,MAAM,KAAG,MAEO,CAAC;AAChC,eAAO,MAAM,GAAG,MAHD,MAAM,KAAG,MAGM,CAAC;AAC/B,eAAO,MAAM,GAAG,MAJD,MAAM,KAAG,MAIO,CAAC;AAChC,eAAO,MAAM,KAAK,MALH,MAAM,KAAG,MAKS,CAAC;AAClC,eAAO,MAAM,MAAM,MANJ,MAAM,KAAG,MAMU,CAAC;AACnC,eAAO,MAAM,IAAI,MAPF,MAAM,KAAG,MAOQ,CAAC;AACjC,eAAO,MAAM,OAAO,MARL,MAAM,KAAG,MAQW,CAAC;AACpC,eAAO,MAAM,IAAI,MATF,MAAM,KAAG,MASQ,CAAC;AACjC,eAAO,MAAM,IAAI,MAVF,MAAM,KAAG,MAUQ,CAAC;AACjC,wBAAgB,SAAS,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAE3C;AACD,wBAAgB,YAAY,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAE9C;AACD,eAAO,MAAM,OAAO;;;;;CAKnB,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
const NO_COLOR_ENV = process.env.NO_COLOR != null && process.env.NO_COLOR !== "";
|
|
2
|
+
const FORCE_COLOR_ENV = process.env.FORCE_COLOR === "1" || process.env.FORCE_COLOR === "true";
|
|
3
|
+
let colorEnabled = FORCE_COLOR_ENV || (process.stdout.isTTY === true && !NO_COLOR_ENV);
|
|
4
|
+
export function setColorEnabled(on) {
|
|
5
|
+
colorEnabled = on;
|
|
6
|
+
}
|
|
7
|
+
export function isColorEnabled() {
|
|
8
|
+
return colorEnabled;
|
|
9
|
+
}
|
|
10
|
+
function wrap(open, close) {
|
|
11
|
+
return (s) => (colorEnabled ? `\x1b[${open}m${s}\x1b[${close}m` : s);
|
|
12
|
+
}
|
|
13
|
+
export const bold = wrap(1, 22);
|
|
14
|
+
export const dim = wrap(2, 22);
|
|
15
|
+
export const red = wrap(31, 39);
|
|
16
|
+
export const green = wrap(32, 39);
|
|
17
|
+
export const yellow = wrap(33, 39);
|
|
18
|
+
export const blue = wrap(34, 39);
|
|
19
|
+
export const magenta = wrap(35, 39);
|
|
20
|
+
export const cyan = wrap(36, 39);
|
|
21
|
+
export const gray = wrap(90, 39);
|
|
22
|
+
export function stripAnsi(s) {
|
|
23
|
+
return s.replace(/\x1b\[[0-9;]*m/g, "");
|
|
24
|
+
}
|
|
25
|
+
export function visibleWidth(s) {
|
|
26
|
+
return [...stripAnsi(s)].length;
|
|
27
|
+
}
|
|
28
|
+
export const symbols = {
|
|
29
|
+
ok: () => (colorEnabled ? green("✓") : "ok"),
|
|
30
|
+
err: () => (colorEnabled ? red("✗") : "fail"),
|
|
31
|
+
warn: () => (colorEnabled ? yellow("!") : "warn"),
|
|
32
|
+
bullet: () => "·",
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=colors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"colors.js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|
+
import { authStatus, login as opsLogin, logout as opsLogout } from "../../ops/auth.js";
|
|
2
|
+
import { dim, green, red, yellow, bold } from "../colors.js";
|
|
3
|
+
export async function runLogin() {
|
|
4
|
+
const before = await authStatus();
|
|
5
|
+
if (before.authenticated) {
|
|
6
|
+
process.stdout.write(`${green("✓")} already signed in${before.email ? ` as ${bold(before.email)}` : ""}\n`);
|
|
7
|
+
process.stdout.write(dim(` endpoint: ${before.endpoint}\n`));
|
|
8
|
+
return 0;
|
|
9
|
+
}
|
|
10
|
+
process.stdout.write(`opening browser to sign in at ${dim(before.endpoint)} …\n`);
|
|
11
|
+
try {
|
|
12
|
+
const { email } = await opsLogin();
|
|
13
|
+
process.stdout.write(`${green("✓")} signed in${email ? ` as ${bold(email)}` : ""}\n`);
|
|
14
|
+
return 0;
|
|
15
|
+
}
|
|
16
|
+
catch (err) {
|
|
17
|
+
process.stderr.write(`${red("✗")} sign-in failed: ${err.message}\n`);
|
|
18
|
+
return 1;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
export async function runLogout() {
|
|
22
|
+
const { cleared, errors } = await opsLogout();
|
|
23
|
+
if (errors.length > 0) {
|
|
24
|
+
process.stderr.write(`${red("✗")} sign-out incomplete — ${errors.length} token location${errors.length === 1 ? "" : "s"} could not be cleared:\n`);
|
|
25
|
+
for (const e of errors) {
|
|
26
|
+
process.stderr.write(` - ${e.path}: ${e.reason}\n`);
|
|
27
|
+
}
|
|
28
|
+
process.stderr.write(`${dim("your token may still be readable. inspect those files manually.")}\n`);
|
|
29
|
+
return 1;
|
|
30
|
+
}
|
|
31
|
+
if (cleared === 0) {
|
|
32
|
+
process.stdout.write(`${yellow("!")} not signed in\n`);
|
|
33
|
+
return 0;
|
|
34
|
+
}
|
|
35
|
+
process.stdout.write(`${green("✓")} signed out (cleared ${cleared} token file${cleared === 1 ? "" : "s"})\n`);
|
|
36
|
+
return 0;
|
|
37
|
+
}
|
|
38
|
+
export async function runWhoami() {
|
|
39
|
+
const status = await authStatus();
|
|
40
|
+
if (!status.authenticated) {
|
|
41
|
+
process.stdout.write(`${dim("not signed in.")} run ${bold("bp login")} to authenticate.\n`);
|
|
42
|
+
return 0;
|
|
43
|
+
}
|
|
44
|
+
process.stdout.write(`${bold(status.email ?? "signed in")}\n`);
|
|
45
|
+
process.stdout.write(dim(` endpoint: ${status.endpoint}\n`));
|
|
46
|
+
return 0;
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=auth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../src/cli/commands/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,KAAK,IAAI,QAAQ,EAAE,MAAM,IAAI,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACvF,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAC7D,MAAM,CAAC,KAAK,UAAU,QAAQ;IAC1B,MAAM,MAAM,GAAG,MAAM,UAAU,EAAE,CAAC;IAClC,IAAI,MAAM,CAAC,aAAa,EAAE,CAAC;QACvB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,qBAAqB,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;QAC5G,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,eAAe,MAAM,CAAC,QAAQ,IAAI,CAAC,CAAC,CAAC;QAC9D,OAAO,CAAC,CAAC;IACb,CAAC;IACD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,iCAAiC,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAClF,IAAI,CAAC;QACD,MAAM,EAAE,KAAK,EAAE,GAAG,MA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,OAAO,CAAC,CAAC;IACb,CAAC;IACD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,wBAAwB,OAAO,cAAc,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC;IAC9G,OAAO,CAAC,CAAC;AACb,CAAC;AACD,MAAM,CAAC,KAAK,UAAU,SAAS;IAC3B,MAAM,MAAM,GAAG,MAAM,UAAU,EAAE,CAAC;IAClC,IAAI,CAAC,MAAM,CAAC,aAAa,EAAE,CAAC;QACxB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,gBAAgB,CAAC,QAAQ,IAAI,CAAC,UAAU,CAAC,qBAAqB,CAAC,CAAC;QAC5F,OAAO,CAAC,CAAC;IACb,CAAC;IACD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,IAAI,WAAW,CAAC,IAAI,CAAC,CAAC;IAC/D,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,eAAe,MAAM,CAAC,QAAQ,IAAI,CAAC,CAAC,CAAC;IAC9D,OAAO,CAAC,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cat.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/cat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG1C,wBAAsB,MAAM,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CAwB9D"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { getGraph } from "../../ops/graphs.js";
|
|
2
|
+
import { red, yellow } from "../colors.js";
|
|
3
|
+
export async function runCat(args) {
|
|
4
|
+
const name = args.positional[0];
|
|
5
|
+
if (!name) {
|
|
6
|
+
process.stderr.write(`bp cat: graph name required.\nusage: bp cat <name>\n`);
|
|
7
|
+
return 1;
|
|
8
|
+
}
|
|
9
|
+
try {
|
|
10
|
+
const result = await getGraph(name);
|
|
11
|
+
switch (result.kind) {
|
|
12
|
+
case "ok":
|
|
13
|
+
process.stdout.write(JSON.stringify(result.data, null, 2) + "\n");
|
|
14
|
+
return 0;
|
|
15
|
+
case "encrypted":
|
|
16
|
+
process.stderr.write(`${yellow("!")} graph "${name}" is encrypted — open it in the local viewer to decrypt.\n`);
|
|
17
|
+
return 1;
|
|
18
|
+
case "missing":
|
|
19
|
+
process.stderr.write(`${red("✗")} graph "${name}" not found in the current scope.\n`);
|
|
20
|
+
return 1;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
catch (err) {
|
|
24
|
+
process.stderr.write(`${red("✗")} ${err.message}\n`);
|
|
25
|
+
return 1;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=cat.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cat.js","sourceRoot":"","sources":["../../../src/cli/commands/cat.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3C,MAAM,CAAC,KAAK,UAAU,MAAM,CAAC,IAAgB;IACzC,MAAM,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IAChC,IAAI,CAAC,IAAI,EAAE,CAAC;QACR,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,sDAAsD,CAAC,CAAC;QAC7E,OAAO,CAAC,CAAC;IACb,CAAC;IACD,IAAI,CAAC;QACD,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,IAAI,CAAC,CAAC;QACpC,QAAQ,MAAM,CAAC,IAAI,EAAE,CAAC;YAClB,KAAK,IAAI;gBACL,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;gBAClE,OAAO,CAAC,CAAC;YACb,KAAK,WAAW;gBACZ,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,WAAW,IAAI,4DAA4D,CAAC,CAAC;gBAChH,OAAO,CAAC,CAAC;YACb,KAAK,SAAS;gBACV,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,WAAW,IAAI,qCAAqC,CAAC,CAAC;gBACtF,OAAO,CAAC,CAAC;QACjB,CAAC;IACL,CAAC;IACD,OAAO,GAAG,EAAE,CAAC;QACT,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,IAAK,GAAa,CAAC,OAAO,IAAI,CAAC,CAAC;QAChE,OAAO,CAAC,CAAC;IACb,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ParsedArgs } from "../parser.js";
|
|
2
|
+
export declare function runContainerCreate(args: ParsedArgs): Promise<number>;
|
|
3
|
+
export declare function runContainerRename(args: ParsedArgs): Promise<number>;
|
|
4
|
+
export declare function runContainerDelete(args: ParsedArgs): Promise<number>;
|
|
5
|
+
export declare function runMoveGraph(args: ParsedArgs): Promise<number>;
|
|
6
|
+
export declare function runMoveKB(args: ParsedArgs): Promise<number>;
|
|
7
|
+
//# sourceMappingURL=cloud-admin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cloud-admin.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/cloud-admin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAc,MAAM,cAAc,CAAC;AActD,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CAsB1E;AACD,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CA0B1E;AACD,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CA6C1E;AACD,wBAAsB,YAAY,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CAoCpE;AACD,wBAAsB,SAAS,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CAoBjE"}
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import { flagString } from "../parser.js";
|
|
2
|
+
import { createContainer, renameContainer, deleteContainer, moveGraphToContainer, moveKBToContainer, } from "../../ops/containers.js";
|
|
3
|
+
import { listGraphs } from "../../ops/graphs.js";
|
|
4
|
+
import { listKB } from "../../ops/kb.js";
|
|
5
|
+
import { getContext } from "../../ops/context.js";
|
|
6
|
+
import { confirm } from "../util/confirm.js";
|
|
7
|
+
import { red, green, dim, bold, yellow } from "../colors.js";
|
|
8
|
+
const HEX_COLOR = /^#[0-9A-Fa-f]{6}$/;
|
|
9
|
+
function parseTags(raw) {
|
|
10
|
+
if (raw === undefined)
|
|
11
|
+
return undefined;
|
|
12
|
+
const tags = raw.split(",").map((t) => t.trim()).filter(Boolean);
|
|
13
|
+
return tags;
|
|
14
|
+
}
|
|
15
|
+
export async function runContainerCreate(args) {
|
|
16
|
+
const name = args.positional[0];
|
|
17
|
+
if (!name) {
|
|
18
|
+
process.stderr.write(`bp containers create: name required.\nusage: bp containers create <name> [--color=#RRGGBB] [--tags=a,b,c]\n`);
|
|
19
|
+
return 1;
|
|
20
|
+
}
|
|
21
|
+
const color = flagString(args, "color");
|
|
22
|
+
if (color && !HEX_COLOR.test(color)) {
|
|
23
|
+
process.stderr.write(`${red("✗")} --color must be #RRGGBB hex (got "${color}").\n`);
|
|
24
|
+
return 1;
|
|
25
|
+
}
|
|
26
|
+
const tags = parseTags(flagString(args, "tags"));
|
|
27
|
+
try {
|
|
28
|
+
const { container, created } = await createContainer(name, { color, tags });
|
|
29
|
+
const verb = created ? "created" : "already exists, no change to";
|
|
30
|
+
process.stdout.write(`${green("✓")} ${verb} ${bold(container.name)} ${dim(`(${container.id})`)}\n`);
|
|
31
|
+
return 0;
|
|
32
|
+
}
|
|
33
|
+
catch (err) {
|
|
34
|
+
process.stderr.write(`${red("✗")} ${err.message}\n`);
|
|
35
|
+
return 1;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
export async function runContainerRename(args) {
|
|
39
|
+
const [oldName, newName] = args.positional;
|
|
40
|
+
if (!oldName) {
|
|
41
|
+
process.stderr.write(`bp containers rename: name required.\nusage: bp containers rename <old> <new> [--color=#xxx] [--tags=a,b,c]\n`);
|
|
42
|
+
return 1;
|
|
43
|
+
}
|
|
44
|
+
const color = flagString(args, "color");
|
|
45
|
+
if (color && !HEX_COLOR.test(color)) {
|
|
46
|
+
process.stderr.write(`${red("✗")} --color must be #RRGGBB hex (got "${color}").\n`);
|
|
47
|
+
return 1;
|
|
48
|
+
}
|
|
49
|
+
const tags = parseTags(flagString(args, "tags"));
|
|
50
|
+
try {
|
|
51
|
+
const updated = await renameContainer(oldName, { newName, color, tags });
|
|
52
|
+
if (newName) {
|
|
53
|
+
process.stdout.write(`${green("✓")} ${bold(oldName)} → ${bold(updated.name)}\n`);
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
process.stdout.write(`${green("✓")} updated ${bold(updated.name)}\n`);
|
|
57
|
+
}
|
|
58
|
+
return 0;
|
|
59
|
+
}
|
|
60
|
+
catch (err) {
|
|
61
|
+
process.stderr.write(`${red("✗")} ${err.message}\n`);
|
|
62
|
+
return 1;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
export async function runContainerDelete(args) {
|
|
66
|
+
const name = args.positional[0];
|
|
67
|
+
if (!name) {
|
|
68
|
+
process.stderr.write(`bp containers delete: name required.\nusage: bp containers delete <name> [-y]\n`);
|
|
69
|
+
return 1;
|
|
70
|
+
}
|
|
71
|
+
const ctx = await getContext();
|
|
72
|
+
const wasContainer = ctx.cloudContainer;
|
|
73
|
+
let graphCount = 0;
|
|
74
|
+
let kbCount = 0;
|
|
75
|
+
try {
|
|
76
|
+
const probeCtx = { source: "cloud", cloudContainer: name };
|
|
77
|
+
const { setContext } = await import("../../ops/context.js");
|
|
78
|
+
await setContext(probeCtx);
|
|
79
|
+
try {
|
|
80
|
+
const graphs = await listGraphs();
|
|
81
|
+
graphCount = graphs.length;
|
|
82
|
+
const kbs = await listKB();
|
|
83
|
+
kbCount = kbs.length;
|
|
84
|
+
}
|
|
85
|
+
finally {
|
|
86
|
+
await setContext(ctx).catch(() => { });
|
|
87
|
+
void wasContainer;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
catch {
|
|
91
|
+
}
|
|
92
|
+
const stakes = graphCount + kbCount > 0
|
|
93
|
+
? ` ${yellow(`it has ${graphCount} graph${graphCount === 1 ? "" : "s"} and ${kbCount} KB doc${kbCount === 1 ? "" : "s"} — server will refuse unless you move them out first`)}\n`
|
|
94
|
+
: "";
|
|
95
|
+
process.stderr.write(stakes);
|
|
96
|
+
const ok = await confirm(`delete cloud container ${bold(name)}? [y/N] `, args);
|
|
97
|
+
if (!ok) {
|
|
98
|
+
process.stderr.write(dim("aborted.\n"));
|
|
99
|
+
return 0;
|
|
100
|
+
}
|
|
101
|
+
try {
|
|
102
|
+
await deleteContainer(name);
|
|
103
|
+
process.stdout.write(`${green("✓")} deleted container ${bold(name)}\n`);
|
|
104
|
+
return 0;
|
|
105
|
+
}
|
|
106
|
+
catch (err) {
|
|
107
|
+
process.stderr.write(`${red("✗")} ${err.message}\n`);
|
|
108
|
+
return 1;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
export async function runMoveGraph(args) {
|
|
112
|
+
const name = args.positional[0];
|
|
113
|
+
const to = flagString(args, "to", "t");
|
|
114
|
+
if (!name) {
|
|
115
|
+
process.stderr.write(`bp graphs move: graph name required.\nusage: bp graphs move <name> --to <container>\n`);
|
|
116
|
+
return 1;
|
|
117
|
+
}
|
|
118
|
+
if (!to) {
|
|
119
|
+
process.stderr.write(`bp graphs move: --to <container> required.\n`);
|
|
120
|
+
return 1;
|
|
121
|
+
}
|
|
122
|
+
let from;
|
|
123
|
+
try {
|
|
124
|
+
const ctx = await getContext();
|
|
125
|
+
const probeCtx = { source: "cloud", cloudContainer: undefined };
|
|
126
|
+
const { setContext } = await import("../../ops/context.js");
|
|
127
|
+
await setContext(probeCtx);
|
|
128
|
+
try {
|
|
129
|
+
const all = await listGraphs();
|
|
130
|
+
from = all.find((g) => g.name === name)?.sourceBackpack;
|
|
131
|
+
}
|
|
132
|
+
finally {
|
|
133
|
+
await setContext(ctx).catch(() => { });
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
catch { }
|
|
137
|
+
try {
|
|
138
|
+
await moveGraphToContainer(name, to);
|
|
139
|
+
const fromStr = from ? `${dim(from)} → ` : "";
|
|
140
|
+
process.stdout.write(`${green("✓")} moved ${bold(name)}: ${fromStr}${bold(to)}\n`);
|
|
141
|
+
return 0;
|
|
142
|
+
}
|
|
143
|
+
catch (err) {
|
|
144
|
+
process.stderr.write(`${red("✗")} ${err.message}\n`);
|
|
145
|
+
return 1;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
export async function runMoveKB(args) {
|
|
149
|
+
const id = args.positional[0];
|
|
150
|
+
const to = flagString(args, "to", "t");
|
|
151
|
+
if (!id) {
|
|
152
|
+
process.stderr.write(`bp kbs move: doc id required.\nusage: bp kbs move <id> --to <container>\n`);
|
|
153
|
+
return 1;
|
|
154
|
+
}
|
|
155
|
+
if (!to) {
|
|
156
|
+
process.stderr.write(`bp kbs move: --to <container> required.\n`);
|
|
157
|
+
return 1;
|
|
158
|
+
}
|
|
159
|
+
try {
|
|
160
|
+
await moveKBToContainer(id, to);
|
|
161
|
+
process.stdout.write(`${green("✓")} moved ${bold(id)} → ${bold(to)}\n`);
|
|
162
|
+
return 0;
|
|
163
|
+
}
|
|
164
|
+
catch (err) {
|
|
165
|
+
process.stderr.write(`${red("✗")} ${err.message}\n`);
|
|
166
|
+
return 1;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
//# sourceMappingURL=cloud-admin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cloud-admin.js","sourceRoot":"","sources":["../../../src/cli/commands/cloud-admin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,UAAU,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,eAAe,EAAE,oBAAoB,EAAE,iBAAiB,GAAG,MAAM,yBAAyB,CAAC;AACtI,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC7D,MAAM,SAAS,GAAG,mBAAmB,CAAC;AACtC,SAAS,SAAS,CAAC,GAAuB;IACtC,IAAI,GAAG,KAAK,SAAS;QACjB,OAAO,SAAS,CAAC;IACrB,MAAM,IAAI,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACjE,OAAO,IAAI,CAAC;AAChB,CAAC;AACD,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,IAAgB;IACrD,MAAM,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IAChC,IAAI,CAAC,I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