@life-os/cli 0.0.1 → 0.1.1
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 +119 -7
- package/dist/lifeos.mjs +6624 -0
- package/package.json +18 -12
- package/skill/SKILL.md +224 -0
- package/skill/references/commands.md +178 -0
- package/bin/life-os.js +0 -11
package/package.json
CHANGED
|
@@ -1,23 +1,29 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@life-os/cli",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
5
|
-
"
|
|
6
|
-
"type": "commonjs",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "Headless, config-aware CLI for reading and querying a LifeOS vault — built for AI agents",
|
|
5
|
+
"type": "module",
|
|
7
6
|
"bin": {
|
|
8
|
-
"lifeos": "
|
|
7
|
+
"lifeos": "dist/lifeos.mjs"
|
|
9
8
|
},
|
|
10
9
|
"files": [
|
|
11
|
-
"
|
|
10
|
+
"dist/lifeos.mjs",
|
|
11
|
+
"skill",
|
|
12
12
|
"README.md"
|
|
13
13
|
],
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"registry": "https://registry.npmjs.org/"
|
|
14
|
+
"engines": {
|
|
15
|
+
"node": ">=18"
|
|
17
16
|
},
|
|
18
17
|
"keywords": [
|
|
19
|
-
"
|
|
18
|
+
"lifeos",
|
|
19
|
+
"obsidian",
|
|
20
20
|
"cli",
|
|
21
|
-
"
|
|
22
|
-
|
|
21
|
+
"agent",
|
|
22
|
+
"para",
|
|
23
|
+
"vault"
|
|
24
|
+
],
|
|
25
|
+
"license": "MIT",
|
|
26
|
+
"publishConfig": {
|
|
27
|
+
"access": "public"
|
|
28
|
+
}
|
|
23
29
|
}
|
package/skill/SKILL.md
ADDED
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: lifeos
|
|
3
|
+
description: "Read, query and edit a LifeOS / Obsidian PARA vault (notes, tasks, periodic notes, theme notes, tags) from the command line via the `lifeos` CLI — headless, no Obsidian or Aino needed. Use when the user asks about their tasks or 待办; periodic notes — daily/weekly/monthly/quarterly/yearly review or 日记/周记/月记/季记/年记; theme notes / PARA — projects/areas/resources/archives or 项目/领域/资源/归档/主题; tags / theme tags or 标签/主题标签; wants to find/search notes, capture a thought, or check/update what's on their plate in their LifeOS vault."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# LifeOS
|
|
7
|
+
|
|
8
|
+
Drive a LifeOS vault through the `lifeos` CLI. It is **config-aware** — it reads
|
|
9
|
+
the user's real PARA folder names, periodic-note formats and section headers from
|
|
10
|
+
their own plugin / Aino settings — and **headless**, working directly on the vault
|
|
11
|
+
folder without Obsidian running. Query results match what the user sees in the app.
|
|
12
|
+
|
|
13
|
+
## Core concepts (核心概念)
|
|
14
|
+
|
|
15
|
+
LifeOS organises a vault as two complementary kinds of note. Knowing which one a
|
|
16
|
+
request is about tells you which command to reach for.
|
|
17
|
+
|
|
18
|
+
**Periodic notes (周期笔记)** — organised by **time**. One file per period; resolve
|
|
19
|
+
its path with `npx -y @life-os/cli <period>`. The longer the period the less predictable it is,
|
|
20
|
+
so longer periods are for goals and shorter ones for tasks:
|
|
21
|
+
|
|
22
|
+
- **yearly (年记)** / **quarterly (季记)** — long-term: **goal management (目标管理)**,
|
|
23
|
+
set the direction for the year / quarter.
|
|
24
|
+
- **monthly (月记)** / **weekly (周记)** — short-term: **task management (任务管理)**,
|
|
25
|
+
break those goals into this month's / week's tasks.
|
|
26
|
+
- **daily (日记)** — daily records: real-time capture of thoughts, tasks and time
|
|
27
|
+
tracking. Most capture lands here.
|
|
28
|
+
|
|
29
|
+
**Theme notes (主题笔记)** — organised by **subject**, usually via **PARA**. These live
|
|
30
|
+
in the user's PARA folders (see `npx -y @life-os/cli config`); reach them with `search`/`read`.
|
|
31
|
+
The later→earlier order is increasing actionability (archive → resource → area → project):
|
|
32
|
+
|
|
33
|
+
- **project (项目)** — most actionable: a concrete goal with a deadline, e.g. 「完成季度报告」.
|
|
34
|
+
- **area (领域)** — an ongoing responsibility to maintain, e.g. 「健康」「财务」.
|
|
35
|
+
- **resource (资源)** — a topic of interest or reference material, e.g. 「读书笔记」.
|
|
36
|
+
- **archive (归档)** — finished or inactive projects / areas / resources.
|
|
37
|
+
- PARA is just the common shape; a theme can be any subject (e.g. 「#节日」).
|
|
38
|
+
|
|
39
|
+
**The link between them — theme tags (主题标签)**: each theme note is identified by a
|
|
40
|
+
unique tag. Any task / fleeting note / file anywhere — including inside a daily or
|
|
41
|
+
other periodic note — that carries that tag is **automatically indexed** into the
|
|
42
|
+
theme note. This is what makes capture stress-free: jot with the right `#tag` now,
|
|
43
|
+
find it under the theme later.
|
|
44
|
+
|
|
45
|
+
- **Top-down (自上而下)**: tasks planned in a theme note surface in the daily note on
|
|
46
|
+
their planned date, so `tasks due=today` reflects project/goal plans.
|
|
47
|
+
- **Bottom-up (自下而上)**: a tagged thought or todo in the daily note is collected
|
|
48
|
+
back into the matching theme note via its tag.
|
|
49
|
+
|
|
50
|
+
So: when a user talks about a 项目/领域/资源/主题, work in the theme note; when they
|
|
51
|
+
talk about a day/week/month/quarter/year or "what's on my plate today", work in the
|
|
52
|
+
periodic note — and reuse the theme's tag so the two stay linked.
|
|
53
|
+
|
|
54
|
+
## Invocation
|
|
55
|
+
|
|
56
|
+
Run the CLI with **`npx -y @life-os/cli`** — npx fetches the published package on
|
|
57
|
+
first use and `-y` skips the install prompt; nothing needs to be installed
|
|
58
|
+
globally. Every example below is written in that form.
|
|
59
|
+
|
|
60
|
+
## First moves
|
|
61
|
+
|
|
62
|
+
1. Run `npx -y @life-os/cli config` to confirm which vault and settings are in
|
|
63
|
+
effect. If it can't find a vault, ask the user for the path and pass
|
|
64
|
+
`vault=<path>`.
|
|
65
|
+
2. `npx -y @life-os/cli help` is the authoritative command list. For exhaustive
|
|
66
|
+
flags, output shapes and error codes, read
|
|
67
|
+
[`references/commands.md`](references/commands.md).
|
|
68
|
+
|
|
69
|
+
## Syntax
|
|
70
|
+
|
|
71
|
+
- Options are `key=value` (e.g. `tag=work`, `limit=10`). `--key=value` also works.
|
|
72
|
+
- Flags are bare words after `--` (e.g. `--json`) or plain (`overwrite`, `case`).
|
|
73
|
+
- Quote values with spaces: `vault="~/My Vault/LifeOS"`.
|
|
74
|
+
- Add `--json` whenever you need to parse output programmatically.
|
|
75
|
+
|
|
76
|
+
## Vault selection
|
|
77
|
+
|
|
78
|
+
This skill is installed **inside the user's vault**, so you normally run from
|
|
79
|
+
within it — the CLI auto-detects the vault from the current directory. Resolution
|
|
80
|
+
order (first match wins): `vault=` → `$LIFEOS_VAULT` → walk up from cwd for
|
|
81
|
+
`.obsidian/`/`.lifeos/` → the folder Aino last opened (fallback). Only pass
|
|
82
|
+
`vault=` when the user means a _different_ vault than the one you're in.
|
|
83
|
+
|
|
84
|
+
## Commands at a glance
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
# every command is invoked as: npx -y @life-os/cli <args>
|
|
88
|
+
npx -y @life-os/cli config # vault + effective settings (run this first)
|
|
89
|
+
npx -y @life-os/cli tasks [todo|done|all] # tasks; filters: tag= keyword= due=today|week|overdue limit=
|
|
90
|
+
npx -y @life-os/cli search query=<text> # type=file (default) | tag | content ; add `case` for content
|
|
91
|
+
npx -y @life-os/cli read file=<name>|path=<p> # print a note
|
|
92
|
+
npx -y @life-os/cli daily|weekly|monthly|quarterly|yearly # show the period note's path + whether it exists
|
|
93
|
+
npx -y @life-os/cli <period>:read # print the period note
|
|
94
|
+
npx -y @life-os/cli <period>:create # create the period note from its configured template
|
|
95
|
+
npx -y @life-os/cli <period>:append content=<t> # append (creates from template if missing)
|
|
96
|
+
npx -y @life-os/cli theme:create type=project|area|resource|archive|theme tag=<t> path=<p> # create a PARA note from its template
|
|
97
|
+
npx -y @life-os/cli append path=<p> content=<t> # append to an existing note
|
|
98
|
+
npx -y @life-os/cli create path=<p> [content=] # create a plain note (no template; add `overwrite` to replace)
|
|
99
|
+
npx -y @life-os/cli task done|todo ref=<file>:<n> # toggle a task by its file:line reference
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
**Template-aware creation:** `<period>:create`, `theme:create`, and the auto-create
|
|
103
|
+
inside `<period>:append` all render the user's **configured template** through the
|
|
104
|
+
same engine the plugin/Aino use — `{{snapshot:Project}}`, `{{if weekday}}`,
|
|
105
|
+
`{{date}}` etc. are expanded, and theme notes get their tag injected into
|
|
106
|
+
frontmatter. Plain `create path=…` stays template-free (use it for arbitrary notes).
|
|
107
|
+
|
|
108
|
+
## Recipes (chain commands like this)
|
|
109
|
+
|
|
110
|
+
**Morning review** — what's on my plate, then capture the plan:
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
npx -y @life-os/cli tasks due=today --json # today's open tasks
|
|
114
|
+
npx -y @life-os/cli tasks due=overdue --json # anything slipping
|
|
115
|
+
npx -y @life-os/cli daily:append section="日常记录" content="- 08:30 #计划 今天先做 ..."
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
**Quick capture** — "记一下:想法X" (drop a timestamped line into today's record section):
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
npx -y @life-os/cli daily:append section="日常记录" content="- 14:30 #摘抄 想法X" # echoes the resolved path
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
**Find then act** — never write blind:
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
npx -y @life-os/cli tasks keyword="季度报告" # locate the task, note its file:line
|
|
128
|
+
npx -y @life-os/cli task done ref="0. 周期笔记/2025/Daily/05/2025-05-30.md:14"
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
**Research a topic across the vault**:
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
npx -y @life-os/cli search query="超线性回报" type=content limit=20 # path:line + matching text
|
|
135
|
+
npx -y @life-os/cli read path="-1. 捕获/....md" # open the most relevant hit
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
**Weekly review**:
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
npx -y @life-os/cli weekly # confirm this week's note path / existence
|
|
142
|
+
npx -y @life-os/cli tasks done due=week # what got done
|
|
143
|
+
npx -y @life-os/cli weekly:append content="## 复盘\n..."
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## Journaling (日记)
|
|
147
|
+
|
|
148
|
+
The daily note is where most capture lands. Do it precisely:
|
|
149
|
+
|
|
150
|
+
1. **Locate** — `npx -y @life-os/cli daily` shows today's path and `Exists`. Pass
|
|
151
|
+
`date=YYYY-MM-DD` for another day, `locale=` for weekday/month names.
|
|
152
|
+
2. **Insert in the right place** — append into the record section with
|
|
153
|
+
`section=<header>`, not the file tail. The header is the daily note's main
|
|
154
|
+
record heading (commonly `日常记录` / `Daily Record`); confirm it by reading a
|
|
155
|
+
recent daily note. `section=` lands the line at the **end of that section**
|
|
156
|
+
(e.g. before `习惯打卡` / `Habit`) and creates the section only if absent.
|
|
157
|
+
3. **Format** — default to `- HH:mm #tag 内容`. Use the current time from the
|
|
158
|
+
environment; the user is usually in their local timezone. Reuse existing tags —
|
|
159
|
+
`npx -y @life-os/cli search type=tag keyword=<x>` — rather than inventing
|
|
160
|
+
fine-grained ones; 1–3 tags unless the entry needs more.
|
|
161
|
+
4. **Polish, don't transcribe** — lightly smooth the user's words while keeping
|
|
162
|
+
their facts, stance, emotion and first-person voice; add no judgments, advice
|
|
163
|
+
or conclusions they didn't make. When they say `原文`/`逐字`/`原样`/`摘抄`/verbatim,
|
|
164
|
+
or paste a quote, keep it exact and only tidy Markdown.
|
|
165
|
+
5. **Creating a missing daily note** — just use `<period>:create` (or let
|
|
166
|
+
`<period>:append` auto-create it). The CLI renders the user's configured
|
|
167
|
+
template via the shared engine: `{{snapshot:Project}}` expands to the live PARA
|
|
168
|
+
index list, `{{if weekday}}`/`{{date}}`/etc. are resolved, and LifeOS query
|
|
169
|
+
blocks (`ProjectListByTime`, `TaskDueListByTime`) are kept verbatim for the
|
|
170
|
+
plugin to render at view time. No manual template rendering needed — the
|
|
171
|
+
resulting note matches what the plugin/Aino would create.
|
|
172
|
+
|
|
173
|
+
The same `section=` works on `weekly|monthly|...:append` and on plain
|
|
174
|
+
`append path=<p> section=<h>`, so you can log into any note's heading.
|
|
175
|
+
|
|
176
|
+
## Creating theme notes (项目/领域/资源/归档)
|
|
177
|
+
|
|
178
|
+
Use `theme:create` so the note is built from the PARA type's template and gets
|
|
179
|
+
its theme tag wired into frontmatter (so the theme index collects it):
|
|
180
|
+
|
|
181
|
+
```bash
|
|
182
|
+
# read config first for the real PARA folder names, then place the note yourself
|
|
183
|
+
npx -y @life-os/cli config
|
|
184
|
+
npx -y @life-os/cli theme:create type=project tag="项目/季度OKR" path="1. 项目/季度OKR/季度OKR.md"
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
- `type=` picks the template (`<type>TemplateFilePath` → `<typeDir>/Template.md` → built-in).
|
|
188
|
+
- `tag=` is the theme tag; it's injected into `tags`/`aliases` frontmatter.
|
|
189
|
+
- `path=` is yours to choose — the convention is `<paraDir>/<name>/<name>.md` (a
|
|
190
|
+
folder + same-named index note, which is what `{{snapshot}}` lists). Add
|
|
191
|
+
`overwrite` to replace.
|
|
192
|
+
|
|
193
|
+
## Writing safely
|
|
194
|
+
|
|
195
|
+
- Writes (`append`, `create`, `task`, `<period>:append`) take an **explicit
|
|
196
|
+
`path=` / `ref=`** — they never guess a note from a loose name, so you won't
|
|
197
|
+
write to the wrong same-named file. `search`/`tasks` first to get the exact
|
|
198
|
+
target, then write.
|
|
199
|
+
- `create` errors with _"A note already exists…"_ unless you pass `overwrite`.
|
|
200
|
+
- Periodic `:append` **echoes the resolved path** and creates the note if missing.
|
|
201
|
+
If `Exists: no` surprises you, the vault's format config may differ from how
|
|
202
|
+
existing notes were named — surface the path to the user rather than creating a
|
|
203
|
+
stray note.
|
|
204
|
+
|
|
205
|
+
## Interpreting results
|
|
206
|
+
|
|
207
|
+
- Tasks print `[ ]`/`[x] <text> (due … !priority #tags) — <file>:<line>`.
|
|
208
|
+
The `<file>:<line>` is the stable reference for `task done|todo`.
|
|
209
|
+
- `tasks` defaults to open (todo); pass `done`/`all` to widen. `due=` queries also
|
|
210
|
+
hide completed tasks by default.
|
|
211
|
+
- PARA folder names are the user's own (e.g. `1. 项目`) — see `npx -y @life-os/cli config`.
|
|
212
|
+
- Errors are human-readable and exit non-zero (e.g. file-not-found, already-exists).
|
|
213
|
+
|
|
214
|
+
## Performance
|
|
215
|
+
|
|
216
|
+
Index-backed commands (`tasks`, `search type=file|tag`) rebuild the index per run
|
|
217
|
+
(~1s on a ~5k-note vault); `search type=content` scans note bodies (~0.5s). Fine
|
|
218
|
+
for interactive use; avoid tight loops of many index queries.
|
|
219
|
+
|
|
220
|
+
## Scope
|
|
221
|
+
|
|
222
|
+
Reading, querying and editing note content (notes, tasks, periodic notes, PARA,
|
|
223
|
+
tags). **Not** in scope: Google Calendar / CalDAV sync, and the plugin's UI —
|
|
224
|
+
those live in the LifeOS plugin and Aino app.
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
# `lifeos` — full command reference
|
|
2
|
+
|
|
3
|
+
Exhaustive reference for the `lifeos` CLI. The SKILL.md covers the common path;
|
|
4
|
+
load this when you need an exact flag, output shape, or error meaning.
|
|
5
|
+
|
|
6
|
+
## Conventions
|
|
7
|
+
|
|
8
|
+
- **Invocation**: run via `npx -y @life-os/cli <command> …` (npx fetches the
|
|
9
|
+
published package on first use; `-y` skips the prompt). The command names below
|
|
10
|
+
(`config`, `tasks`, …) are the `<command>` argument, e.g.
|
|
11
|
+
`npx -y @life-os/cli tasks due=today`.
|
|
12
|
+
- **Options**: `key=value` (or `--key=value`). **Flags**: `--json`, or bare
|
|
13
|
+
`overwrite` / `case`. Quote values containing spaces.
|
|
14
|
+
- **Output**: human-readable by default; `--json` (or `format=json`) emits a
|
|
15
|
+
single JSON document on stdout.
|
|
16
|
+
- **`content=` escapes**: in write commands (`append`, `create`, `<period>:append`)
|
|
17
|
+
the `content=` value interprets `\n` `\t` `\r` `\\`, so you can write multi-line
|
|
18
|
+
content on one command line.
|
|
19
|
+
- **Exit codes**: `0` success, `1` on any error. Error text is human-readable.
|
|
20
|
+
|
|
21
|
+
## Vault selection
|
|
22
|
+
|
|
23
|
+
Resolved in order, first match wins:
|
|
24
|
+
|
|
25
|
+
1. `vault=<path>` option (`~` is expanded; relative paths resolve against cwd)
|
|
26
|
+
2. `$LIFEOS_VAULT` environment variable
|
|
27
|
+
3. Walk up from the current directory for a folder containing `.obsidian/` or `.lifeos/`
|
|
28
|
+
4. The folder Aino last opened (`<userData>/bootstrap.json` → `lastOpenedFolder`)
|
|
29
|
+
|
|
30
|
+
`config` reports which one was used via `Found by` / `discoveredVia`.
|
|
31
|
+
|
|
32
|
+
## Settings sources
|
|
33
|
+
|
|
34
|
+
Effective settings merge built-in defaults with these files (later overrides
|
|
35
|
+
earlier), the same set the plugin and Aino use:
|
|
36
|
+
|
|
37
|
+
1. `.obsidian/plugins/periodic-para/data.json` (legacy plugin id)
|
|
38
|
+
2. `.obsidian/plugins/lifeos-pro/data.json`
|
|
39
|
+
3. `.lifeos/settings.json` (Aino's vault-portable settings)
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## Commands
|
|
44
|
+
|
|
45
|
+
### `config`
|
|
46
|
+
|
|
47
|
+
Show the resolved vault, how it was found, the config source files applied, and
|
|
48
|
+
key effective settings (PARA folders, periodic base, daily path format, and the
|
|
49
|
+
daily template path used when rendering a missing daily note). `--json` → `{ vault: {root, discoveredVia}, sources: string[], settings }`.
|
|
50
|
+
|
|
51
|
+
### `tasks [todo|done|all]`
|
|
52
|
+
|
|
53
|
+
List tasks. Positional status defaults to `todo`.
|
|
54
|
+
|
|
55
|
+
| Option | Meaning |
|
|
56
|
+
| -------------------------- | ------------------------------------------------------------------- |
|
|
57
|
+
| `tag=<tag>` | tasks tagged `<tag>` (matches the tag and its sub-tags `<tag>/...`) |
|
|
58
|
+
| `keyword=<text>` | substring match on task text |
|
|
59
|
+
| `due=today\|week\|overdue` | filter by **due date**; status still applies (default hides done) |
|
|
60
|
+
| `limit=<n>` | max rows (default 50) |
|
|
61
|
+
| `--json` | `{ totalCount, count, items: TaskItem[] }` |
|
|
62
|
+
|
|
63
|
+
`TaskItem`: `{ file, line, text, checked, dueDate?, priority?, tags?, ... }`.
|
|
64
|
+
Human line: `[ ]|[x] <text> (due <date> !<priority> #<tags>) — <file>:<line>`.
|
|
65
|
+
|
|
66
|
+
Notes: `due=*` over-fetches and post-filters by status, so a completed task with a
|
|
67
|
+
past due date is hidden unless you ask for `done`/`all`.
|
|
68
|
+
|
|
69
|
+
### `search query=<text>`
|
|
70
|
+
|
|
71
|
+
| Option | Meaning |
|
|
72
|
+
| --------------------- | ------------------------------------------------------- |
|
|
73
|
+
| `type=file` (default) | match note name + path (case-insensitive substring) |
|
|
74
|
+
| `type=tag` | match tag names; output `#tag (count)` |
|
|
75
|
+
| `type=content` | full-text scan of note bodies; output `path:line text` |
|
|
76
|
+
| `case` | content search becomes case-sensitive |
|
|
77
|
+
| `limit=<n>` | max results (default 20, capped at 100) |
|
|
78
|
+
| `--json` | `{ type, query, count, items }` |
|
|
79
|
+
|
|
80
|
+
Content matching is plain substring (not regex). It reads files on demand and
|
|
81
|
+
stops at `limit`.
|
|
82
|
+
|
|
83
|
+
### `read file=<name> | path=<vault/rel/path>`
|
|
84
|
+
|
|
85
|
+
Print a note. `path=` is exact (vault-relative); `file=` resolves a loose name via
|
|
86
|
+
the index and errors if ambiguous (lists candidates). `.md` is added if omitted.
|
|
87
|
+
`--json` → `{ filePath, content }`.
|
|
88
|
+
|
|
89
|
+
### Periodic notes: `daily | weekly | monthly | quarterly | yearly`
|
|
90
|
+
|
|
91
|
+
Resolve the note path from `periodicNotesPath` + the per-type format
|
|
92
|
+
(`periodicNotesPathFormat<Type>`, falling back to LifeOS defaults), using the same
|
|
93
|
+
formatter as the plugin/Aino (ISO weeks for weekly). Weekday/month name tokens
|
|
94
|
+
(`dddd`/`MMMM`) honor `locale=` (default: system locale).
|
|
95
|
+
|
|
96
|
+
| Form | Effect |
|
|
97
|
+
| -------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
98
|
+
| `<period>` | print `Type/Date/Path/Exists/Format`; `--json` adds `exists` |
|
|
99
|
+
| `<period>:read` | print the note (errors if it doesn't exist) |
|
|
100
|
+
| `<period>:create [overwrite]` | create the note from its configured template (rendered); errors if it exists unless `overwrite` |
|
|
101
|
+
| `<period>:append content=<text>` | append; **creates the note from its template if missing** |
|
|
102
|
+
| `section=<header>` | insert at the end of that header's section (creates it if absent) instead of the file tail — e.g. `section="日常记录"` for daily-record logging |
|
|
103
|
+
| `date=YYYY-MM-DD` | target a specific period (default: today) |
|
|
104
|
+
| `locale=<bcp47>` | locale for name tokens, e.g. `zh-CN` |
|
|
105
|
+
|
|
106
|
+
Template resolution: `periodicNotesTemplateFilePath<Type>` if set, else
|
|
107
|
+
`<periodicNotesPath>/Templates/<Type>.md`, else a built-in default. The template is
|
|
108
|
+
rendered with the shared engine: `{{snapshot:Project}}` → numbered `[[index|name]]`
|
|
109
|
+
list of PARA sub-folders that have an index note; `{{if weekday}}…{{endif}}`,
|
|
110
|
+
`{{date}}`, `{{date+N:FORMAT}}`, `{{title}}` are expanded; unknown `{{…}}` (LifeOS
|
|
111
|
+
query blocks) are left verbatim. `:create`/`:append` `--json` adds `created` /
|
|
112
|
+
`templatePath`.
|
|
113
|
+
|
|
114
|
+
Every form echoes the resolved path. `<period> read` / `<period>:read` are both
|
|
115
|
+
accepted.
|
|
116
|
+
|
|
117
|
+
### `theme:create type=<t> tag=<tag> path=<vault/rel/path> [overwrite]`
|
|
118
|
+
|
|
119
|
+
Create a PARA/theme note from its template. `type` ∈ `project|area|resource|archive|theme`.
|
|
120
|
+
Template resolution: `<type>TemplateFilePath` if set, else `<typeDir>/Template.md`,
|
|
121
|
+
else a built-in default. The template is rendered (same engine as periodic notes),
|
|
122
|
+
then `tag` is injected into the note's `tags`/`aliases` frontmatter so the theme
|
|
123
|
+
index collects it. `path=` is caller-supplied (read `config` for PARA folder
|
|
124
|
+
names); convention is `<paraDir>/<name>/<name>.md`. Errors if the note exists
|
|
125
|
+
unless `overwrite`. `--json` → `{ ok, filePath, created, templatePath, type, tag }`.
|
|
126
|
+
|
|
127
|
+
### `append path=<vault/rel/path> content=<text> [section=<header>]`
|
|
128
|
+
|
|
129
|
+
Append to an **existing** note. Errors if the note doesn't exist (use `create`).
|
|
130
|
+
Without `section=`, appends to the file tail with a newline boundary. With
|
|
131
|
+
`section=<header>`, inserts at the **end of that header's section body** (matching
|
|
132
|
+
the header at any `#` depth, ignoring case/whitespace) and creates the section at
|
|
133
|
+
the end of the file if the header is missing. `--json` →
|
|
134
|
+
`{ ok, filePath, created:false, section }`.
|
|
135
|
+
|
|
136
|
+
### `create path=<vault/rel/path> [content=<text>] [overwrite]`
|
|
137
|
+
|
|
138
|
+
Create a note (parent folders auto-created, `.md` added if omitted). Errors if it
|
|
139
|
+
exists unless `overwrite`. `--json` → `{ ok, filePath, created }`.
|
|
140
|
+
|
|
141
|
+
### `task done|todo ref=<file>:<line>`
|
|
142
|
+
|
|
143
|
+
Toggle one task's checkbox. `ref` is the `file:line` printed by `tasks` (only the
|
|
144
|
+
trailing `:<digits>` is the line number, so paths with colons are fine).
|
|
145
|
+
`--json` → `{ ok, filePath, action }`.
|
|
146
|
+
|
|
147
|
+
### `help`, `version`
|
|
148
|
+
|
|
149
|
+
Print usage / version.
|
|
150
|
+
|
|
151
|
+
---
|
|
152
|
+
|
|
153
|
+
## Errors
|
|
154
|
+
|
|
155
|
+
Surfaced as readable text with exit code 1. Common cases:
|
|
156
|
+
|
|
157
|
+
| Situation | Message |
|
|
158
|
+
| ------------------------------ | ----------------------------------------------------------------- |
|
|
159
|
+
| note missing (`read`/`append`) | `No such note in the vault.` |
|
|
160
|
+
| `create` onto existing | `A note already exists at that path. Add the \`overwrite\` flag…` |
|
|
161
|
+
| path escapes vault | `Refusing to touch a path outside the vault.` |
|
|
162
|
+
| `task` ref not a checkbox line | `That line is not a \`- [ ]\` / \`- [x]\` task.` |
|
|
163
|
+
| bad `due=` / `date=` value | explains the accepted values |
|
|
164
|
+
| no vault found | explains the four resolution options |
|
|
165
|
+
|
|
166
|
+
---
|
|
167
|
+
|
|
168
|
+
## Performance (≈5k-note vault)
|
|
169
|
+
|
|
170
|
+
- Fixed startup (node + import): ~70 ms.
|
|
171
|
+
- `search type=content`: ~0.5 s worst case (scans bodies; stops at `limit`).
|
|
172
|
+
- Index-backed (`tasks`, `search type=file|tag`): ~1 s (rebuilds the index per
|
|
173
|
+
process; there is no persistent cache yet). Avoid tight loops of many such calls.
|
|
174
|
+
|
|
175
|
+
## Out of scope
|
|
176
|
+
|
|
177
|
+
UI views, Google Calendar / CalDAV sync, two-way task↔calendar sync, Pomodoro and
|
|
178
|
+
daily-record sync — these remain in the LifeOS plugin and the Aino desktop app.
|
package/bin/life-os.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
|
-
|
|
4
|
-
const lines = [
|
|
5
|
-
"@life-os/cli is published and installed correctly.",
|
|
6
|
-
"",
|
|
7
|
-
"This is a bootstrap CLI package for the Life OS project.",
|
|
8
|
-
"Commands will be added in a future release."
|
|
9
|
-
];
|
|
10
|
-
|
|
11
|
-
process.stdout.write(`${lines.join("\n")}\n`);
|