@hasna/knowledge 0.2.2 → 0.2.4
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 +86 -4
- package/bin/open-knowledge-mcp.js +14452 -0
- package/bin/open-knowledge.js +227 -4
- package/docs/architecture/ai-native-knowledge-base.md +191 -0
- package/docs/architecture/hybrid-semantic-search.md +135 -0
- package/package.json +20 -4
- package/src/artifact-store.ts +184 -0
- package/src/cli.ts +181 -25
- package/src/knowledge-db.ts +231 -0
- package/src/mcp.js +374 -415
- package/src/source-ref.ts +92 -0
- package/src/store.ts +16 -6
- package/src/wiki-layout.ts +104 -0
- package/src/workspace.ts +123 -0
- package/.github/ISSUE_TEMPLATE/bug_report.yml +0 -59
- package/.github/ISSUE_TEMPLATE/feature_request.yml +0 -34
- package/.github/PULL_REQUEST_TEMPLATE.md +0 -21
- package/.github/workflows/ci.yml +0 -49
- package/.takumi/settings.local.json +0 -7
- package/CODE_OF_CONDUCT.md +0 -31
- package/CONTRIBUTING.md +0 -83
- package/FUNDING.yml +0 -1
- package/SECURITY.md +0 -39
- package/npmignore +0 -9
- package/tests/cli.test.ts +0 -91
- package/tests/mcp-http.test.ts +0 -97
- package/tsconfig.json +0 -16
package/README.md
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
# open-knowledge
|
|
2
2
|
|
|
3
|
-
> Agent-friendly local knowledge CLI with JSON output,
|
|
3
|
+
> Agent-friendly local knowledge CLI/MCP with JSON output, project workspaces, durable artifacts, and safe destructive actions.
|
|
4
4
|
|
|
5
5
|
[](https://npm.im/@hasna/knowledge)
|
|
6
6
|
[](LICENSE)
|
|
7
7
|
[](.github/workflows/ci.yml)
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
`open-knowledge` is evolving from a flat note store into a local-first knowledge
|
|
10
|
+
engine for AI agents. It stores simple knowledge items today, creates a Hasna
|
|
11
|
+
project workspace under `.hasna/apps/knowledge`, initializes a versioned
|
|
12
|
+
`knowledge.db`, writes generated wiki artifacts, and exposes a stdio MCP server.
|
|
10
13
|
|
|
11
14
|
## Install
|
|
12
15
|
|
|
@@ -50,6 +53,15 @@ open-knowledge delete --id <id> --yes
|
|
|
50
53
|
|
|
51
54
|
# Export all notes as JSONL
|
|
52
55
|
open-knowledge export --format jsonl
|
|
56
|
+
|
|
57
|
+
# Show resolved workspace paths
|
|
58
|
+
open-knowledge paths --scope project --json
|
|
59
|
+
|
|
60
|
+
# Initialize the project SQLite catalog
|
|
61
|
+
open-knowledge db init --scope project
|
|
62
|
+
|
|
63
|
+
# Initialize scalable wiki/schema/index/log artifacts
|
|
64
|
+
open-knowledge wiki init --scope project
|
|
53
65
|
```
|
|
54
66
|
|
|
55
67
|
## Commands
|
|
@@ -94,6 +106,25 @@ Update an existing item.
|
|
|
94
106
|
| `--url <url>` | New source URL |
|
|
95
107
|
| `-t, --tag <tag>` | Add a tag |
|
|
96
108
|
|
|
109
|
+
### archive / restore
|
|
110
|
+
```bash
|
|
111
|
+
open-knowledge archive --id <id>
|
|
112
|
+
open-knowledge restore --id <id>
|
|
113
|
+
```
|
|
114
|
+
Archive hides an item from default `list` output without deleting it.
|
|
115
|
+
|
|
116
|
+
### upsert
|
|
117
|
+
```bash
|
|
118
|
+
open-knowledge upsert [title] [content] [--id <id>] [--title <title>] [--content <content>]
|
|
119
|
+
```
|
|
120
|
+
Create or update an item by ID.
|
|
121
|
+
|
|
122
|
+
### untag
|
|
123
|
+
```bash
|
|
124
|
+
open-knowledge untag --id <id> -t <tag>
|
|
125
|
+
```
|
|
126
|
+
Remove one tag from an item.
|
|
127
|
+
|
|
97
128
|
### delete
|
|
98
129
|
```bash
|
|
99
130
|
open-knowledge delete|rm --id <id> --yes
|
|
@@ -106,6 +137,29 @@ open-knowledge export [--format jsonl]
|
|
|
106
137
|
```
|
|
107
138
|
Export all items. Use `--format jsonl` for newline-delimited JSON.
|
|
108
139
|
|
|
140
|
+
### paths
|
|
141
|
+
```bash
|
|
142
|
+
open-knowledge paths [--scope global|project|local] [--json]
|
|
143
|
+
```
|
|
144
|
+
Show the resolved Hasna app workspace, JSON compatibility store, SQLite path,
|
|
145
|
+
artifact directories, and config.
|
|
146
|
+
|
|
147
|
+
### db
|
|
148
|
+
```bash
|
|
149
|
+
open-knowledge db init [--scope project]
|
|
150
|
+
open-knowledge db stats [--scope project]
|
|
151
|
+
```
|
|
152
|
+
Initialize or inspect the versioned SQLite catalog at
|
|
153
|
+
`.hasna/apps/knowledge/knowledge.db`.
|
|
154
|
+
|
|
155
|
+
### wiki
|
|
156
|
+
```bash
|
|
157
|
+
open-knowledge wiki init [--scope project]
|
|
158
|
+
```
|
|
159
|
+
Create starter generated-knowledge artifacts through the artifact store:
|
|
160
|
+
`schemas/v1.md`, `indexes/root.md`, `wiki/README.md`, and a dated JSONL log
|
|
161
|
+
partition.
|
|
162
|
+
|
|
109
163
|
### help
|
|
110
164
|
```bash
|
|
111
165
|
open-knowledge help [command]
|
|
@@ -117,14 +171,42 @@ open-knowledge help [command]
|
|
|
117
171
|
|------|-------------|
|
|
118
172
|
| `--json` | Output raw JSON |
|
|
119
173
|
| `--store <path>` | Override store path |
|
|
174
|
+
| `--scope global\|project\|local` | Select global Hasna app workspace or project workspace |
|
|
120
175
|
| `--version, -v` | Show version |
|
|
121
176
|
| `--help, -h` | Show help |
|
|
122
177
|
|
|
123
178
|
## Store Location
|
|
124
179
|
|
|
125
|
-
Default store: `~/.
|
|
180
|
+
Default global compatibility store: `~/.hasna/apps/knowledge/db.json`
|
|
181
|
+
|
|
182
|
+
Project workspace: `.hasna/apps/knowledge/`
|
|
183
|
+
|
|
184
|
+
The legacy `~/.open-knowledge/db.json` store is migrated into the new global
|
|
185
|
+
Hasna app path on first use if the new store does not exist. Override item-store
|
|
186
|
+
location with `--store <path>`.
|
|
187
|
+
|
|
188
|
+
## MCP Server
|
|
189
|
+
|
|
190
|
+
```bash
|
|
191
|
+
open-knowledge-mcp
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
The MCP server exposes item tools (`ok_add`, `ok_list`, `ok_get`, `ok_update`,
|
|
195
|
+
`ok_delete`, `ok_archive`, `ok_restore`, `ok_upsert`, `ok_untag`,
|
|
196
|
+
`ok_bulk_delete`, `ok_prune`, `ok_dedupe`, `ok_stats`, `ok_export`,
|
|
197
|
+
`ok_import`, `ok_batch`), workspace inspection (`ok_paths`), and source-ref
|
|
198
|
+
parsing (`ok_parse_source_ref`).
|
|
199
|
+
|
|
200
|
+
## Source And Artifact Boundary
|
|
201
|
+
|
|
202
|
+
Raw files should be stored and resolved through `open-files`. `open-knowledge`
|
|
203
|
+
stores source references such as `open-files://file/<id>`,
|
|
204
|
+
`open-files://file/<id>/revision/<revision_id>`, `s3://...`, `file://...`,
|
|
205
|
+
and `https://...`, plus citations, chunks, generated wiki pages, indexes,
|
|
206
|
+
logs, runs, and search metadata.
|
|
126
207
|
|
|
127
|
-
|
|
208
|
+
Generated knowledge artifacts can be stored locally under
|
|
209
|
+
`.hasna/apps/knowledge/artifacts` or through the S3 artifact-store adapter.
|
|
128
210
|
|
|
129
211
|
## JSON Output
|
|
130
212
|
|