librian 0.1.0 → 0.1.2

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.
Files changed (4) hide show
  1. package/CHANGELOG.md +47 -1
  2. package/README.md +35 -10
  3. package/dist/cli.js +429 -271
  4. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -4,6 +4,52 @@ All notable changes to this project will be documented in this file.
4
4
 
5
5
  ---
6
6
 
7
+ ## [0.1.2] - 2026-11-08
8
+
9
+ ### Changed
10
+
11
+ - **Search ranks by BM25 instead of hit count.** After the headings rule, blocks
12
+ are ordered by a BM25 score (no IDF), so a short, exact block is no longer
13
+ pushed down by a long block that repeats the words many times. The `N hits`
14
+ on a result row is unchanged.
15
+ - **Generic examples.** The README, the `list` tool description and the usage
16
+ text use neutral example names (`guide/api`, `team`). Behaviour is unchanged.
17
+
18
+ ## [0.1.1] - 2026-11-08
19
+
20
+ ### Added
21
+
22
+ - **`librian add [<folder>]`.** Adds a docs folder without opening the menu:
23
+ run it inside the docs folder, or pass the path. It counts the markdown
24
+ files, asks `Add it as "team_docs"? (Y/n)` and adds the entry. It refuses
25
+ your home folder and a drive root (exit code 2), says `Already added as …`
26
+ (exit code 0) for a folder that is already there, and adds nothing when the
27
+ input ends.
28
+ - **The folder question starts with the current folder.** Start `librian`
29
+ inside a docs folder and Enter is enough to add it. In your home folder or a
30
+ drive root the question starts empty.
31
+
32
+ ### Changed
33
+
34
+ - **Add asks for the folder only.** The Add form with its Name, Exclude and
35
+ Max bytes rows is gone: the folder is checked (a missing folder is explained
36
+ and asked again; a folder already added takes you to its entry; a folder
37
+ without markdown files defaults to No), then one question adds it with the
38
+ default name. Name, Exclude and Max bytes are changed with **Edit** on the
39
+ entry, which still opens the form.
40
+ - **Counting files is bounded.** Add, `librian add`, Check and the file counts
41
+ in the main menu stop at 5,000 files or after 2 seconds and show
42
+ `5000+ files`, so choosing a huge folder does not hang.
43
+ - **The menu's AI services screen is now called Register.** Its rows and
44
+ actions are the same: switch Claude Code or Codex on or off, then Apply.
45
+
46
+ ### Removed
47
+
48
+ - **Runtime → Use a local checkout.** It was for running an unpublished build.
49
+ Install a built checkout with
50
+ `npm install --prefix ~/.librian/runtime <path>` instead; the menu still
51
+ shows it as `linked to <path>` and **Install from npm** switches back.
52
+
7
53
  ## [0.1.0] - 2026-11-08
8
54
 
9
55
  First release.
@@ -35,5 +81,5 @@ First release.
35
81
  `~/.librian/catalog.json`; `LIBRIAN_HOME` moves both.
36
82
  - **One server for all folders.** `librian serve --catalog` is what the AI
37
83
  services run: it offers the four tools for each entry, prefixed with the
38
- entry name (`akms__read`). `librian serve --root <folder>` serves a single
84
+ entry name (`team__read`). `librian serve --root <folder>` serves a single
39
85
  folder with unprefixed tools, for registering by hand.
package/README.md CHANGED
@@ -22,11 +22,11 @@ npx -y librian@latest # or: npm i -g librian, then run `librian`
22
22
  This opens the librian menu. Then:
23
23
 
24
24
  1. **Runtime → Install**: installs librian into `~/.librian/runtime`.
25
- 2. **Add docs folder**: give it a name and the path of a docs folder (see below). Repeat for more folders.
26
- 3. **AI services**: switch on Claude Code and/or Codex, then **Apply**. librian shows the commands it will run and asks before running them.
25
+ 2. **Add docs folder**: type the path of a docs folder. If you started `librian` inside it, the question is already filled in with the current folder, so Enter is enough. Repeat for more folders. Or skip the menu: run `librian add` inside the docs folder (see below).
26
+ 3. **Register**: switch on Claude Code and/or Codex, then **Apply**. librian shows the commands it will run and asks before running them.
27
27
  4. Open a new session in Claude Code or Codex. Sessions that are already open keep what they started with.
28
28
 
29
- To update, open `librian` → **Runtime → Check for updates**. To undo a registration, switch the service off in **AI services** and **Apply**.
29
+ To update, open `librian` → **Runtime → Check for updates**. To undo a registration, switch the service off in **Register** and **Apply**.
30
30
 
31
31
  ## The menu
32
32
 
@@ -37,20 +37,43 @@ Run `librian` in a terminal. Without a terminal (a pipe or a script) it prints t
37
37
  The main screen lists your docs folders; each one is an entry with a name and a path, like a connection in a database tool.
38
38
  Choose an entry to **Edit**, **Check** (file count, total size, largest files) or **Remove** it. Removing an entry never touches the folder itself.
39
39
 
40
+ **Add docs folder** asks for one thing, the folder, and then adds it:
41
+
42
+ ```
43
+ ? Docs folder › D:\workspace\projects\team\team.docs
44
+ 107 markdown files · 4.1M
45
+ ? Add it as "team_docs"? (Y/n)
46
+ ✔ Added team_docs. Open a new session to use team_docs__read and the other tools.
47
+ ```
48
+
49
+ A folder that does not exist is refused with the reason and asked again with what you typed. A folder that is already added says `Already added as "team".` and takes you to that entry. A folder without markdown files gets a warning and the question defaults to No. Esc saves nothing. The entry gets the default name, no Exclude and the default Max bytes; change them with **Edit** on the entry.
50
+ Counting stops at 5,000 files or after 2 seconds and shows `5000+ files`, so picking a huge folder by mistake does not hang the menu.
51
+
40
52
  An entry has:
