knowbrain-cli 0.0.1-rc.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/README.md ADDED
@@ -0,0 +1,58 @@
1
+ # knowbrain-cli
2
+
3
+ Command-line tool **`kb`** for KnowBrain (spaces, stores, tasks, search, and related APIs). **Contributors:** conventions, logging, and layout are documented in [`AGENTS.md`](./AGENTS.md).
4
+
5
+ ## Install
6
+
7
+ **From npm** (Node 20+):
8
+
9
+ ```bash
10
+ npm install -g knowbrain-cli
11
+ ```
12
+
13
+ The `kb` executable is provided by the package `bin` field (`dist/kb.js`).
14
+
15
+ **From the monorepo (development):**
16
+
17
+ ```bash
18
+ pnpm --filter knowbrain-cli build
19
+ pnpm link --global -C apps/cli
20
+ ```
21
+
22
+ ## Configuration
23
+
24
+ - **`KB_BASE_URL`** — Service origin for auth and API routing (default `http://localhost:3000`). Override per invocation: `kb --base-url https://your-host space list`.
25
+ - **`KB_API_PATH_PREFIX`** — Path prefix for resource APIs under the origin (default `/api/knowbrain`). Set to an empty string to call the OMI server directly (for example `KB_BASE_URL=http://127.0.0.1:7654` with `KB_API_PATH_PREFIX=`).
26
+ - **`KB_SPACE`** / **`KB_TASK`** — Default space and task ids (same as `--space` / `--task`). `KB_SPACE` overrides the space id stored by `kb login`; when both are unset, scoped commands use the space id from login credentials.
27
+ - **`--log-level`** — Log verbosity to stderr only (`error`, `warn`, `info`, `debug`).
28
+
29
+ ## Sign in
30
+
31
+ ```bash
32
+ kb login # device authorization in the browser; stores ~/.config/kb/credentials.json
33
+ kb logout # remove stored credentials
34
+ ```
35
+
36
+ Run `kb login` before other commands when the API requires authentication. Progress and links are printed to **stderr**; successful login leaves **stdout** empty.
37
+
38
+ ## Release (maintainers)
39
+
40
+ Use the same **`v*`** git tags as the Docker release ([`release-docker.yml`](../../.github/workflows/release-docker.yml)), for example `v0.1.0` or `v0.1.0-rc0`. One tag triggers both GHCR and npm.
41
+
42
+ 1. Merge changes to `main`.
43
+ 2. `git tag v0.1.0 && git push origin v0.1.0` (pre-release tags containing `-` publish to npm `next`, e.g. `v0.1.0-rc0`).
44
+ 3. [`.github/workflows/release-npm.yml`](../../.github/workflows/release-npm.yml) builds the bundle and runs `npm publish` (requires `NPM_TOKEN` or npm Trusted Publishing).
45
+
46
+ The npm package intentionally omits `repository` / `homepage` metadata (private source repo).
47
+
48
+ Local smoke before tagging:
49
+
50
+ ```bash
51
+ pnpm --filter knowbrain-cli run build:release
52
+ cd apps/cli && npm pack && npm install -g ./knowbrain-cli-0.1.0.tgz
53
+ kb --help
54
+ ```
55
+
56
+ ## Optional: standalone binaries
57
+
58
+ For machines without Node, you can ship a single-file executable (e.g. `pkg`, `bun build --compile`) in CI and attach artifacts to GitHub Releases—one build per OS/architecture. That path is not wired in this repository by default.