How to Use in Command Line
How to Use in Command Line
IWE provides a powerful command-line interface for managing markdown-based knowledge graphs. The CLI enables you to initialize projects, normalize documents, explore connections, export visualizations, and create consolidated documents.
Quick Start
- Initialize a project:
iwe init - Create a new document:
iwe new "My Note" - Retrieve a document with context:
iwe retrieve -k my-note - Find and search documents:
iwe find "search term" - Normalize all documents:
iwe normalize - View document hierarchy:
iwe tree - Analyze your knowledge base:
iwe stats - Export graph visualization:
iwe export dot - Rename a document:
iwe rename old-key new-key - Delete a document:
iwe delete document-key - Extract a section:
iwe extract document --section "Title" - Inline a reference:
iwe inline document --reference "other-doc"
Installation & Setup
Before using the CLI, ensure IWE is installed and available in your PATH. Initialize any directory as an IWE project:
cd your-notes-directory
iwe initThis creates a .iwe/ directory with configuration files.
Global Usage
iwe [OPTIONS] <COMMAND>Global Options
-V,--version: Display version information-v,--verbose <LEVEL>: Set verbosity level (default: 0)1: Minimal output (INFO level messages to stderr)2or higher: Debug-level information to stderr
-h,--help: Show help information
Configuration
Commands respect settings in .iwe/config.toml:
[library]
path = "" # Subdirectory containing markdown files
[markdown]
normalize_headers = true
normalize_lists = trueCommand Categories
Document Management
| Command | Description | Documentation |
|---|---|---|
init | Initialize a new IWE project | IWE Init |
new | Create a new document | IWE New |
normalize | Normalize all documents | IWE Normalize |
Document Retrieval
| Command | Description | Documentation |
|---|---|---|
retrieve | Retrieve document with context | IWE Retrieve |
find | Search and discover documents | IWE Find |
tree | Display document hierarchy | IWE Tree |
Refactoring Operations
| Command | Description | Documentation |
|---|---|---|
rename | Rename a document and update references | IWE Rename |
delete | Delete a document and clean up references | IWE Delete |
extract | Extract a section to a new document | IWE Extract |
inline | Inline a referenced document | IWE Inline |
Analysis & Export
| Command | Description | Documentation |
|---|---|---|
stats | Analyze knowledge base statistics | IWE Stats |
export | Export graph visualization | IWE Export |
squash | Squash documents | IWE Squash |
Exit Codes
| Code | Meaning |
|---|---|
0 | Success - command completed without errors |
1 | Error - invalid arguments, missing files, operation failed |
All commands return exit code 0 on success. On error, commands print a message to stderr and return exit code 1.
# Check exit code
iwe find "nonexistent-query"
echo $? # Returns 0 (empty result is not an error)
iwe retrieve --key "missing-doc"
echo $? # Returns 1 (document not found is an error)