41
53
 
42
54
  | Field | Meaning |
43
55
  | --- | --- |
44
- | Name | 1 to 24 characters: a lowercase letter, then lowercase letters, digits or `_`. Defaults to the folder name (`akms.docs` becomes `akms_docs`). It prefixes the tool names. |
56
+ | Name | 1 to 24 characters: a lowercase letter, then lowercase letters, digits or `_`. Defaults to the folder name (`team.docs` becomes `team_docs`). It prefixes the tool names. |
45
57
  | Docs folder | Absolute path of the folder that holds the markdown files. |
46
- | Exclude | Folder names (`evidence`) or root-relative paths (`ks/archive`) to skip. Folders starting with `.` and `node_modules` are always skipped. |
58
+ | Exclude | Folder names (`evidence`) or root-relative paths (`guide/archive`) to skip. Folders starting with `.` and `node_modules` are always skipped. |
47
59
  | Max bytes | Response size limit in UTF-8 bytes. Default 16000, minimum 4000. |
48
60
 
49
61
  Symbolic links and junctions are not followed. librian only reads your docs; it never writes to them.
50
62
 
51
63
  Adding, editing or removing an entry takes effect in new sessions only.
52
64
 
53
- ### AI services
65
+ #### `librian add`
66
+
67
+ ```
68
+ cd path/to/your/docs
69
+ librian add # adds the current folder
70
+ librian add path/to/docs # or a folder you name
71
+ ```
72
+
73
+ The same flow without the menu: it prints the file count, asks `Add it as "…"? (Y/n)` and adds the entry. Without a terminal it reads the answer from a line of input, and if the input ends it adds nothing and exits 0.
74
+ It refuses your home folder and a drive root (exit code 2): run it inside the docs folder or pass the path. A folder that is already added exits 0. When no AI service is registered yet, the last line points you to **Register**.
75
+
76
+ ### Register
54
77
 
55
78
  Registers librian as one MCP server named `librian` in **Claude Code** and **Codex**, for all your projects (user scope).
56
79
  It runs `claude mcp add --scope user …` and `codex mcp add …` for you, and `… mcp remove …` to unregister.
@@ -77,12 +100,12 @@ Set `LIBRIAN_HOME` to use another folder. When it is not the default, the regist
77
100
 
78
101
  ## What the AI sees
79
102
 
80
- One server, four tools per docs folder, prefixed with the entry name: for an entry `akms` the tools are `akms__list`, `akms__outline`, `akms__read` and `akms__search`.
103
+ One server, four tools per docs folder, prefixed with the entry name: for an entry `team` the tools are `team__list`, `team__outline`, `team__read` and `team__search`.
81
104
  Each tool description names its folder, and the server instructions list the folders with their file counts. A folder that is missing on disk offers no tools and is marked `unavailable`.
82
105
 
83
106
  | Tool | Input | Returns |
84
107
  | --- | --- | --- |
85
- | `list` | `prefix?` | Files with size and document title, grouped by folder. `prefix` is a root-relative path start: `ks/ci` matches `ks/ci/…` and `ks/ci-notes.md`, `ks/ci/` matches the folder only. |
108
+ | `list` | `prefix?` | Files with size and document title, grouped by folder. `prefix` is a root-relative path start: `guide/api` matches `guide/api/…` and `guide/api-notes.md`, `guide/api/` matches the folder only. |
86
109
  | `outline` | `ref` | Headings of a file or of one section, each with its line range and size. |
87
110
  | `read` | `ref` | The text of a whole file, one section or a line range. |
88
111
  | `search` | `query`, `prefix?`, `limit?`, `offset?` | Blocks that contain every word of the query, each with its `path:start-end`, ancestor headings, size, number of hits and a one-line excerpt. |
@@ -108,7 +131,7 @@ When you pass a reference to another agent or write it into a document, prefer `
108
131
  - Words are separated by spaces; wrap a phrase in double quotes to keep it as one word. Matching ignores case.
109
132
  - A word made only of letters, digits and `_` matches at the start of a word (`uat` matches `UAT` and `uat_token`, not `evaluate`). Other words, such as Korean, match anywhere.
110
133
  - Every word must appear in the same block, a heading plus the text up to the next heading. Ancestor headings count, so a block under `## Release rail` matches `release deploy` even if only `deploy` is in its text.
111
- - Results are ordered by words found in headings, then hits, then path and line.
134
+ - Results are ordered by words found in headings, then a relevance score that favours short, focused blocks over long ones that merely repeat a word (BM25), then path and line. The `N hits` on a row is the plain match count.
112
135
 
113
136
  ### Limits and continuing
114
137
 
@@ -148,7 +171,9 @@ librian --help | --version
148
171
 
149
172
  ## Contributing
150
173
 
151
- To run a checkout of this repository instead of the published package, build it (`npm run build`) and use **Runtime → Use a local checkout** in the menu.
174
+ See [README_DEV.md](README_DEV.md) for the build, the tests and the design.
175
+
176
+ To run a checkout of this repository instead of the published package, build it (`npm run build`) and install it into the runtime: `npm install --prefix ~/.librian/runtime <path to the checkout>`. The menu then shows the runtime as `linked to <path>`, and **Runtime → Install from npm** switches back.
152
177
 
153
178
  ## License
154
179