asljs-kb-cli
v0.1.2
Published
The kb command line over asljs-kb: read, search, write and organise a markdown library.
Maintainers
Readme
kb
Part of Alexandrite Software Library - a set of high-quality, performant JavaScript libraries and tools for everyday use.
Overview
Knowledge base tooling for a markdown library: file and folder operations, full
text search, formatting, and structured data extraction, available both as a CLI
and as an MCP server. The library in a browser is the kb-srv server of
asljs-kb-srv.
Markdown is the base file type. Other file types are supported for the operations that make sense for them; PDF files, for example, take part in text search and can be read through their text layer.
The operations themselves are functions of the kb library. This package
is the kb command, a client of the kb-mcp server of asljs-kb-mcp. An
application that wants the functions without a command line imports asljs-kb
instead.
Installation
npm install asljs-kb-cliFor CLI usage in a project or a notes folder:
npx kb --library ./notes listUsage
Create a note:
kb new notes/weekly-review --title "Weekly review" --tags team,weeklynotes/weekly-review.mdThe note starts with YAML front matter and a level 1 heading:
---
title: Weekly review
created: 2026-01-02T03:04:05.000Z
tags:
- team
- weekly
---
# Weekly reviewFind where a topic is discussed, across markdown and PDF alike:
kb search budgethandbook.pdf:1:11: Quarterly budget handbook
notes/weekly-review.md:9:5: The budget is approved.Pull the outline out of a document:
kb extract notes/weekly-review.md --type headings --format text# Weekly review (line 9)
## Decisions (line 13)Serve libraries to an MCP client over stdio with kb-mcp of
asljs-kb-mcp; each tool takes a project, the path of a library's
kb.json or of its folder:
{
"mcpServers": {
"kb": {
"command": "npx",
"args": ["kb-mcp"]
}
}
}Every command works inside one library root: --library <path>, else
KB_LIBRARY, else library of the nearest kb.json, else the current working
directory. A path that resolves outside of it is rejected.
Further reading
- Guide - how a command reaches the library, every command and option, rendering, moving with links, backlinks, the link index, and the MCP server.
- Requirements - what the CLI guarantees, as rq requirements.
Questions and bugs: asljs/issues.
Related packages
- kb - the knowledge base functions, as a library.
- asljs-kb-mcp - the
kb-mcpMCP server, and the client the CLI reaches it with. - asljs-kb-srv - the
kb-srvweb server.
License
MIT License. See LICENSE for details.
