@nzpr/kb 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 +79 -33
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,38 +1,74 @@
|
|
|
1
1
|
# Team Knowledge Base CLI
|
|
2
2
|
|
|
3
|
-
`@nzpr/kb` is
|
|
3
|
+
`@nzpr/kb` is a package for managing a knowledge base that agents can read from and that humans can keep curated.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
The core idea is simple:
|
|
6
6
|
|
|
7
|
-
-
|
|
8
|
-
-
|
|
7
|
+
- initialize a knowledge base
|
|
8
|
+
- propose knowledge
|
|
9
|
+
- publish approved knowledge
|
|
10
|
+
- search the current knowledge
|
|
11
|
+
- ask grounded questions against it
|
|
9
12
|
|
|
10
|
-
|
|
13
|
+
At the product level, a knowledge base is just a collection of documents, and each document should stay minimal:
|
|
11
14
|
|
|
12
|
-
|
|
15
|
+
- `title`
|
|
16
|
+
- `text`
|
|
13
17
|
|
|
14
|
-
|
|
15
|
-
- issue templates
|
|
16
|
-
- review and approval workflow
|
|
17
|
-
- CI that runs `kb publish`
|
|
18
|
+
Everything else is implementation detail.
|
|
18
19
|
|
|
19
|
-
|
|
20
|
+
## Public API
|
|
21
|
+
|
|
22
|
+
The public surface of `@nzpr/kb` is the `kb` CLI.
|
|
23
|
+
|
|
24
|
+
- `kb init-repo`
|
|
25
|
+
Initialize a knowledge base workspace.
|
|
26
|
+
|
|
27
|
+
- `kb create --title TEXT --text TEXT`
|
|
28
|
+
Propose a new knowledge document or a substantial update.
|
|
29
|
+
|
|
30
|
+
- `kb publish`
|
|
31
|
+
Make the current approved documents become the live knowledge base.
|
|
32
|
+
|
|
33
|
+
- `kb search "<query>"`
|
|
34
|
+
Return the closest matching knowledge documents.
|
|
35
|
+
|
|
36
|
+
- `kb ask "<question>"`
|
|
37
|
+
Return a grounded answer from the closest matching knowledge.
|
|
38
|
+
|
|
39
|
+
- `kb list`
|
|
40
|
+
List the current knowledge documents.
|
|
41
|
+
|
|
42
|
+
- `kb catalog`
|
|
43
|
+
Return the current knowledge inventory in a machine-friendly form.
|
|
44
|
+
|
|
45
|
+
- `kb doctor`
|
|
46
|
+
Check whether the knowledge base is healthy and queryable.
|
|
47
|
+
|
|
48
|
+
## Lifecycle
|
|
49
|
+
|
|
50
|
+
The intended workflow is:
|
|
51
|
+
|
|
52
|
+
1. Initialize a knowledge base.
|
|
53
|
+
2. Propose knowledge.
|
|
54
|
+
3. Review and approve knowledge.
|
|
55
|
+
4. Publish knowledge.
|
|
56
|
+
5. Query knowledge.
|
|
57
|
+
|
|
58
|
+
## Install
|
|
59
|
+
|
|
60
|
+
From npm:
|
|
20
61
|
|
|
21
62
|
```bash
|
|
22
|
-
|
|
63
|
+
npm install -g @nzpr/kb
|
|
64
|
+
kb --help
|
|
23
65
|
```
|
|
24
66
|
|
|
25
|
-
|
|
67
|
+
From source:
|
|
26
68
|
|
|
27
69
|
```bash
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
--dir /path/to/knowledge-repo \
|
|
31
|
-
--repo owner/knowledge-repo \
|
|
32
|
-
--database-url postgresql://kb:kb@host:5432/kb \
|
|
33
|
-
--embedding-mode bge-m3-openai \
|
|
34
|
-
--embedding-api-url https://embeddings.example.com/v1/embeddings \
|
|
35
|
-
--embedding-model BAAI/bge-m3
|
|
70
|
+
npm install
|
|
71
|
+
npm link
|
|
36
72
|
```
|
|
37
73
|
|
|
38
74
|
## Commands
|
|
@@ -45,25 +81,34 @@ kb init-repo \
|
|
|
45
81
|
- `kb create --title TEXT --text TEXT [--path RELATIVE_PATH]`
|
|
46
82
|
- `kb publish --docs-root PATH`
|
|
47
83
|
|
|
48
|
-
##
|
|
84
|
+
## Knowledge Repo Workflow
|
|
49
85
|
|
|
50
|
-
|
|
86
|
+
In practice, the live knowledge usually lives in a separate repository that owns:
|
|
87
|
+
|
|
88
|
+
- `kb/docs/`
|
|
89
|
+
- the review flow for proposed knowledge
|
|
90
|
+
- the publish automation
|
|
91
|
+
|
|
92
|
+
Bootstrap that repo with:
|
|
51
93
|
|
|
52
94
|
```bash
|
|
53
|
-
|
|
54
|
-
kb --help
|
|
95
|
+
kb init-repo --dir /path/to/knowledge-repo
|
|
55
96
|
```
|
|
56
97
|
|
|
57
|
-
|
|
98
|
+
Or bootstrap and configure it in one step:
|
|
58
99
|
|
|
59
100
|
```bash
|
|
60
|
-
|
|
61
|
-
|
|
101
|
+
export GITHUB_TOKEN=...
|
|
102
|
+
kb init-repo \
|
|
103
|
+
--dir /path/to/knowledge-repo \
|
|
104
|
+
--repo owner/knowledge-repo \
|
|
105
|
+
--database-url postgresql://kb:kb@host:5432/kb \
|
|
106
|
+
--embedding-mode bge-m3-openai \
|
|
107
|
+
--embedding-api-url https://embeddings.example.com/v1/embeddings \
|
|
108
|
+
--embedding-model BAAI/bge-m3
|
|
62
109
|
```
|
|
63
110
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
In the separate knowledge-authority repo:
|
|
111
|
+
Inside that knowledge repo, the normal flow is:
|
|
67
112
|
|
|
68
113
|
1. Run `kb init-repo` once to scaffold the repo. If you provide `--repo`, `--database-url`, and `GITHUB_TOKEN`, it also configures the target repo and preflights the database.
|
|
69
114
|
2. Open or update a knowledge proposal issue.
|
|
@@ -89,7 +134,7 @@ Query commands need:
|
|
|
89
134
|
export KB_DATABASE_URL=postgresql://kb:kb@localhost:5432/kb
|
|
90
135
|
```
|
|
91
136
|
|
|
92
|
-
Higher-quality
|
|
137
|
+
Higher-quality retrieval can use a self-hosted embeddings service:
|
|
93
138
|
|
|
94
139
|
```bash
|
|
95
140
|
export KB_EMBEDDING_MODE=bge-m3-openai
|
|
@@ -150,7 +195,8 @@ The package is published as `@nzpr/kb`.
|
|
|
150
195
|
- local validation: `npm test`
|
|
151
196
|
- local package preview: `npm pack --dry-run`
|
|
152
197
|
- GitHub Actions publish: push a tag like `v0.1.0` or run the `npm-publish` workflow manually
|
|
153
|
-
-
|
|
198
|
+
- npm authentication: use npm trusted publishing with GitHub Actions OIDC, not a long-lived publish token
|
|
199
|
+
- required npm setup: in npm package settings, configure trusted publishing for `nzpr/kb` and workflow file `.github/workflows/npm-publish.yml`
|
|
154
200
|
|
|
155
201
|
## Using From A Knowledge Repo
|
|
156
202
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nzpr/kb",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "Knowledge base CLI for proposing, publishing, and querying curated agent knowledge.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+https://github.com/nzpr/kb.git"
|