exocortex-cli 0.1.0
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 +317 -0
- package/dist/index.js +277 -0
- package/package.json +67 -0
package/README.md
ADDED
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
# exocortex-cli
|
|
2
|
+
|
|
3
|
+
Command-line interface for Exocortex knowledge management system. Manage tasks, projects, and planning from the terminal without needing Obsidian.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install -g exocortex-cli
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Or use directly with npx:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npx exocortex-cli [command]
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
exocortex --help
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### SPARQL Query
|
|
24
|
+
|
|
25
|
+
Execute SPARQL queries against your Obsidian vault as an RDF knowledge graph.
|
|
26
|
+
|
|
27
|
+
**Documentation:**
|
|
28
|
+
- [SPARQL Guide](docs/SPARQL_GUIDE.md) - Complete query reference
|
|
29
|
+
- [SPARQL Cookbook](docs/SPARQL_COOKBOOK.md) - Real-world examples
|
|
30
|
+
- [Ontology Reference](docs/ONTOLOGY_REFERENCE.md) - Available predicates
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
exo query "SELECT ?s ?p ?o WHERE { ?s ?p ?o } LIMIT 10" --vault ~/vault
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
**Options:**
|
|
37
|
+
- `<query>` - SPARQL query string or path to .sparql file **[required]**
|
|
38
|
+
- `--vault <path>` - Path to Obsidian vault (default: current directory)
|
|
39
|
+
- `--format <type>` - Output format: `table` (default), `json`, `csv`
|
|
40
|
+
- `--explain` - Show optimized query plan (for debugging)
|
|
41
|
+
- `--stats` - Show execution statistics (load time, query time, results count)
|
|
42
|
+
- `--no-optimize` - Disable query optimization
|
|
43
|
+
|
|
44
|
+
**Examples:**
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
# Find all tasks
|
|
48
|
+
exo query \
|
|
49
|
+
"PREFIX exo: <https://exocortex.my/ontology/exo#>
|
|
50
|
+
PREFIX ems: <https://exocortex.my/ontology/ems#>
|
|
51
|
+
SELECT ?task ?label
|
|
52
|
+
WHERE {
|
|
53
|
+
?task exo:Instance_class ems:Task .
|
|
54
|
+
?task exo:Asset_label ?label .
|
|
55
|
+
}" \
|
|
56
|
+
--vault ~/vault
|
|
57
|
+
|
|
58
|
+
# Query from file
|
|
59
|
+
exo query queries/my-query.sparql --vault ~/vault
|
|
60
|
+
|
|
61
|
+
# JSON output for automation
|
|
62
|
+
exo query "SELECT ?s ?p ?o WHERE { ?s ?p ?o }" \
|
|
63
|
+
--vault ~/vault \
|
|
64
|
+
--format json > results.json
|
|
65
|
+
|
|
66
|
+
# Show query plan and stats
|
|
67
|
+
exo query "SELECT ?task WHERE { ?task exo:Instance_class ems:Task }" \
|
|
68
|
+
--vault ~/vault \
|
|
69
|
+
--explain \
|
|
70
|
+
--stats
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
**Sample Output (Table Format):**
|
|
74
|
+
|
|
75
|
+
```
|
|
76
|
+
📦 Loading vault: /Users/you/vault...
|
|
77
|
+
✅ Loaded 1,234 triples in 45ms
|
|
78
|
+
|
|
79
|
+
🔍 Parsing SPARQL query...
|
|
80
|
+
🔄 Translating to algebra...
|
|
81
|
+
🎯 Executing query...
|
|
82
|
+
✅ Found 5 result(s) in 12ms
|
|
83
|
+
|
|
84
|
+
┌────────────────────────────────────────────────────────────┐
|
|
85
|
+
│ ?label │ ?effort │
|
|
86
|
+
├────────────────────────────┼───────────────────────────────┤
|
|
87
|
+
│ "Implement SPARQL Engine" │ "240" │
|
|
88
|
+
│ "Write Documentation" │ "120" │
|
|
89
|
+
│ "Design Architecture" │ "180" │
|
|
90
|
+
└────────────────────────────────────────────────────────────┘
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Create Task
|
|
94
|
+
|
|
95
|
+
Create a new task from an area or project:
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
exocortex create task \
|
|
99
|
+
--source ~/vault/areas/work.md \
|
|
100
|
+
--label "Implement feature X" \
|
|
101
|
+
--size small \
|
|
102
|
+
--root ~/vault
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
**Options:**
|
|
106
|
+
- `-s, --source <path>` - Path to source file (area or project) **[required]**
|
|
107
|
+
- `-l, --label <label>` - Task label
|
|
108
|
+
- `--size <size>` - Task size (small, medium, large)
|
|
109
|
+
- `-r, --root <path>` - Root directory of vault (default: current directory)
|
|
110
|
+
|
|
111
|
+
**Example:**
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
cd ~/my-vault
|
|
115
|
+
exocortex create task -s areas/product.md -l "Design mockups" --size medium
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### Create Instance
|
|
119
|
+
|
|
120
|
+
Create an instance from a task or meeting prototype:
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
exocortex create instance \
|
|
124
|
+
--prototype ~/vault/prototypes/weekly-review.md \
|
|
125
|
+
--label "Weekly Review 2025-10-26" \
|
|
126
|
+
--root ~/vault
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
**Options:**
|
|
130
|
+
- `-p, --prototype <path>` - Path to prototype file **[required]**
|
|
131
|
+
- `-l, --label <label>` - Instance label
|
|
132
|
+
- `--size <size>` - Task size (for task instances)
|
|
133
|
+
- `-r, --root <path>` - Root directory of vault (default: current directory)
|
|
134
|
+
|
|
135
|
+
**Example:**
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
exocortex create instance -p prototypes/standup.md -l "Daily Standup"
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### Change Status
|
|
142
|
+
|
|
143
|
+
Move a task to ToDo status:
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
exocortex status todo \
|
|
147
|
+
--task ~/vault/tasks/abc-123.md \
|
|
148
|
+
--root ~/vault
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
**Options:**
|
|
152
|
+
- `-t, --task <path>` - Path to task file **[required]**
|
|
153
|
+
- `-r, --root <path>` - Root directory of vault (default: current directory)
|
|
154
|
+
|
|
155
|
+
**Example:**
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
exocortex status todo -t tasks/feature-implementation.md
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### Plan Task
|
|
162
|
+
|
|
163
|
+
Plan a task for today:
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
exocortex plan today \
|
|
167
|
+
--task ~/vault/tasks/abc-123.md \
|
|
168
|
+
--root ~/vault
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
**Options:**
|
|
172
|
+
- `-t, --task <path>` - Path to task file **[required]**
|
|
173
|
+
- `-r, --root <path>` - Root directory of vault (default: current directory)
|
|
174
|
+
|
|
175
|
+
**Example:**
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
exocortex plan today -t tasks/write-documentation.md
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
## Workflow Examples
|
|
182
|
+
|
|
183
|
+
### Morning Planning
|
|
184
|
+
|
|
185
|
+
```bash
|
|
186
|
+
# Plan high-priority tasks for today
|
|
187
|
+
exocortex plan today -t tasks/task1.md
|
|
188
|
+
exocortex plan today -t tasks/task2.md
|
|
189
|
+
exocortex plan today -t tasks/task3.md
|
|
190
|
+
|
|
191
|
+
# Move them to ToDo
|
|
192
|
+
exocortex status todo -t tasks/task1.md
|
|
193
|
+
exocortex status todo -t tasks/task2.md
|
|
194
|
+
exocortex status todo -t tasks/task3.md
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
### Creating Tasks from Project
|
|
198
|
+
|
|
199
|
+
```bash
|
|
200
|
+
# Create multiple tasks for a project
|
|
201
|
+
exocortex create task -s projects/website-redesign.md -l "Update homepage" --size small
|
|
202
|
+
exocortex create task -s projects/website-redesign.md -l "Redesign navigation" --size medium
|
|
203
|
+
exocortex create task -s projects/website-redesign.md -l "Test on mobile" --size small
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
### Weekly Review Workflow
|
|
207
|
+
|
|
208
|
+
```bash
|
|
209
|
+
# Create this week's review instance
|
|
210
|
+
exocortex create instance -p prototypes/weekly-review.md -l "Weekly Review $(date +%Y-%m-%d)"
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
## Architecture
|
|
214
|
+
|
|
215
|
+
The CLI uses `@exocortex/core` for business logic and implements a Node.js file system adapter:
|
|
216
|
+
|
|
217
|
+
```
|
|
218
|
+
exocortex-cli/
|
|
219
|
+
├── src/
|
|
220
|
+
│ ├── index.ts - Main CLI entry point
|
|
221
|
+
│ ├── adapters/
|
|
222
|
+
│ │ └── NodeFsAdapter.ts - Node.js file system implementation
|
|
223
|
+
│ └── commands/
|
|
224
|
+
│ ├── create-task.ts
|
|
225
|
+
│ ├── create-instance.ts
|
|
226
|
+
│ ├── status.ts
|
|
227
|
+
│ └── plan.ts
|
|
228
|
+
└── dist/ - Compiled output
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
## Features
|
|
232
|
+
|
|
233
|
+
- **SPARQL Query Engine** - Execute SPARQL 1.1 queries against vault as RDF knowledge graph
|
|
234
|
+
- BGP (Basic Graph Pattern) execution with variable bindings
|
|
235
|
+
- Query optimization (filter push-down, join reordering)
|
|
236
|
+
- Multiple output formats (table, JSON, CSV)
|
|
237
|
+
- Query plan visualization (--explain flag)
|
|
238
|
+
- Performance statistics (--stats flag)
|
|
239
|
+
- **File System Operations** - Read/write markdown files with frontmatter
|
|
240
|
+
- **Task Creation** - Generate tasks from areas, projects, and prototypes
|
|
241
|
+
- **Instance Creation** - Create instances from prototypes
|
|
242
|
+
- **Status Management** - Update task status through workflow
|
|
243
|
+
- **Planning** - Assign tasks to specific days
|
|
244
|
+
- **Frontmatter Support** - Full YAML frontmatter parsing and manipulation
|
|
245
|
+
- **Progress Indicators** - Spinners and colored output for better UX
|
|
246
|
+
|
|
247
|
+
## Development
|
|
248
|
+
|
|
249
|
+
```bash
|
|
250
|
+
# Install dependencies
|
|
251
|
+
npm install
|
|
252
|
+
|
|
253
|
+
# Build
|
|
254
|
+
npm run build
|
|
255
|
+
|
|
256
|
+
# Run locally
|
|
257
|
+
node dist/index.js --help
|
|
258
|
+
|
|
259
|
+
# Watch mode
|
|
260
|
+
npm run dev
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
## Requirements
|
|
264
|
+
|
|
265
|
+
- Node.js >= 18.0.0
|
|
266
|
+
- A vault with Exocortex-compatible markdown files
|
|
267
|
+
|
|
268
|
+
## Vault Structure
|
|
269
|
+
|
|
270
|
+
Your vault should follow Exocortex conventions:
|
|
271
|
+
|
|
272
|
+
```
|
|
273
|
+
vault/
|
|
274
|
+
├── areas/
|
|
275
|
+
│ ├── work.md
|
|
276
|
+
│ └── personal.md
|
|
277
|
+
├── projects/
|
|
278
|
+
│ └── website-redesign.md
|
|
279
|
+
├── tasks/
|
|
280
|
+
│ ├── abc-123.md
|
|
281
|
+
│ └── def-456.md
|
|
282
|
+
└── prototypes/
|
|
283
|
+
├── weekly-review.md
|
|
284
|
+
└── standup.md
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
Each file should have YAML frontmatter with Exocortex properties:
|
|
288
|
+
|
|
289
|
+
```yaml
|
|
290
|
+
---
|
|
291
|
+
exo__Asset_isDefinedBy: my-ontology
|
|
292
|
+
exo__Asset_uid: abc-123
|
|
293
|
+
exo__Instance_class:
|
|
294
|
+
- "[[ems__Task]]"
|
|
295
|
+
ems__Effort_status: "[[ems__EffortStatusDraft]]"
|
|
296
|
+
---
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
## Roadmap
|
|
300
|
+
|
|
301
|
+
### Planned Commands
|
|
302
|
+
|
|
303
|
+
- `exocortex status backlog` - Move to Backlog
|
|
304
|
+
- `exocortex status doing` - Start effort
|
|
305
|
+
- `exocortex status done` - Mark as done
|
|
306
|
+
- `exocortex status rollback` - Rollback status
|
|
307
|
+
- `exocortex plan date <date>` - Plan for specific date
|
|
308
|
+
- `exocortex plan shift forward` - Shift day forward
|
|
309
|
+
- `exocortex plan shift backward` - Shift day backward
|
|
310
|
+
- `exocortex create project` - Create project from area
|
|
311
|
+
- `exocortex query` - Query vault by metadata
|
|
312
|
+
- `exocortex list tasks` - List all tasks
|
|
313
|
+
- `exocortex list today` - List today's tasks
|
|
314
|
+
|
|
315
|
+
## License
|
|
316
|
+
|
|
317
|
+
MIT
|