@life-os/opc-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 +37 -0
- package/dist/opc.mjs +550 -0
- package/package.json +20 -0
package/README.md
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# OPC CLI
|
|
2
|
+
|
|
3
|
+
`opc` is a headless CLI for operating an OPC LifeOS vault. It is intentionally
|
|
4
|
+
small: it verifies the OPC vault structure, lists department readiness, prints
|
|
5
|
+
dashboard generation prompts and installs the bundled `opc` + `lifeos` agent
|
|
6
|
+
skills.
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
pnpm -C apps/opc-cli build
|
|
10
|
+
node apps/opc-cli/bin/opc.mjs config vault="/path/to/OPC LifeOS"
|
|
11
|
+
node apps/opc-cli/bin/opc.mjs departments --json
|
|
12
|
+
node apps/opc-cli/bin/opc.mjs dashboard dept=sales
|
|
13
|
+
node apps/opc-cli/bin/opc.mjs skill install vault="/path/to/OPC LifeOS"
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
After publishing, use it through npm:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npx -y @life-os/opc-cli config vault="/path/to/OPC LifeOS"
|
|
20
|
+
npx -y @life-os/opc-cli departments --json
|
|
21
|
+
npx -y @life-os/opc-cli dashboard dept=sales
|
|
22
|
+
npx -y @life-os/opc-cli skill install vault="/path/to/OPC LifeOS"
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Publishing
|
|
26
|
+
|
|
27
|
+
The workspace package remains `private` to prevent accidental direct `npm publish`
|
|
28
|
+
from leaking workspace-only dependencies. Use the staged publisher instead:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
pnpm opc:publish:dry-run
|
|
32
|
+
pnpm opc:publish
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
The publisher builds the CLI and embedded skill assets, stages a public
|
|
36
|
+
`@life-os/opc-cli` manifest, bundles the runtime into `dist/opc.mjs` and
|
|
37
|
+
publishes to `https://registry.npmjs.org`.
|
package/dist/opc.mjs
ADDED
|
@@ -0,0 +1,550 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __WEBPACK_EXTERNAL_createRequire } from "module";
|
|
3
|
+
/******/ /* webpack/runtime/compat */
|
|
4
|
+
/******/
|
|
5
|
+
/******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = new URL('.', import.meta.url).pathname.slice(import.meta.url.match(/^file:\/\/\/\w:/) ? 1 : 0, -1) + "/";
|
|
6
|
+
/******/
|
|
7
|
+
/************************************************************************/
|
|
8
|
+
var __webpack_exports__ = {};
|
|
9
|
+
|
|
10
|
+
;// CONCATENATED MODULE: ./dist/args.js
|
|
11
|
+
const KV_RE = /^-{0,2}([\w-]+)=(.*)$/s;
|
|
12
|
+
const FLAG_RE = /^--([\w-]+)$/;
|
|
13
|
+
function parseArgs(argv) {
|
|
14
|
+
const [rawCommand = 'help', ...rest] = argv;
|
|
15
|
+
const [command, sub] = rawCommand.replace(/^--?/, '').split(':', 2);
|
|
16
|
+
const opts = {};
|
|
17
|
+
const flags = new Set();
|
|
18
|
+
const positionals = [];
|
|
19
|
+
for (const token of rest) {
|
|
20
|
+
const kv = KV_RE.exec(token);
|
|
21
|
+
if (kv) {
|
|
22
|
+
opts[kv[1]] = kv[2];
|
|
23
|
+
continue;
|
|
24
|
+
}
|
|
25
|
+
const flag = FLAG_RE.exec(token);
|
|
26
|
+
if (flag) {
|
|
27
|
+
flags.add(flag[1]);
|
|
28
|
+
continue;
|
|
29
|
+
}
|
|
30
|
+
positionals.push(token);
|
|
31
|
+
}
|
|
32
|
+
return { command, sub, positionals, opts, flags };
|
|
33
|
+
}
|
|
34
|
+
function opt(args, key, fallback) {
|
|
35
|
+
return args.opts[key] ?? fallback;
|
|
36
|
+
}
|
|
37
|
+
function wantsJson(args) {
|
|
38
|
+
return args.flags.has('json') || args.opts.format === 'json';
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
;// CONCATENATED MODULE: external "node:fs"
|
|
42
|
+
const external_node_fs_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:fs");
|
|
43
|
+
;// CONCATENATED MODULE: external "node:path"
|
|
44
|
+
const external_node_path_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:path");
|
|
45
|
+
;// CONCATENATED MODULE: ./dist/opc.js
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
const DEPARTMENTS = [
|
|
49
|
+
{
|
|
50
|
+
id: '01',
|
|
51
|
+
name: '数字基建部',
|
|
52
|
+
englishName: 'Digital Infrastructure Department',
|
|
53
|
+
tag: '#OPC/数字基建',
|
|
54
|
+
englishTag: '#OPC/digital-infrastructure',
|
|
55
|
+
aliases: ['digital', 'infrastructure', 'infra', 'systems'],
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
id: '02',
|
|
59
|
+
name: '财务法务部',
|
|
60
|
+
englishName: 'Finance & Legal Department',
|
|
61
|
+
tag: '#OPC/财务法务',
|
|
62
|
+
englishTag: '#OPC/finance-legal',
|
|
63
|
+
aliases: ['finance', 'legal', 'billing', 'contracts'],
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
id: '03',
|
|
67
|
+
name: '市场增长部',
|
|
68
|
+
englishName: 'Marketing & Growth Department',
|
|
69
|
+
tag: '#OPC/市场增长',
|
|
70
|
+
englishTag: '#OPC/marketing-growth',
|
|
71
|
+
aliases: ['marketing', 'growth', 'market'],
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
id: '04',
|
|
75
|
+
name: '销售客户部',
|
|
76
|
+
englishName: 'Sales & Customer Department',
|
|
77
|
+
tag: '#OPC/销售客户',
|
|
78
|
+
englishTag: '#OPC/sales-customer',
|
|
79
|
+
aliases: ['sales', 'customer', 'customers', 'crm'],
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
id: '05',
|
|
83
|
+
name: '产品研发部',
|
|
84
|
+
englishName: 'Product R&D Department',
|
|
85
|
+
tag: '#OPC/产品研发',
|
|
86
|
+
englishTag: '#OPC/product-rd',
|
|
87
|
+
aliases: ['product', 'rnd', 'r&d', 'research', 'development'],
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
id: '06',
|
|
91
|
+
name: '交付运营部',
|
|
92
|
+
englishName: 'Delivery & Operations Department',
|
|
93
|
+
tag: '#OPC/交付运营',
|
|
94
|
+
englishTag: '#OPC/delivery-operations',
|
|
95
|
+
aliases: ['delivery', 'operations', 'ops'],
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
id: '07',
|
|
99
|
+
name: '创作品牌部',
|
|
100
|
+
englishName: 'Creative & Brand Department',
|
|
101
|
+
tag: '#OPC/创作品牌',
|
|
102
|
+
englishTag: '#OPC/creative-brand',
|
|
103
|
+
aliases: ['creative', 'brand', 'content'],
|
|
104
|
+
},
|
|
105
|
+
];
|
|
106
|
+
const ZH_LAYOUT = {
|
|
107
|
+
id: 'zh',
|
|
108
|
+
label: 'Chinese OPC LifeOS',
|
|
109
|
+
rootFiles: ['OPC LifeOS.md', 'CEO 驾驶舱.md', 'CEO 驾驶舱.AI.md', 'Agent.md', 'Soul.md', 'Memory.md'],
|
|
110
|
+
layers: ['0 周期笔记', '1 输入', '2 输出', '3 部门', '99 模板'],
|
|
111
|
+
ceoSourcePath: 'CEO 驾驶舱.md',
|
|
112
|
+
ceoAiPath: 'CEO 驾驶舱.AI.md',
|
|
113
|
+
departmentsPath: '3 部门',
|
|
114
|
+
inputPath: '1 输入',
|
|
115
|
+
outputPath: '2 输出',
|
|
116
|
+
departmentDir: (department) => `${department.id} ${department.name}`,
|
|
117
|
+
};
|
|
118
|
+
const EN_LAYOUT = {
|
|
119
|
+
id: 'en',
|
|
120
|
+
label: 'English OPC LifeOS',
|
|
121
|
+
rootFiles: ['OPC LifeOS.md', 'CEO Dashboard.md', 'CEO Dashboard.AI.md', 'Agent.md', 'Soul.md', 'Memory.md'],
|
|
122
|
+
layers: ['0 Periodic Notes', '1 Input', '2 Output', '3 Departments', '99 Templates'],
|
|
123
|
+
ceoSourcePath: 'CEO Dashboard.md',
|
|
124
|
+
ceoAiPath: 'CEO Dashboard.AI.md',
|
|
125
|
+
departmentsPath: '3 Departments',
|
|
126
|
+
inputPath: '1 Input',
|
|
127
|
+
outputPath: '2 Output',
|
|
128
|
+
departmentDir: (department) => `${department.id} ${department.englishName}`,
|
|
129
|
+
};
|
|
130
|
+
const OPC_LAYOUTS = [ZH_LAYOUT, EN_LAYOUT];
|
|
131
|
+
const ROOT_FILES = ZH_LAYOUT.rootFiles;
|
|
132
|
+
const LAYERS = ZH_LAYOUT.layers;
|
|
133
|
+
function departmentDir(department, layout = ZH_LAYOUT) {
|
|
134
|
+
return layout.departmentDir(department);
|
|
135
|
+
}
|
|
136
|
+
function departmentTag(department, layout = ZH_LAYOUT) {
|
|
137
|
+
return layout.id === 'en' ? department.englishTag : department.tag;
|
|
138
|
+
}
|
|
139
|
+
function check(root, relPath) {
|
|
140
|
+
return { path: relPath, exists: (0,external_node_fs_namespaceObject.existsSync)((0,external_node_path_namespaceObject.join)(root, relPath)) };
|
|
141
|
+
}
|
|
142
|
+
function scoreLayout(root, layout) {
|
|
143
|
+
return [...layout.rootFiles, ...layout.layers].filter((relPath) => (0,external_node_fs_namespaceObject.existsSync)((0,external_node_path_namespaceObject.join)(root, relPath))).length;
|
|
144
|
+
}
|
|
145
|
+
function detectLayout(root) {
|
|
146
|
+
const ranked = OPC_LAYOUTS.map((layout) => ({ layout, score: scoreLayout(root, layout) })).sort((left, right) => right.score - left.score);
|
|
147
|
+
const best = ranked[0];
|
|
148
|
+
return best && best.score > 0 ? best.layout : ZH_LAYOUT;
|
|
149
|
+
}
|
|
150
|
+
function listRootFiles(root, layout = detectLayout(root)) {
|
|
151
|
+
return layout.rootFiles.map((file) => check(root, file));
|
|
152
|
+
}
|
|
153
|
+
function listLayers(root, layout = detectLayout(root)) {
|
|
154
|
+
return layout.layers.map((layer) => check(root, layer));
|
|
155
|
+
}
|
|
156
|
+
function listDepartmentStatuses(root, layout = detectLayout(root)) {
|
|
157
|
+
return DEPARTMENTS.map((department) => {
|
|
158
|
+
const base = departmentDir(department, layout);
|
|
159
|
+
const dir = `${layout.departmentsPath}/${base}`;
|
|
160
|
+
return {
|
|
161
|
+
...department,
|
|
162
|
+
dir,
|
|
163
|
+
displayTag: departmentTag(department, layout),
|
|
164
|
+
files: {
|
|
165
|
+
index: check(root, `${dir}/${base}.md`),
|
|
166
|
+
ai: check(root, `${dir}/${base}.AI.md`),
|
|
167
|
+
agent: check(root, `${dir}/Agent.md`),
|
|
168
|
+
soul: check(root, `${dir}/Soul.md`),
|
|
169
|
+
memory: check(root, `${dir}/Memory.md`),
|
|
170
|
+
},
|
|
171
|
+
};
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
function findDepartment(input) {
|
|
175
|
+
if (!input)
|
|
176
|
+
return undefined;
|
|
177
|
+
const trimmed = input.trim();
|
|
178
|
+
const normalized = trimmed.replace(/^0+/, '');
|
|
179
|
+
const lower = trimmed.toLowerCase();
|
|
180
|
+
return DEPARTMENTS.find((department) => {
|
|
181
|
+
const full = departmentDir(department);
|
|
182
|
+
return (department.id === trimmed ||
|
|
183
|
+
String(Number(department.id)) === normalized ||
|
|
184
|
+
department.name === trimmed ||
|
|
185
|
+
department.englishName.toLowerCase() === lower ||
|
|
186
|
+
department.tag === trimmed ||
|
|
187
|
+
department.englishTag === trimmed ||
|
|
188
|
+
department.aliases.some((alias) => alias === lower) ||
|
|
189
|
+
full === trimmed ||
|
|
190
|
+
full.includes(trimmed) ||
|
|
191
|
+
trimmed.includes(department.name));
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
function isOpcVault(root) {
|
|
195
|
+
return OPC_LAYOUTS.some((layout) => (0,external_node_fs_namespaceObject.existsSync)((0,external_node_path_namespaceObject.join)(root, 'OPC LifeOS.md')) && (0,external_node_fs_namespaceObject.existsSync)((0,external_node_path_namespaceObject.join)(root, layout.departmentsPath)));
|
|
196
|
+
}
|
|
197
|
+
function aiPromptFor(sourcePath, aiPath, layout = ZH_LAYOUT) {
|
|
198
|
+
return [
|
|
199
|
+
`Update \`${aiPath}\` from \`${sourcePath}\`, nearby files in the same folder, recent periodic notes matching #OPC tags, and related material under \`${layout.inputPath}\` / \`${layout.outputPath}\`.`,
|
|
200
|
+
'',
|
|
201
|
+
'Rules:',
|
|
202
|
+
'- Use `.AI.md`, never `.Dashboard.md`.',
|
|
203
|
+
'- Keep `type: wiki/主题` frontmatter for LifeOS AI Wiki compatibility.',
|
|
204
|
+
'- Describe these folders as departments or CEO dashboard, not as topic folders.',
|
|
205
|
+
'- Include state summary, core judgments, metrics, material map, risks/blockers, review, and next actions.',
|
|
206
|
+
'- Do not write empty placeholders. If data is thin, infer an operating judgment from available material.',
|
|
207
|
+
].join('\n');
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
;// CONCATENATED MODULE: ./dist/output.js
|
|
211
|
+
function emitJson(value) {
|
|
212
|
+
console.log(JSON.stringify(value, null, 2));
|
|
213
|
+
}
|
|
214
|
+
function emitLines(lines) {
|
|
215
|
+
console.log(lines.join('\n'));
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
;// CONCATENATED MODULE: ./dist/commands/config.js
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
async function runConfig(args, vault) {
|
|
223
|
+
const layout = detectLayout(vault.root);
|
|
224
|
+
const rootFiles = listRootFiles(vault.root, layout);
|
|
225
|
+
const layers = listLayers(vault.root, layout);
|
|
226
|
+
const skills = ['.agents/skills/opc/SKILL.md', '.agents/skills/lifeos/SKILL.md'].map((file) => check(vault.root, file));
|
|
227
|
+
const result = {
|
|
228
|
+
vault: { root: vault.root, discoveredVia: vault.source },
|
|
229
|
+
layout: { id: layout.id, label: layout.label },
|
|
230
|
+
isOpcVault: isOpcVault(vault.root),
|
|
231
|
+
rootFiles,
|
|
232
|
+
layers,
|
|
233
|
+
skills,
|
|
234
|
+
};
|
|
235
|
+
if (wantsJson(args)) {
|
|
236
|
+
return emitJson(result);
|
|
237
|
+
}
|
|
238
|
+
emitLines([
|
|
239
|
+
`Vault: ${vault.root}`,
|
|
240
|
+
`Found by: ${vault.source}`,
|
|
241
|
+
`Layout: ${layout.label}`,
|
|
242
|
+
`OPC vault: ${result.isOpcVault ? 'yes' : 'no'}`,
|
|
243
|
+
'',
|
|
244
|
+
'Root files:',
|
|
245
|
+
...rootFiles.map((item) => ` ${item.exists ? '✓' : '✗'} ${item.path}`),
|
|
246
|
+
'',
|
|
247
|
+
'Layers:',
|
|
248
|
+
...layers.map((item) => ` ${item.exists ? '✓' : '✗'} ${item.path}`),
|
|
249
|
+
'',
|
|
250
|
+
'Skills:',
|
|
251
|
+
...skills.map((item) => ` ${item.exists ? '✓' : '✗'} ${item.path}`),
|
|
252
|
+
]);
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
;// CONCATENATED MODULE: ./dist/commands/dashboard.js
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
async function runDashboard(args, vault) {
|
|
260
|
+
const layout = detectLayout(vault.root);
|
|
261
|
+
const target = opt(args, 'department') ?? opt(args, 'dept') ?? args.positionals[0];
|
|
262
|
+
const wantsCeo = !target || target === 'ceo' || target === 'CEO';
|
|
263
|
+
const sourcePath = wantsCeo ? layout.ceoSourcePath : undefined;
|
|
264
|
+
const aiPath = wantsCeo ? layout.ceoAiPath : undefined;
|
|
265
|
+
const department = wantsCeo ? undefined : findDepartment(target);
|
|
266
|
+
if (!wantsCeo && !department) {
|
|
267
|
+
throw new Error(`Unknown department "${target}". Use \`opc departments\` to list available departments.`);
|
|
268
|
+
}
|
|
269
|
+
const departmentBase = department ? departmentDir(department, layout) : undefined;
|
|
270
|
+
const resolvedSourcePath = sourcePath ?? `${layout.departmentsPath}/${departmentBase}/${departmentBase}.md`;
|
|
271
|
+
const resolvedAiPath = aiPath ?? `${layout.departmentsPath}/${departmentBase}/${departmentBase}.AI.md`;
|
|
272
|
+
const result = {
|
|
273
|
+
layout: { id: layout.id, label: layout.label },
|
|
274
|
+
target: wantsCeo ? 'CEO dashboard' : `${department.id} ${department.englishName} / ${department.name}`,
|
|
275
|
+
sourcePath: resolvedSourcePath,
|
|
276
|
+
aiPath: resolvedAiPath,
|
|
277
|
+
prompt: aiPromptFor(resolvedSourcePath, resolvedAiPath, layout),
|
|
278
|
+
};
|
|
279
|
+
if (wantsJson(args)) {
|
|
280
|
+
return emitJson(result);
|
|
281
|
+
}
|
|
282
|
+
emitLines([
|
|
283
|
+
`Target: ${result.target}`,
|
|
284
|
+
`Source: ${result.sourcePath}`,
|
|
285
|
+
`AI: ${result.aiPath}`,
|
|
286
|
+
'',
|
|
287
|
+
result.prompt,
|
|
288
|
+
]);
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
;// CONCATENATED MODULE: ./dist/commands/departments.js
|
|
292
|
+
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
async function runDepartments(args, vault) {
|
|
296
|
+
const layout = detectLayout(vault.root);
|
|
297
|
+
const departments = listDepartmentStatuses(vault.root, layout);
|
|
298
|
+
if (wantsJson(args)) {
|
|
299
|
+
return emitJson({ layout: { id: layout.id, label: layout.label }, count: departments.length, departments });
|
|
300
|
+
}
|
|
301
|
+
emitLines(departments.map((department) => {
|
|
302
|
+
const files = Object.values(department.files);
|
|
303
|
+
const complete = files.every((file) => file.exists);
|
|
304
|
+
return `${complete ? '✓' : '✗'} ${department.id} ${department.englishName} / ${department.name} ${department.displayTag} — ${department.dir}`;
|
|
305
|
+
}));
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
;// CONCATENATED MODULE: external "node:fs/promises"
|
|
309
|
+
const promises_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:fs/promises");
|
|
310
|
+
;// CONCATENATED MODULE: ../../packages/skill-assets/dist/generated.js
|
|
311
|
+
// AUTO-GENERATED by scripts/generate.mjs — do not edit by hand.
|
|
312
|
+
// Source of truth: packages/skill-assets/lifeos-skill/ and packages/skill-assets/opc-skill/.
|
|
313
|
+
// Re-run `pnpm -C packages/skill-assets generate` (or just `build`).
|
|
314
|
+
const LIFEOS_SKILL_VERSION = "0.1.3";
|
|
315
|
+
const OPC_SKILL_VERSION = "0.1.3";
|
|
316
|
+
const LIFEOS_SKILL_FILES = {
|
|
317
|
+
"SKILL.md": "---\nname: lifeos\ndescription: \"Read, query and edit a LifeOS / Obsidian PARA vault (notes, tasks, periodic notes, theme notes, tags, AI Wiki) 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 标签/主题标签; the LifeOS AI Wiki / `.AI.md` topic synthesis pages or 整理主题 / 更新 AI Wiki; or wants to find/search notes, capture a thought, or check/update what's on their plate in their LifeOS vault.\"\n---\n\n# LifeOS\n\nDrive a LifeOS vault through the `lifeos` CLI. It is **config-aware** — it reads\nthe user's real PARA folder names, periodic-note formats, Obsidian Daily Notes\ncore settings and section headers — and **headless**, working directly on the\nvault folder without Obsidian running. Query results match what the user sees in\nthe app.\n\n## Core concepts (核心概念)\n\nLifeOS organises a vault as two complementary kinds of note. Knowing which one a\nrequest is about tells you which command to reach for.\n\n**Periodic notes (周期笔记)** — organised by **time**. One file per period; resolve\nits path with `npx -y @life-os/cli <period>`. The longer the period the less predictable it is,\nso longer periods are for goals and shorter ones for tasks:\n\n- **yearly (年记)** / **quarterly (季记)** — long-term: **goal management (目标管理)**,\n set the direction for the year / quarter.\n- **monthly (月记)** / **weekly (周记)** — short-term: **task management (任务管理)**,\n break those goals into this month's / week's tasks.\n- **daily (日记)** — daily records: real-time capture of thoughts, tasks and time\n tracking. Most capture lands here.\n\n**Theme notes (主题笔记)** — organised by **subject**, usually via **PARA**. These live\nin the user's PARA folders (see `npx -y @life-os/cli config`); reach them with `search`/`read`.\nThe later→earlier order is increasing actionability (archive → resource → area → project):\n\n- **project (项目)** — most actionable: a concrete goal with a deadline, e.g. 「完成季度报告」.\n- **area (领域)** — an ongoing responsibility to maintain, e.g. 「健康」「财务」.\n- **resource (资源)** — a topic of interest or reference material, e.g. 「读书笔记」.\n- **archive (归档)** — finished or inactive projects / areas / resources.\n- PARA is just the common shape; a theme can be any subject (e.g. 「#节日」).\n\n**The link between them — theme tags (主题标签)**: each theme note is identified by a\nunique tag. Any task / fleeting note / file anywhere — including inside a daily or\nother periodic note — that carries that tag is **automatically indexed** into the\ntheme note. This is what makes capture stress-free: jot with the right `#tag` now,\nfind it under the theme later.\n\n- **Top-down (自上而下)**: tasks planned in a theme note surface in the daily note on\n their planned date, so `tasks due=today` reflects project/goal plans.\n- **Bottom-up (自下而上)**: a tagged thought or todo in the daily note is collected\n back into the matching theme note via its tag.\n\nSo: when a user talks about a 项目/领域/资源/主题, work in the theme note; when they\ntalk about a day/week/month/quarter/year or \"what's on my plate today\", work in the\nperiodic note — and reuse the theme's tag so the two stay linked.\n\n**AI Wiki (`.AI.md`)** — a third layer that sits **beside** the topic note as a\nsibling `{filename}.AI.md` file. It is the LifeOS AI Wiki: a synthesised\nsummary page of what the vault knows about that topic, maintained\nincrementally by this skill. Only **topic / index notes** get one — never\ncaptures, dailies, meeting notes, or other one-off source files. When the\nuser says \"整理一下 X 主题\"、\"更新 AI Wiki\"、\"看看 AI Wiki 怎么说\", follow the\nrules in [`references/ai-wiki.md`](references/ai-wiki.md): it covers source\nscope, page schema, ingest / query / lint flows, and the concrete CLI\nrecipes that touch `7 索引/7. AI Wiki 索引.md` and `7 索引/AI Wiki 变更日志.md`.\n\n## Invocation\n\nRun the CLI with **`npx -y @life-os/cli`** — npx fetches the published package on\nfirst use and `-y` skips the install prompt; nothing needs to be installed\nglobally. Every example below is written in that form.\n\n## First moves\n\n1. Run `npx -y @life-os/cli config` to confirm which vault and settings are in\n effect. If it can't find a vault, ask the user for the path and pass\n `vault=<path>`.\n2. `npx -y @life-os/cli help` is the authoritative command list. For exhaustive\n flags, output shapes and error codes, read\n [`references/commands.md`](references/commands.md).\n3. For LifeOS AI Wiki maintenance (`.AI.md` topic pages, the central index,\n the changelog and lint checks), read\n [`references/ai-wiki.md`](references/ai-wiki.md).\n\n## Syntax\n\n- Options are `key=value` (e.g. `tag=work`, `limit=10`). `--key=value` also works.\n- Flags are bare words after `--` (e.g. `--json`) or plain (`overwrite`, `case`).\n- Quote values with spaces: `vault=\"~/My Vault/LifeOS\"`.\n- Add `--json` whenever you need to parse output programmatically.\n\n## Vault selection\n\nThis skill is installed **inside the user's vault**, so you normally run from\nwithin it — the CLI auto-detects the vault from the current directory. Resolution\norder (first match wins): `vault=` → `$LIFEOS_VAULT` → walk up from cwd for\n`.obsidian/`/`.lifeos/` → the folder Aino last opened (fallback). Only pass\n`vault=` when the user means a _different_ vault than the one you're in.\n\n## Commands at a glance\n\n```bash\n# every command is invoked as: npx -y @life-os/cli <args>\nnpx -y @life-os/cli config # vault + effective settings (run this first)\nnpx -y @life-os/cli tasks [todo|done|all] # tasks; filters: tag= keyword= due=today|week|overdue limit=\nnpx -y @life-os/cli search query=<text> # type=file (default) | tag | content ; add `case` for content\nnpx -y @life-os/cli read file=<name>|path=<p> # print a note\nnpx -y @life-os/cli daily|weekly|monthly|quarterly|yearly # show the period note's path + whether it exists\nnpx -y @life-os/cli <period>:read # print the period note\nnpx -y @life-os/cli <period>:create # create the period note from its configured template\nnpx -y @life-os/cli <period>:append content=<t> # append (creates from template if missing)\nnpx -y @life-os/cli theme:create type=project|area|resource|archive|theme tag=<t> path=<p> # create a PARA note from its template\nnpx -y @life-os/cli append path=<p> content=<t> # append to an existing note\nnpx -y @life-os/cli create path=<p> [content=] # create a plain note (no template; add `overwrite` to replace)\nnpx -y @life-os/cli task done|todo ref=<file>:<n> # toggle a task by its file:line reference\n```\n\n**Template-aware creation:** `<period>:create`, `theme:create`, and the auto-create\ninside `<period>:append` all render the user's **configured template** through the\nsame engine the plugin/Aino use — `{{snapshot:Project}}`, `{{if weekday}}`,\n`{{date}}` etc. are expanded, and theme notes get their tag injected into\nfrontmatter. Plain `create path=…` stays template-free (use it for arbitrary notes).\n\n## Recipes (chain commands like this)\n\n**Morning review** — what's on my plate, then capture the plan:\n\n```bash\nnpx -y @life-os/cli tasks due=today --json # today's open tasks\nnpx -y @life-os/cli tasks due=overdue --json # anything slipping\nnpx -y @life-os/cli daily:append section=\"日常记录\" content=\"- 08:30 #计划 今天先做 ...\"\n```\n\n**Quick capture** — \"记一下:想法X\" (drop a timestamped line into today's record section):\n\n```bash\nnpx -y @life-os/cli daily:append section=\"日常记录\" content=\"- 14:30 #摘抄 想法X\" # echoes the resolved path\n```\n\n**Find then act** — never write blind:\n\n```bash\nnpx -y @life-os/cli tasks keyword=\"季度报告\" # locate the task, note its file:line\nnpx -y @life-os/cli task done ref=\"0. 周期笔记/2025/Daily/05/2025-05-30.md:14\"\n```\n\n**Research a topic across the vault**:\n\n```bash\nnpx -y @life-os/cli search query=\"超线性回报\" type=content limit=20 # path:line + matching text\nnpx -y @life-os/cli read path=\"-1. 捕获/....md\" # open the most relevant hit\n```\n\n**Weekly review**:\n\n```bash\nnpx -y @life-os/cli weekly # confirm this week's note path / existence\nnpx -y @life-os/cli tasks done due=week # what got done\nnpx -y @life-os/cli weekly:append content=\"## 复盘\\n...\"\n```\n\n## Journaling (日记)\n\nThe daily note is where most capture lands. Do it precisely:\n\n1. **Locate** — `npx -y @life-os/cli daily` shows today's path and `Exists`. Pass\n `date=YYYY-MM-DD` for another day, `locale=` for weekday/month names. For\n daily notes, the CLI honors Obsidian's `.obsidian/daily-notes.json`\n `folder` + `format` first, so never hand-build a path like\n `Daily/YYYY-MM-DD.md`.\n2. **Insert in the right place** — append into the record section with\n `section=<header>`, not the file tail. The header is the daily note's main\n record heading (commonly `日常记录` / `Daily Record`); confirm it by reading a\n recent daily note. `section=` lands the line at the **end of that section**\n (e.g. before `习惯打卡` / `Habit`) and creates the section only if absent.\n3. **Format** — default to `- HH:mm #tag 内容`. Use the current time from the\n environment; the user is usually in their local timezone. Reuse existing tags —\n `npx -y @life-os/cli search type=tag keyword=<x>` — rather than inventing\n fine-grained ones; 1–3 tags unless the entry needs more.\n4. **Polish, don't transcribe** — lightly smooth the user's words while keeping\n their facts, stance, emotion and first-person voice; add no judgments, advice\n or conclusions they didn't make. When they say `原文`/`逐字`/`原样`/`摘抄`/verbatim,\n or paste a quote, keep it exact and only tidy Markdown.\n5. **Creating a missing daily note** — just use `<period>:create` (or let\n `<period>:append` auto-create it). For daily notes, the CLI also honors the\n Obsidian Daily Notes core `template` path when configured. It renders the\n user's configured template via the shared engine: `{{snapshot:Project}}`\n expands to the live PARA index list, `{{if weekday}}`/`{{date}}`/etc. are\n resolved, and LifeOS query blocks (`ProjectListByTime`, `TaskDueListByTime`)\n are kept verbatim for the plugin to render at view time. No manual template\n rendering needed — the resulting note matches what the plugin/Aino would\n create.\n\nThe same `section=` works on `weekly|monthly|...:append` and on plain\n`append path=<p> section=<h>`, so you can log into any note's heading.\n\n## Creating theme notes (项目/领域/资源/归档)\n\nUse `theme:create` so the note is built from the PARA type's template and gets\nits theme tag wired into frontmatter (so the theme index collects it):\n\n```bash\n# read config first for the real PARA folder names, then place the note yourself\nnpx -y @life-os/cli config\nnpx -y @life-os/cli theme:create type=project tag=\"项目/季度OKR\" path=\"1. 项目/季度OKR/季度OKR.md\"\n```\n\n- `type=` picks the template (`<type>TemplateFilePath` → `<typeDir>/Template.md` → built-in).\n- `tag=` is the theme tag; it's injected into `tags`/`aliases` frontmatter.\n- `path=` is yours to choose — the convention is `<paraDir>/<name>/<name>.md` (a\n folder + same-named index note, which is what `{{snapshot}}` lists). Add\n `overwrite` to replace.\n\n## Upgrading the skill\n\nThe skill files inside `.agents/skills/lifeos/` should match your CLI version.\nRun this after upgrading `@life-os/cli`:\n\n```bash\nnpx -y @life-os/cli skill install\n```\n\nIt copies the bundled SKILL.md + references into your vault's `.agents/skills/lifeos/`\nfrom the npm package you just upgraded to — no manual download, no git clone.\n\n## Writing safely\n\n- Writes (`append`, `create`, `task`, `<period>:append`) take an **explicit\n `path=` / `ref=`** — they never guess a note from a loose name, so you won't\n write to the wrong same-named file. `search`/`tasks` first to get the exact\n target, then write.\n- `create` errors with _\"A note already exists…\"_ unless you pass `overwrite`.\n- Periodic `:append` **echoes the resolved path** and creates the note if missing.\n If `Exists: no` surprises you, the vault's format config may differ from how\n existing notes were named — surface the path to the user rather than creating a\n stray note.\n\n## Interpreting results\n\n- Tasks print `[ ]`/`[x] <text> (due … !priority #tags) — <file>:<line>`.\n The `<file>:<line>` is the stable reference for `task done|todo`.\n- `tasks` defaults to open (todo); pass `done`/`all` to widen. `due=` queries also\n hide completed tasks by default.\n- PARA folder names are the user's own (e.g. `1. 项目`) — see `npx -y @life-os/cli config`.\n- Errors are human-readable and exit non-zero (e.g. file-not-found, already-exists).\n\n## Performance\n\nIndex-backed commands (`tasks`, `search type=file|tag`) rebuild the index per run\n(~1s on a ~5k-note vault); `search type=content` scans note bodies (~0.5s). Fine\nfor interactive use; avoid tight loops of many index queries.\n\n## Scope\n\nReading, querying and editing note content (notes, tasks, periodic notes, PARA,\ntags). **Not** in scope: Google Calendar / CalDAV sync, and the plugin's UI —\nthose live in the LifeOS plugin and Aino app.\n",
|
|
318
|
+
"references/ai-wiki.md": "# LifeOS AI Wiki — maintenance rules\n\nA LifeOS vault can host a **distributed AI-maintained wiki**: each topic /\nindex note gets a sibling `{filename}.AI.md` page that synthesises what the\nvault knows about that topic. This file is the authoritative spec for how to\ncreate, update, query and lint those pages.\n\nUse it whenever the user asks you to \"整理一下 X 主题\"、\"更新 AI Wiki\"、\n\"看看 AI Wiki 怎么说\" or anything similar.\n\n## Source scope\n\nOriginal source files stay in the existing PARA structure:\n\n- `0 周期笔记/`\n- `1 捕获/`\n- `2 项目/`\n- `3 领域/`\n- `4 资源/`\n- `5 存档/`\n\n**Do not rewrite source notes** during AI Wiki ingestion unless the user\nexplicitly asks for source-note edits.\n\nOnly **topic or index notes** receive `.AI.md` companions. Do **not** create\n`.AI.md` pages for individual capture notes, articles, imported sources,\nmeeting notes, or other non-index source files. If a source note contains\ndurable knowledge, first attach it to the appropriate topic and then update\nthat topic's `.AI.md` page.\n\nEach active PARA topic folder in `2 项目/`, `3 领域/`, and `4 资源/` should have\na sibling `{folder name}.AI.md` page. `0 周期笔记/`, `1 捕获/`, and `5 存档/`\nmay use section-level overview pages. `5 存档/` should use archive-family\noverview pages first because it contains many inactive project folders.\n\n## Wiki page schema\n\nEvery `.AI.md` page must include this frontmatter:\n\n```yaml\n---\ntype: wiki/主题\nsource: '[[同目录下的主题/索引笔记]]'\ncreated: YYYY-MM-DD\nupdated: YYYY-MM-DD\n---\n```\n\nAllowed `type` values:\n\n- `wiki/主题` — cross-source synthesis page\n\nBody convention — **required** sections (in this order):\n\n```markdown\n## 一句话摘要\n\n<one sentence: purpose + current focus>\n\n## 核心判断\n\n- <durable insight 1>\n- <durable insight 2>\n (3–6 bullets; long-lived judgements, not status)\n\n## 材料地图\n\n- N 篇子笔记 (类别 / 类别)\n- 关联主题:[[相关主题.AI]]\n- 关键节点:<recent milestone>\n\n## 复盘\n\n- 做对了:<what worked, why>\n- 做错了:<what didn't work, why>\n- 学到:<takeaway worth keeping>\n (short, specific. If a phase just ended, anchor to the period.)\n\n## 下一步建议\n\n- [优先级] <具体动作> — <时间感:本周/本月/下季>\n- [优先级] <具体动作> — <时间感>\n (2–5 bullets. Must be specific, owner-clear, time-anchored.\n The goal of this page is to drive the topic forward,\n not just summarise it.)\n```\n\nThe last two sections — **复盘 / 下一步建议** — are what make this a\nworking wiki instead of an archive. Without them the page just summarises\nthe past; with them it steers the topic.\n\n## Ingest flow\n\nWhen maintaining a topic or index note in the AI Wiki:\n\n1. **Read** the topic/index note and related local context.\n2. **Create or update** the sibling `{filename}.AI.md` page — only when the\n source is a topic or index note.\n3. **Link** to related topic `.AI.md` pages where the relationship is durable.\n4. **Update** `7 索引/7. AI Wiki 索引.md` with the page link and one-line\n summary.\n5. **Append** an operation entry to `7 索引/AI Wiki 变更日志.md`.\n\n### Concrete lifeos CLI commands\n\n```bash\n# 1. locate the topic note and confirm vault layout\nnpx -y @life-os/cli config\nnpx -y @life-os/cli search query=\"学日语\" type=file\n\n# 2. read the topic note + any sibling that already exists\nnpx -y @life-os/cli read path=\"4 资源/学日语/学日语.md\"\nnpx -y @life-os/cli read path=\"4 资源/学日语/学日语.AI.md\" # ok if missing — handle the error\n\n# 3. write or overwrite the .AI.md sibling\nnpx -y @life-os/cli create path=\"4 资源/学日语/学日语.AI.md\" content=\"---\\ntype: wiki/主题\\nsource: \\\"[[学日语]]\\\"\\ncreated: 2026-06-07\\nupdated: 2026-06-07\\n---\\n\\n## 一句话摘要\\n...\" overwrite\n\n# 4. update the central index (append a bullet under the right section)\nnpx -y @life-os/cli append path=\"7 索引/7. AI Wiki 索引.md\" section=\"4 资源\" content=\"- [[4 资源/学日语/学日语.AI|学日语]] — 五十音过关 / 每日 30 分钟 / N4 目标\"\n\n# 5. log the operation in the changelog\nnpx -y @life-os/cli append path=\"7 索引/AI Wiki 变更日志.md\" content=\"- 2026-06-07 update 4 资源/学日语/学日语.AI.md — refreshed core take + materials map\"\n```\n\nAlways use `overwrite` on step 3 only after reading the existing page — the\ngoal is incremental synthesis, not blind replacement.\n\n## Query flow\n\nWhen answering from the AI Wiki:\n\n1. **Read `7 索引/7. AI Wiki 索引.md` first.** It is the entry point.\n2. **Open** the relevant `.AI.md` pages.\n3. **Read original source files** only when the wiki page is missing, stale,\n or insufficient.\n4. If a query produces durable synthesis, update the relevant topic `.AI.md`\n page **when requested**. Do not create standalone non-topic `.AI.md` pages\n unless the user explicitly overrides this rule.\n\n```bash\nnpx -y @life-os/cli read path=\"7 索引/7. AI Wiki 索引.md\"\nnpx -y @life-os/cli read path=\"4 资源/学日语/学日语.AI.md\"\nnpx -y @life-os/cli search query=\"五十音\" type=content limit=10 # fall back to source scan\n```\n\n## Lint flow\n\nRun these checks during AI Wiki maintenance:\n\n- `.AI.md` pages missing required frontmatter\n- wiki pages not present in `7 索引/7. AI Wiki 索引.md`\n- `.AI.md` pages attached to non-topic source notes\n- obsolete `updated` dates after content changes\n- orphaned pages with no incoming index link\n- duplicate topic pages that should be merged or cross-linked\n\nUseful one-liners:\n\n```bash\nnpx -y @life-os/cli search query=\".AI.md\" type=file limit=200 # enumerate all wiki pages\nnpx -y @life-os/cli search query=\"type: wiki/\" type=content limit=200 # frontmatter sanity check\n```\n\n## Out of scope\n\n- Do not generate `.AI.md` for captures, daily / weekly / monthly notes, or\n any individual source note that isn't a topic / index.\n- Do not rewrite source notes during ingestion.\n- Do not invent new `type:` values beyond `wiki/主题` without an explicit user\n decision.\n",
|
|
319
|
+
"references/commands.md": "# `lifeos` — full command reference\n\nExhaustive reference for the `lifeos` CLI. The SKILL.md covers the common path;\nload this when you need an exact flag, output shape, or error meaning.\n\n## Conventions\n\n- **Invocation**: run via `npx -y @life-os/cli <command> …` (npx fetches the\n published package on first use; `-y` skips the prompt). The command names below\n (`config`, `tasks`, …) are the `<command>` argument, e.g.\n `npx -y @life-os/cli tasks due=today`.\n- **Options**: `key=value` (or `--key=value`). **Flags**: `--json`, or bare\n `overwrite` / `case`. Quote values containing spaces.\n- **Output**: human-readable by default; `--json` (or `format=json`) emits a\n single JSON document on stdout.\n- **`content=` escapes**: in write commands (`append`, `create`, `<period>:append`)\n the `content=` value interprets `\\n` `\\t` `\\r` `\\\\`, so you can write multi-line\n content on one command line.\n- **Exit codes**: `0` success, `1` on any error. Error text is human-readable.\n\n## Vault selection\n\nResolved in order, first match wins:\n\n1. `vault=<path>` option (`~` is expanded; relative paths resolve against cwd)\n2. `$LIFEOS_VAULT` environment variable\n3. Walk up from the current directory for a folder containing `.obsidian/` or `.lifeos/`\n4. The folder Aino last opened (`<userData>/bootstrap.json` → `lastOpenedFolder`)\n\n`config` reports which one was used via `Found by` / `discoveredVia`.\n\n## Settings sources\n\nEffective settings merge built-in defaults with these files (later overrides\nearlier), the same set the plugin and Aino use:\n\n1. `.obsidian/plugins/periodic-para/data.json` (legacy plugin id)\n2. `.obsidian/plugins/lifeos-pro/data.json`\n3. `.lifeos/settings.json` (Aino's vault-portable settings)\n\n---\n\n## Commands\n\n### `config`\n\nShow the resolved vault, how it was found, the config source files applied, and\nkey LifeOS settings (PARA folders, periodic base, daily path format, and the daily\ntemplate path used when rendering a missing daily note). For the final daily note\npath, use `daily` itself: it also considers Obsidian Daily Notes core settings.\n`--json` → `{ vault: {root, discoveredVia}, sources: string[], settings }`.\n\n### `tasks [todo|done|all]`\n\nList tasks. Positional status defaults to `todo`.\n\n| Option | Meaning |\n| -------------------------- | ------------------------------------------------------------------- |\n| `tag=<tag>` | tasks tagged `<tag>` (matches the tag and its sub-tags `<tag>/...`) |\n| `keyword=<text>` | substring match on task text |\n| `due=today\\|week\\|overdue` | filter by **due date**; status still applies (default hides done) |\n| `limit=<n>` | max rows (default 50) |\n| `--json` | `{ totalCount, count, items: TaskItem[] }` |\n\n`TaskItem`: `{ file, line, text, checked, dueDate?, priority?, tags?, ... }`.\nHuman line: `[ ]|[x] <text> (due <date> !<priority> #<tags>) — <file>:<line>`.\n\nNotes: `due=*` over-fetches and post-filters by status, so a completed task with a\npast due date is hidden unless you ask for `done`/`all`.\n\n### `search query=<text>`\n\n| Option | Meaning |\n| --------------------- | ------------------------------------------------------- |\n| `type=file` (default) | match note name + path (case-insensitive substring) |\n| `type=tag` | match tag names; output `#tag (count)` |\n| `type=content` | full-text scan of note bodies; output `path:line text` |\n| `case` | content search becomes case-sensitive |\n| `limit=<n>` | max results (default 20, capped at 100) |\n| `--json` | `{ type, query, count, items }` |\n\nContent matching is plain substring (not regex). It reads files on demand and\nstops at `limit`.\n\n### `read file=<name> | path=<vault/rel/path>`\n\nPrint a note. `path=` is exact (vault-relative); `file=` resolves a loose name via\nthe index and errors if ambiguous (lists candidates). `.md` is added if omitted.\n`--json` → `{ filePath, content }`.\n\n### Periodic notes: `daily | weekly | monthly | quarterly | yearly`\n\nResolve the note path with the same formatter as the plugin/Aino (ISO weeks for\nweekly). For `daily`, `.obsidian/daily-notes.json` wins when present:\n`folder` is the base path and `format` is the date path template, so formats like\n`MM/YYYY-MM-DD` correctly create month subfolders. Other periods use\n`periodicNotesPath` + `periodicNotesPathFormat<Type>` from LifeOS settings,\nfalling back to LifeOS defaults. Weekday/month name tokens (`dddd`/`MMMM`) honor\n`locale=` (default: system locale).\n\n| Form | Effect |\n| -------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |\n| `<period>` | print `Type/Date/Path/Exists/Format`; `--json` adds `exists` |\n| `<period>:read` | print the note (errors if it doesn't exist) |\n| `<period>:create [overwrite]` | create the note from its configured template (rendered); errors if it exists unless `overwrite` |\n| `<period>:append content=<text>` | append; **creates the note from its template if missing** |\n| `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 |\n| `date=YYYY-MM-DD` | target a specific period (default: today) |\n| `locale=<bcp47>` | locale for name tokens, e.g. `zh-CN` |\n\nTemplate resolution: for `daily`, Obsidian Daily Notes core `template` wins when\nset; otherwise `periodicNotesTemplateFilePath<Type>` if set, else\n`<periodicNotesPath>/Templates/<Type>.md`, else a built-in default. The template\nis rendered with the shared engine: `{{snapshot:Project}}` → numbered\n`[[index|name]]` list of PARA sub-folders that have an index note;\n`{{if weekday}}…{{endif}}`, `{{date}}`, `{{date+N:FORMAT}}`, `{{title}}` are\nexpanded; unknown `{{…}}` (LifeOS query blocks) are left verbatim.\n`:create`/`:append` `--json` adds `created` / `templatePath`.\n\nEvery form echoes the resolved path. `<period> read` / `<period>:read` are both\naccepted.\n\n### `theme:create type=<t> tag=<tag> path=<vault/rel/path> [overwrite]`\n\nCreate a PARA/theme note from its template. `type` ∈ `project|area|resource|archive|theme`.\nTemplate resolution: `<type>TemplateFilePath` if set, else `<typeDir>/Template.md`,\nelse a built-in default. The template is rendered (same engine as periodic notes),\nthen `tag` is injected into the note's `tags`/`aliases` frontmatter so the theme\nindex collects it. `path=` is caller-supplied (read `config` for PARA folder\nnames); convention is `<paraDir>/<name>/<name>.md`. Errors if the note exists\nunless `overwrite`. `--json` → `{ ok, filePath, created, templatePath, type, tag }`.\n\n### `append path=<vault/rel/path> content=<text> [section=<header>]`\n\nAppend to an **existing** note. Errors if the note doesn't exist (use `create`).\nWithout `section=`, appends to the file tail with a newline boundary. With\n`section=<header>`, inserts at the **end of that header's section body** (matching\nthe header at any `#` depth, ignoring case/whitespace) and creates the section at\nthe end of the file if the header is missing. `--json` →\n`{ ok, filePath, created:false, section }`.\n\n### `create path=<vault/rel/path> [content=<text>] [overwrite]`\n\nCreate a note (parent folders auto-created, `.md` added if omitted). Errors if it\nexists unless `overwrite`. `--json` → `{ ok, filePath, created }`.\n\n### `task done|todo ref=<file>:<line>`\n\nToggle one task's checkbox. `ref` is the `file:line` printed by `tasks` (only the\ntrailing `:<digits>` is the line number, so paths with colons are fine).\n`--json` → `{ ok, filePath, action }`.\n\n### `skill install [vault=<path>]`\n\nInstall or update the bundled LifeOS agent skill into\n`.agents/skills/lifeos/` inside the resolved vault. The command overwrites\n`SKILL.md` and `references/` with the files embedded in the current\n`@life-os/cli` package, so it is the upgrade path after installing a newer CLI.\n\n### `help`, `version`\n\nPrint usage / version.\n\n---\n\n## Errors\n\nSurfaced as readable text with exit code 1. Common cases:\n\n| Situation | Message |\n| ------------------------------ | ----------------------------------------------------------------- |\n| note missing (`read`/`append`) | `No such note in the vault.` |\n| `create` onto existing | `A note already exists at that path. Add the \\`overwrite\\` flag…` |\n| path escapes vault | `Refusing to touch a path outside the vault.` |\n| `task` ref not a checkbox line | `That line is not a \\`- [ ]\\` / \\`- [x]\\` task.` |\n| bad `due=` / `date=` value | explains the accepted values |\n| no vault found | explains the four resolution options |\n\n---\n\n## Performance (≈5k-note vault)\n\n- Fixed startup (node + import): ~70 ms.\n- `search type=content`: ~0.5 s worst case (scans bodies; stops at `limit`).\n- Index-backed (`tasks`, `search type=file|tag`): ~1 s (rebuilds the index per\n process; there is no persistent cache yet). Avoid tight loops of many such calls.\n\n## Out of scope\n\nUI views, Google Calendar / CalDAV sync, two-way task↔calendar sync, Pomodoro and\ndaily-record sync — these remain in the LifeOS plugin and the Aino desktop app.\n",
|
|
320
|
+
};
|
|
321
|
+
const OPC_SKILL_FILES = {
|
|
322
|
+
"SKILL.md": "---\nname: opc\ndescription: Operate an OPC LifeOS vault as an AI-agent-led one-person-company operating system. Use when the user asks to update the OPC vault, CEO dashboard, departments, input/output flow, periodic reviews, agent memory, or `.AI.md` dashboards.\n---\n\n# OPC LifeOS\n\nUse this skill when working inside an `OPC LifeOS` vault. The vault is an\noperating system for a one-person company, not a generic folder taxonomy.\n\n## First Moves\n\n1. Run `opc config` to confirm the vault path and required structure.\n2. Run `opc departments` before department-level work.\n3. Use `opc dashboard` to get the correct source note, sibling `.AI.md` path and\n generation prompt.\n4. Use the `lifeos` skill for low-level note, task, search and periodic-note\n operations.\n5. Read `references/dashboard.md` before creating or updating dashboards.\n6. Read `references/department-map.md` when routing material to departments.\n\n## Operating Model\n\nThe CLI supports two official OPC LifeOS layouts. Run `opc config` first and use\nthe detected layout.\n\n| Operating name | English vault path | Chinese vault path |\n| ---------------- | --------------------- | ------------------ |\n| CEO Dashboard | `CEO Dashboard.md` | `CEO 驾驶舱.md` |\n| CEO AI Dashboard | `CEO Dashboard.AI.md` | `CEO 驾驶舱.AI.md` |\n| Periodic Notes | `0 Periodic Notes/` | `0 周期笔记/` |\n| Input Pipeline | `1 Input/` | `1 输入/` |\n| Output Pipeline | `2 Output/` | `2 输出/` |\n| Departments | `3 Departments/` | `3 部门/` |\n| Templates | `99 Templates/` | `99 模板/` |\n\nThe seven departments are:\n\n| Operating name | English vault folder | Chinese vault folder |\n| --------------------------------- | -------------------------------------- | -------------------- |\n| Digital Infrastructure Department | `01 Digital Infrastructure Department` | `01 数字基建部` |\n| Finance & Legal Department | `02 Finance & Legal Department` | `02 财务法务部` |\n| Marketing & Growth Department | `03 Marketing & Growth Department` | `03 市场增长部` |\n| Sales & Customer Department | `04 Sales & Customer Department` | `04 销售客户部` |\n| Product R&D Department | `05 Product R&D Department` | `05 产品研发部` |\n| Delivery & Operations Department | `06 Delivery & Operations Department` | `06 交付运营部` |\n| Creative & Brand Department | `07 Creative & Brand Department` | `07 创作品牌部` |\n\nDo not describe these directories as topic folders in user-facing explanations.\nThey are departments. It is acceptable for frontmatter to keep\n`type: wiki/主题` for LifeOS AI Wiki compatibility.\n\n## Agent Files\n\nEvery operating layer and department should have:\n\n- `Agent.md` — responsibility, triggers, workflow and output format.\n- `Soul.md` — principles and judgment style.\n- `Memory.md` — durable facts, decisions, recurring context and rules.\n\nBefore changing a department, read its `Agent.md`, `Soul.md` and `Memory.md`.\nAfter making a durable decision, update `Memory.md` if the decision will matter\nin future sessions.\n\n## Input/Output Collaboration\n\nUse the Input Pipeline (`1 Input/` or `1 输入/`) and Output Pipeline (`2 Output/`\nor `2 输出/`) as lifecycle layers, not departments.\n\nInput pipeline folders:\n\n| Operating state | English vault folder | Chinese vault folder |\n| --------------- | -------------------- | -------------------- |\n| Inbox | `Inbox/` | `收件箱/` |\n| Processing | `Processing/` | `处理中/` |\n| Distilled | `Distilled/` | `已提炼/` |\n| Archived | `Archive/` | `归档/` |\n\nOutput pipeline folders:\n\n| Operating state | English vault folder | Chinese vault folder |\n| ---------------- | -------------------- | -------------------- |\n| Drafts | `Drafts/` | `草稿/` |\n| Ready to Publish | `Ready to Publish/` | `待发布/` |\n| Published | `Published/` | `已发布/` |\n| Delivered | `Delivered/` | `已交付/` |\n| Reusable Assets | `Reusable Assets/` | `可复用资产/` |\n| Archived | `Archive/` | `归档/` |\n\nWhen an input or output affects a department, use the relevant `#OPC/...` tag or\nwikilinks to the relevant department. Do not duplicate the same material into\nevery department folder.\n\n## Privacy Rules\n\nOPC templates are reusable examples and must not expose the user's private life,\nreal contacts or sensitive operations.\n\nBefore adding, regenerating or publishing template content, remove or replace:\n\n- real personal names, relationship details and private life events;\n- family, parenting, health, address, travel and household details;\n- real account names, emails, phone numbers, social handles and customer\n identities;\n- absolute local paths, private vault paths and machine-specific locations;\n- API keys, tokens, activation codes, passwords, payment data and calendar\n credentials;\n- production-only deployment rules or internal operational details unless the\n user explicitly asks to keep them.\n\nUse neutral sample identities such as `Alex`, `Client A`, `Client B`, `张三`,\n`A 客户` and `B 客户`. Keep business logic, pricing examples and workflows only\nwhen they are useful to understand the OPC operating system and do not identify\nthe user.\n\n## CLI\n\nUse the local or packaged CLI:\n\n```bash\nopc config\nopc departments\nopc dashboard\nopc dashboard dept=sales\nopc dashboard dept=04\nopc skill install\n```\n\nIf running from the monorepo before publishing:\n\n```bash\npnpm -C apps/opc-cli build\nnode apps/opc-cli/bin/opc.mjs config vault=\"/path/to/OPC LifeOS\"\nnode apps/opc-cli/bin/opc.mjs skill install vault=\"/path/to/OPC LifeOS\"\n```\n\n## Writing Rules\n\n- Prefer concrete LifeOS/Aino operating examples over generic placeholders.\n- For public or shareable templates, prefer realistic but fictional examples;\n do not copy personal daily-life records into the template.\n- Do not write empty placeholder sections unless the user explicitly asks for a\n blank template.\n- Write vault content in the language already used by the target note unless the\n user explicitly asks for another language.\n- Use wikilinks for vault notes and Markdown links for external URLs.\n- Keep daily notes factual. If a note is for a future date, label entries as\n plan or forecast rather than completed fact.\n",
|
|
323
|
+
"references/commands.md": "# `opc` CLI Commands\n\n## `opc config`\n\nShow the resolved vault, whether it looks like an OPC vault, required root\nfiles, detected layout, required top-level layers and whether the `opc` /\n`lifeos` skills are installed.\n\n```bash\nopc config\nopc config --json\nopc config vault=\"/path/to/OPC LifeOS\"\n```\n\n## `opc departments`\n\nList the seven departments and whether their required files exist:\n\n- department index note\n- sibling `.AI.md`\n- `Agent.md`\n- `Soul.md`\n- `Memory.md`\n\n```bash\nopc departments\nopc departments --json\n```\n\n## `opc dashboard`\n\nPrint the correct source note, sibling `.AI.md` note and prompt for AI dashboard\ngeneration.\n\n```bash\nopc dashboard\nopc dashboard ceo\nopc dashboard dept=<department-name-or-id>\nopc dashboard dept=04\n```\n\nThe command does not generate the dashboard by itself. Use the prompt in Obsidian\nDeepask or Aino Desktop's right sidebar AI chat.\n\n## `opc skill install`\n\nInstall or update both bundled skills into the current vault:\n\n- `.agents/skills/opc/`\n- `.agents/skills/lifeos/`\n\n```bash\nopc skill install\nopc skill install vault=\"/path/to/OPC LifeOS\"\nopc skill install --opc-only\n```\n\nUse `--opc-only` only when you intentionally do not want to touch the LifeOS\nskill.\n",
|
|
324
|
+
"references/dashboard.md": "# OPC Dashboard Rules\n\nUse `.AI.md`, never `.Dashboard.md`.\n\nGenerate dashboards as sibling files:\n\n- `CEO Dashboard.md` -> `CEO Dashboard.AI.md`\n- `CEO 驾驶舱.md` -> `CEO 驾驶舱.AI.md`\n- `3 Departments/03 Marketing & Growth Department/03 Marketing & Growth Department.md` ->\n `3 Departments/03 Marketing & Growth Department/03 Marketing & Growth Department.AI.md`\n- `3 部门/03 市场增长部/03 市场增长部.md` ->\n `3 部门/03 市场增长部/03 市场增长部.AI.md`\n\n## CEO Dashboard\n\nThe CEO dashboard must include:\n\n- goals\n- revenue\n- leads\n- active projects\n- risks\n- this week's focus\n- department-by-department operating state\n\nUse the heading language already established in the target vault. Do not invent a\nnew section taxonomy unless the user explicitly asks for it.\n\nApply the OPC privacy rules before writing the dashboard: do not include private\nlife details, real personal identities, local paths, credentials, production-only\nrules or internal operational details unless the user explicitly asks to keep\nthem. Replace them with neutral sample entities such as `Alex`, `Client A`,\n`张三`, `A 客户` and fictional operating examples.\n\n## Department Dashboard\n\nDepartment dashboards must include:\n\n- one-sentence state summary\n- core judgments\n- metrics\n- material map\n- risks and blockers\n- review\n- next actions\n\nUse the heading language already established in the target vault. The dashboard\nshould drive decisions, not merely summarize past notes.\n\nApply the OPC privacy rules before writing the dashboard: do not include private\nlife details, real personal identities, local paths, credentials, production-only\nrules or internal operational details unless the user explicitly asks to keep\nthem. Replace them with neutral sample entities such as `Alex`, `Client A`,\n`张三`, `A 客户` and fictional operating examples.\n\n## Frontmatter\n\nKeep this schema for LifeOS AI Wiki compatibility:\n\n```yaml\n---\ntype: wiki/主题\nsource: '[[source department or index note]]'\ncreated: YYYY-MM-DD\nupdated: YYYY-MM-DD\n---\n```\n\nUser-facing prose should describe these pages as department dashboards or the CEO\ndashboard, not as topic pages.\n",
|
|
325
|
+
"references/department-map.md": "# OPC Department Map\n\nUse this map when routing notes, tasks and decisions.\n\n| Operating name | English folder | Chinese folder | Owns | English tag | Chinese tag |\n| --------------------------------- | -------------------------------------- | --------------- | ----------------------------------------------------------------------- | ----------------------------- | --------------- |\n| Digital Infrastructure Department | `01 Digital Infrastructure Department` | `01 数字基建部` | tool stack, automation, accounts, backup, prompts, APIs, servers | `#OPC/digital-infrastructure` | `#OPC/数字基建` |\n| Finance & Legal Department | `02 Finance & Legal Department` | `02 财务法务部` | pricing, revenue, cost, invoice, contract, tax, risk boundaries | `#OPC/finance-legal` | `#OPC/财务法务` |\n| Marketing & Growth Department | `03 Marketing & Growth Department` | `03 市场增长部` | positioning, channels, KOLs, campaigns, growth experiments | `#OPC/marketing-growth` | `#OPC/市场增长` |\n| Sales & Customer Department | `04 Sales & Customer Department` | `04 销售客户部` | leads, sales conversations, quotes, customers, follow-up, renewal | `#OPC/sales-customer` | `#OPC/销售客户` |\n| Product R&D Department | `05 Product R&D Department` | `05 产品研发部` | product packages, templates, services, automations, feedback, roadmap | `#OPC/product-rd` | `#OPC/产品研发` |\n| Delivery & Operations Department | `06 Delivery & Operations Department` | `06 交付运营部` | client projects, delivery promises, milestones, SOPs, service review | `#OPC/delivery-operations` | `#OPC/交付运营` |\n| Creative & Brand Department | `07 Creative & Brand Department` | `07 创作品牌部` | brand assets, website, cases, articles, video/podcast, content calendar | `#OPC/creative-brand` | `#OPC/创作品牌` |\n\nRouting rule:\n\n- If it is raw material, put it in the Input Pipeline (`1 Input/` or `1 输入/`)\n and tag/link the department.\n- If it is shipped work, put it in the Output Pipeline (`2 Output/` or\n `2 输出/`) and tag/link the department.\n- If it is durable operating knowledge, put it in the department folder.\n- If it changes company-level priorities, update the CEO Dashboard\n (`CEO Dashboard.md` / `CEO 驾驶舱.md`) or CEO AI Dashboard\n (`CEO Dashboard.AI.md` / `CEO 驾驶舱.AI.md`).\n",
|
|
326
|
+
};
|
|
327
|
+
|
|
328
|
+
;// CONCATENATED MODULE: ../../packages/skill-assets/dist/index.js
|
|
329
|
+
// Public API for the embedded LifeOS Skill assets.
|
|
330
|
+
//
|
|
331
|
+
// Apps install the skill into a vault by providing a `writeFile` adapter that
|
|
332
|
+
// knows how to write one vault-relative path — the Obsidian plugin uses
|
|
333
|
+
// `app.vault.adapter`, Aino uses its IPC saveFile. The skill content itself is
|
|
334
|
+
// embedded (see generated.ts) so no filesystem access to the source is needed.
|
|
335
|
+
|
|
336
|
+
|
|
337
|
+
/** Vault-relative directory the skill installs into. */
|
|
338
|
+
const LIFEOS_SKILL_DIR = '.agents/skills/lifeos';
|
|
339
|
+
const OPC_SKILL_DIR = '.agents/skills/opc';
|
|
340
|
+
/**
|
|
341
|
+
* Install (or overwrite-to-update) LifeOS Skill into a vault. Idempotent:
|
|
342
|
+
* calling again overwrites the files, which is how updating works.
|
|
343
|
+
*/
|
|
344
|
+
async function installLifeosSkill(writeFile) {
|
|
345
|
+
const written = [];
|
|
346
|
+
for (const [relPath, content] of Object.entries(LIFEOS_SKILL_FILES)) {
|
|
347
|
+
const target = `${LIFEOS_SKILL_DIR}/${relPath}`;
|
|
348
|
+
await writeFile(target, content);
|
|
349
|
+
written.push(target);
|
|
350
|
+
}
|
|
351
|
+
return { written, version: LIFEOS_SKILL_VERSION };
|
|
352
|
+
}
|
|
353
|
+
/**
|
|
354
|
+
* Install (or overwrite-to-update) OPC Skill into a vault.
|
|
355
|
+
*/
|
|
356
|
+
async function installOpcSkill(writeFile) {
|
|
357
|
+
const written = [];
|
|
358
|
+
for (const [relPath, content] of Object.entries(OPC_SKILL_FILES)) {
|
|
359
|
+
const target = `${OPC_SKILL_DIR}/${relPath}`;
|
|
360
|
+
await writeFile(target, content);
|
|
361
|
+
written.push(target);
|
|
362
|
+
}
|
|
363
|
+
return { written, version: OPC_SKILL_VERSION };
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
;// CONCATENATED MODULE: external "node:os"
|
|
367
|
+
const external_node_os_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:os");
|
|
368
|
+
;// CONCATENATED MODULE: ./dist/vault.js
|
|
369
|
+
|
|
370
|
+
|
|
371
|
+
|
|
372
|
+
const AINO_USERDATA_DIRS = ['aino-lifeos', 'aino-lifeos-dev', 'lifeos-context', 'context'];
|
|
373
|
+
const VAULT_MARKERS = ['.obsidian', '.lifeos'];
|
|
374
|
+
function expandHome(input) {
|
|
375
|
+
if (input === '~')
|
|
376
|
+
return (0,external_node_os_namespaceObject.homedir)();
|
|
377
|
+
if (input.startsWith('~/'))
|
|
378
|
+
return (0,external_node_path_namespaceObject.join)((0,external_node_os_namespaceObject.homedir)(), input.slice(2));
|
|
379
|
+
return input;
|
|
380
|
+
}
|
|
381
|
+
function toAbsolute(input, cwd) {
|
|
382
|
+
const expanded = expandHome(input.trim());
|
|
383
|
+
return (0,external_node_path_namespaceObject.isAbsolute)(expanded) ? expanded : (0,external_node_path_namespaceObject.resolve)(cwd, expanded);
|
|
384
|
+
}
|
|
385
|
+
function readAinoLastOpenedFolder() {
|
|
386
|
+
const base = (0,external_node_path_namespaceObject.join)((0,external_node_os_namespaceObject.homedir)(), 'Library', 'Application Support');
|
|
387
|
+
for (const dir of AINO_USERDATA_DIRS) {
|
|
388
|
+
const file = (0,external_node_path_namespaceObject.join)(base, dir, 'bootstrap.json');
|
|
389
|
+
if (!(0,external_node_fs_namespaceObject.existsSync)(file))
|
|
390
|
+
continue;
|
|
391
|
+
try {
|
|
392
|
+
const parsed = JSON.parse((0,external_node_fs_namespaceObject.readFileSync)(file, 'utf8'));
|
|
393
|
+
if (typeof parsed.lastOpenedFolder === 'string' && (0,external_node_fs_namespaceObject.existsSync)(parsed.lastOpenedFolder)) {
|
|
394
|
+
return parsed.lastOpenedFolder;
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
catch {
|
|
398
|
+
// Try the next Aino userData candidate.
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
return null;
|
|
402
|
+
}
|
|
403
|
+
function isVaultRoot(dir) {
|
|
404
|
+
return VAULT_MARKERS.some((marker) => (0,external_node_fs_namespaceObject.existsSync)((0,external_node_path_namespaceObject.join)(dir, marker)));
|
|
405
|
+
}
|
|
406
|
+
function walkUpForVault(startDir) {
|
|
407
|
+
let current = startDir;
|
|
408
|
+
for (;;) {
|
|
409
|
+
if (isVaultRoot(current))
|
|
410
|
+
return current;
|
|
411
|
+
const parent = (0,external_node_path_namespaceObject.dirname)(current);
|
|
412
|
+
if (parent === current)
|
|
413
|
+
return null;
|
|
414
|
+
current = parent;
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
function resolveVault(explicitVault, cwd = process.cwd()) {
|
|
418
|
+
if (explicitVault) {
|
|
419
|
+
return { root: toAbsolute(explicitVault, cwd), source: 'option' };
|
|
420
|
+
}
|
|
421
|
+
const env = process.env.OPC_VAULT || process.env.LIFEOS_VAULT;
|
|
422
|
+
if (env?.trim()) {
|
|
423
|
+
return { root: toAbsolute(env, cwd), source: 'env' };
|
|
424
|
+
}
|
|
425
|
+
const walked = walkUpForVault(cwd);
|
|
426
|
+
if (walked) {
|
|
427
|
+
return { root: walked, source: 'cwd-walk' };
|
|
428
|
+
}
|
|
429
|
+
const aino = readAinoLastOpenedFolder();
|
|
430
|
+
if (aino) {
|
|
431
|
+
return { root: aino, source: 'aino-bootstrap' };
|
|
432
|
+
}
|
|
433
|
+
throw new Error('Could not locate an OPC LifeOS vault. Pass `vault=<path>`, set $OPC_VAULT, open a vault in Aino, ' +
|
|
434
|
+
'or run from inside a vault containing .obsidian/ or .lifeos/.');
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
;// CONCATENATED MODULE: ./dist/commands/skill-install.js
|
|
438
|
+
|
|
439
|
+
|
|
440
|
+
|
|
441
|
+
|
|
442
|
+
|
|
443
|
+
async function runSkillInstall(args) {
|
|
444
|
+
const vault = resolveVault(args.opts.vault);
|
|
445
|
+
const writeSkillFile = async (relPath, content) => {
|
|
446
|
+
const abs = (0,external_node_path_namespaceObject.join)(vault.root, relPath);
|
|
447
|
+
await (0,promises_namespaceObject.mkdir)((0,external_node_path_namespaceObject.dirname)(abs), { recursive: true });
|
|
448
|
+
await (0,promises_namespaceObject.writeFile)(abs, content);
|
|
449
|
+
};
|
|
450
|
+
const opc = await installOpcSkill(writeSkillFile);
|
|
451
|
+
const lifeos = args.flags.has('opc-only') ? undefined : await installLifeosSkill(writeSkillFile);
|
|
452
|
+
emitLines([
|
|
453
|
+
`Installed opc skill v${opc.version} into ${OPC_SKILL_DIR}/`,
|
|
454
|
+
...opc.written.map((p) => ` ${p}`),
|
|
455
|
+
...(lifeos
|
|
456
|
+
? [
|
|
457
|
+
'',
|
|
458
|
+
`Installed lifeos skill v${lifeos.version} into ${LIFEOS_SKILL_DIR}/`,
|
|
459
|
+
...lifeos.written.map((p) => ` ${p}`),
|
|
460
|
+
]
|
|
461
|
+
: []),
|
|
462
|
+
'',
|
|
463
|
+
'Your agent can now use the opc skill. Run `opc skill install` again after upgrading the CLI to update it.',
|
|
464
|
+
]);
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
;// CONCATENATED MODULE: ./dist/cli.js
|
|
468
|
+
|
|
469
|
+
|
|
470
|
+
|
|
471
|
+
|
|
472
|
+
|
|
473
|
+
|
|
474
|
+
const VERSION = '0.1.0';
|
|
475
|
+
function helpText() {
|
|
476
|
+
return [
|
|
477
|
+
`opc v${VERSION} — operate an OPC LifeOS vault from the command line`,
|
|
478
|
+
'',
|
|
479
|
+
'Usage:',
|
|
480
|
+
' opc <command> [key=value ...] [--json]',
|
|
481
|
+
'',
|
|
482
|
+
'Commands:',
|
|
483
|
+
' config Show OPC vault structure and skill status',
|
|
484
|
+
' departments List the seven OPC departments and required files',
|
|
485
|
+
' dashboard [ceo|<department>] Print the source/.AI.md paths and AI generation prompt',
|
|
486
|
+
' skill install Install/update bundled opc + lifeos skills into the vault',
|
|
487
|
+
' help Show this help',
|
|
488
|
+
'',
|
|
489
|
+
'Vault selection (first match wins):',
|
|
490
|
+
' vault=<path> Explicit vault root',
|
|
491
|
+
' $OPC_VAULT Env var',
|
|
492
|
+
' $LIFEOS_VAULT Fallback env var',
|
|
493
|
+
' cwd walk-up Nearest parent containing .obsidian/ or .lifeos/',
|
|
494
|
+
' Aino last-opened folder Read from Aino bootstrap.json',
|
|
495
|
+
'',
|
|
496
|
+
'Examples:',
|
|
497
|
+
' opc config vault="/path/to/OPC LifeOS"',
|
|
498
|
+
' opc departments --json',
|
|
499
|
+
' opc dashboard dept=sales',
|
|
500
|
+
' opc skill install',
|
|
501
|
+
].join('\n');
|
|
502
|
+
}
|
|
503
|
+
async function run(argv) {
|
|
504
|
+
const args = parseArgs(argv);
|
|
505
|
+
if (args.command === 'help' || args.flags.has('help')) {
|
|
506
|
+
console.log(helpText());
|
|
507
|
+
return;
|
|
508
|
+
}
|
|
509
|
+
if (args.command === 'version' || args.flags.has('version')) {
|
|
510
|
+
console.log(VERSION);
|
|
511
|
+
return;
|
|
512
|
+
}
|
|
513
|
+
try {
|
|
514
|
+
switch (args.command) {
|
|
515
|
+
case 'skill':
|
|
516
|
+
if (args.sub === 'install' || args.positionals[0] === 'install') {
|
|
517
|
+
return await runSkillInstall(args);
|
|
518
|
+
}
|
|
519
|
+
console.error('Unknown skill command. Run `opc skill install` to install/update the bundled skills.');
|
|
520
|
+
process.exitCode = 1;
|
|
521
|
+
return;
|
|
522
|
+
case 'config':
|
|
523
|
+
case 'departments':
|
|
524
|
+
case 'dashboard': {
|
|
525
|
+
const vault = resolveVault(args.opts.vault);
|
|
526
|
+
if (args.command === 'config')
|
|
527
|
+
return await runConfig(args, vault);
|
|
528
|
+
if (args.command === 'departments')
|
|
529
|
+
return await runDepartments(args, vault);
|
|
530
|
+
return await runDashboard(args, vault);
|
|
531
|
+
}
|
|
532
|
+
default:
|
|
533
|
+
console.error(`Unknown command "${args.command}". Run \`opc help\` for usage.`);
|
|
534
|
+
process.exitCode = 1;
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
catch (err) {
|
|
538
|
+
console.error(err instanceof Error ? err.message : String(err));
|
|
539
|
+
process.exitCode = 1;
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
;// CONCATENATED MODULE: ./bin/opc.mjs
|
|
544
|
+
|
|
545
|
+
|
|
546
|
+
run(process.argv.slice(2)).catch((err) => {
|
|
547
|
+
console.error(err?.message ?? err);
|
|
548
|
+
process.exit(1);
|
|
549
|
+
});
|
|
550
|
+
|
package/package.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@life-os/opc-cli",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Headless OPC LifeOS CLI for one-person-company vault operations",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"files": [
|
|
7
|
+
"dist/opc.mjs",
|
|
8
|
+
"README.md"
|
|
9
|
+
],
|
|
10
|
+
"bin": {
|
|
11
|
+
"opc": "dist/opc.mjs"
|
|
12
|
+
},
|
|
13
|
+
"engines": {
|
|
14
|
+
"node": ">=18"
|
|
15
|
+
},
|
|
16
|
+
"publishConfig": {
|
|
17
|
+
"access": "public",
|
|
18
|
+
"registry": "https://registry.npmjs.org"
|
|
19
|
+
}
|
|
20
|
+
}
|