@life-os/cli 0.1.0 → 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/dist/lifeos.mjs +109 -74
- package/package.json +1 -1
package/dist/lifeos.mjs
CHANGED
|
@@ -4730,9 +4730,9 @@ function queryTaskFacets(model, config) {
|
|
|
4730
4730
|
if (task.section) {
|
|
4731
4731
|
headers.add(task.section);
|
|
4732
4732
|
}
|
|
4733
|
-
const
|
|
4734
|
-
if (
|
|
4735
|
-
paths.add(
|
|
4733
|
+
const dirname4 = getDirname(task.file);
|
|
4734
|
+
if (dirname4) {
|
|
4735
|
+
paths.add(dirname4);
|
|
4736
4736
|
}
|
|
4737
4737
|
for (const tag of task.tags ?? []) {
|
|
4738
4738
|
const normalizedTag = normalizeTag(tag);
|
|
@@ -6274,6 +6274,107 @@ async function runSearch(args, vault) {
|
|
|
6274
6274
|
return emitLines(files.map((f) => `${f.name} \u2014 ${f.path}`));
|
|
6275
6275
|
}
|
|
6276
6276
|
|
|
6277
|
+
// dist/commands/skill-install.js
|
|
6278
|
+
import { cpSync, existsSync as existsSync4, mkdirSync } from "node:fs";
|
|
6279
|
+
import { dirname as dirname3, join as join6 } from "node:path";
|
|
6280
|
+
import { fileURLToPath } from "node:url";
|
|
6281
|
+
|
|
6282
|
+
// dist/vault.js
|
|
6283
|
+
import { existsSync as existsSync3, readFileSync } from "node:fs";
|
|
6284
|
+
import { homedir as homedir2 } from "node:os";
|
|
6285
|
+
import { dirname as dirname2, isAbsolute as isAbsolute3, join as join5, resolve as resolve2 } from "node:path";
|
|
6286
|
+
var AINO_USERDATA_DIRS = ["aino-lifeos", "aino-lifeos-dev", "lifeos-context", "context"];
|
|
6287
|
+
var VAULT_MARKERS = [".obsidian", ".lifeos"];
|
|
6288
|
+
function expandHome(input) {
|
|
6289
|
+
if (input === "~")
|
|
6290
|
+
return homedir2();
|
|
6291
|
+
if (input.startsWith("~/"))
|
|
6292
|
+
return join5(homedir2(), input.slice(2));
|
|
6293
|
+
return input;
|
|
6294
|
+
}
|
|
6295
|
+
function toAbsolute(input, cwd) {
|
|
6296
|
+
const expanded = expandHome(input.trim());
|
|
6297
|
+
return isAbsolute3(expanded) ? expanded : resolve2(cwd, expanded);
|
|
6298
|
+
}
|
|
6299
|
+
function appSupportDir() {
|
|
6300
|
+
return join5(homedir2(), "Library", "Application Support");
|
|
6301
|
+
}
|
|
6302
|
+
function readAinoLastOpenedFolder() {
|
|
6303
|
+
const base = appSupportDir();
|
|
6304
|
+
for (const dir of AINO_USERDATA_DIRS) {
|
|
6305
|
+
const file = join5(base, dir, "bootstrap.json");
|
|
6306
|
+
if (!existsSync3(file))
|
|
6307
|
+
continue;
|
|
6308
|
+
try {
|
|
6309
|
+
const parsed = JSON.parse(readFileSync(file, "utf8"));
|
|
6310
|
+
const folder = parsed?.lastOpenedFolder;
|
|
6311
|
+
if (typeof folder === "string" && folder.trim() && existsSync3(folder)) {
|
|
6312
|
+
return folder;
|
|
6313
|
+
}
|
|
6314
|
+
} catch {
|
|
6315
|
+
}
|
|
6316
|
+
}
|
|
6317
|
+
return null;
|
|
6318
|
+
}
|
|
6319
|
+
function isVaultRoot(dir) {
|
|
6320
|
+
return VAULT_MARKERS.some((marker) => existsSync3(join5(dir, marker)));
|
|
6321
|
+
}
|
|
6322
|
+
function walkUpForVault(startDir) {
|
|
6323
|
+
let current = startDir;
|
|
6324
|
+
for (; ; ) {
|
|
6325
|
+
if (isVaultRoot(current))
|
|
6326
|
+
return current;
|
|
6327
|
+
const parent = dirname2(current);
|
|
6328
|
+
if (parent === current)
|
|
6329
|
+
return null;
|
|
6330
|
+
current = parent;
|
|
6331
|
+
}
|
|
6332
|
+
}
|
|
6333
|
+
function resolveVault(explicitVault, cwd = process.cwd()) {
|
|
6334
|
+
if (explicitVault) {
|
|
6335
|
+
return { root: toAbsolute(explicitVault, cwd), source: "option" };
|
|
6336
|
+
}
|
|
6337
|
+
const env = process.env.LIFEOS_VAULT;
|
|
6338
|
+
if (env?.trim()) {
|
|
6339
|
+
return { root: toAbsolute(env, cwd), source: "env" };
|
|
6340
|
+
}
|
|
6341
|
+
const walked = walkUpForVault(cwd);
|
|
6342
|
+
if (walked) {
|
|
6343
|
+
return { root: walked, source: "cwd-walk" };
|
|
6344
|
+
}
|
|
6345
|
+
const aino = readAinoLastOpenedFolder();
|
|
6346
|
+
if (aino) {
|
|
6347
|
+
return { root: aino, source: "aino-bootstrap" };
|
|
6348
|
+
}
|
|
6349
|
+
throw new Error("Could not locate a LifeOS vault. Pass `vault=<path>`, set $LIFEOS_VAULT, open a vault in Aino, or run from inside a vault (a folder containing .obsidian/ or .lifeos/).");
|
|
6350
|
+
}
|
|
6351
|
+
|
|
6352
|
+
// dist/commands/skill-install.js
|
|
6353
|
+
var SKILL_DIR = ".agents/skills/lifeos";
|
|
6354
|
+
function findSkillSource() {
|
|
6355
|
+
const thisFile = fileURLToPath(import.meta.url);
|
|
6356
|
+
const distDir = dirname3(dirname3(thisFile));
|
|
6357
|
+
return join6(distDir, "..", "skill");
|
|
6358
|
+
}
|
|
6359
|
+
function runSkillInstall(args) {
|
|
6360
|
+
const skillSrc = findSkillSource();
|
|
6361
|
+
if (!existsSync4(skillSrc)) {
|
|
6362
|
+
throw new Error(`Skill source not found at ${skillSrc}. Reinstall @life-os/cli.`);
|
|
6363
|
+
}
|
|
6364
|
+
const vault = resolveVault(args.opts.vault);
|
|
6365
|
+
const dst = join6(vault.root, SKILL_DIR);
|
|
6366
|
+
mkdirSync(dst, { recursive: true });
|
|
6367
|
+
cpSync(skillSrc, dst, { recursive: true });
|
|
6368
|
+
emitLines([
|
|
6369
|
+
`Installed lifeos skill into ${SKILL_DIR}/`,
|
|
6370
|
+
` ${join6(SKILL_DIR, "SKILL.md")}`,
|
|
6371
|
+
` ${join6(SKILL_DIR, "references/commands.md")}`,
|
|
6372
|
+
"",
|
|
6373
|
+
"Your agent can now use the lifeos skill.",
|
|
6374
|
+
`Run \`npx -y @life-os/cli skill install\` again after upgrading the CLI.`
|
|
6375
|
+
]);
|
|
6376
|
+
}
|
|
6377
|
+
|
|
6277
6378
|
// dist/commands/task.js
|
|
6278
6379
|
function parseRef(ref) {
|
|
6279
6380
|
const match = /^(.*):(\d+)$/.exec(ref.trim());
|
|
@@ -6437,78 +6538,8 @@ function friendlyError(err) {
|
|
|
6437
6538
|
return MESSAGES[raw] ?? raw;
|
|
6438
6539
|
}
|
|
6439
6540
|
|
|
6440
|
-
// dist/vault.js
|
|
6441
|
-
import { existsSync as existsSync3, readFileSync } from "node:fs";
|
|
6442
|
-
import { homedir as homedir2 } from "node:os";
|
|
6443
|
-
import { dirname as dirname2, isAbsolute as isAbsolute3, join as join5, resolve as resolve2 } from "node:path";
|
|
6444
|
-
var AINO_USERDATA_DIRS = ["aino-lifeos", "aino-lifeos-dev", "lifeos-context", "context"];
|
|
6445
|
-
var VAULT_MARKERS = [".obsidian", ".lifeos"];
|
|
6446
|
-
function expandHome(input) {
|
|
6447
|
-
if (input === "~")
|
|
6448
|
-
return homedir2();
|
|
6449
|
-
if (input.startsWith("~/"))
|
|
6450
|
-
return join5(homedir2(), input.slice(2));
|
|
6451
|
-
return input;
|
|
6452
|
-
}
|
|
6453
|
-
function toAbsolute(input, cwd) {
|
|
6454
|
-
const expanded = expandHome(input.trim());
|
|
6455
|
-
return isAbsolute3(expanded) ? expanded : resolve2(cwd, expanded);
|
|
6456
|
-
}
|
|
6457
|
-
function appSupportDir() {
|
|
6458
|
-
return join5(homedir2(), "Library", "Application Support");
|
|
6459
|
-
}
|
|
6460
|
-
function readAinoLastOpenedFolder() {
|
|
6461
|
-
const base = appSupportDir();
|
|
6462
|
-
for (const dir of AINO_USERDATA_DIRS) {
|
|
6463
|
-
const file = join5(base, dir, "bootstrap.json");
|
|
6464
|
-
if (!existsSync3(file))
|
|
6465
|
-
continue;
|
|
6466
|
-
try {
|
|
6467
|
-
const parsed = JSON.parse(readFileSync(file, "utf8"));
|
|
6468
|
-
const folder = parsed?.lastOpenedFolder;
|
|
6469
|
-
if (typeof folder === "string" && folder.trim() && existsSync3(folder)) {
|
|
6470
|
-
return folder;
|
|
6471
|
-
}
|
|
6472
|
-
} catch {
|
|
6473
|
-
}
|
|
6474
|
-
}
|
|
6475
|
-
return null;
|
|
6476
|
-
}
|
|
6477
|
-
function isVaultRoot(dir) {
|
|
6478
|
-
return VAULT_MARKERS.some((marker) => existsSync3(join5(dir, marker)));
|
|
6479
|
-
}
|
|
6480
|
-
function walkUpForVault(startDir) {
|
|
6481
|
-
let current = startDir;
|
|
6482
|
-
for (; ; ) {
|
|
6483
|
-
if (isVaultRoot(current))
|
|
6484
|
-
return current;
|
|
6485
|
-
const parent = dirname2(current);
|
|
6486
|
-
if (parent === current)
|
|
6487
|
-
return null;
|
|
6488
|
-
current = parent;
|
|
6489
|
-
}
|
|
6490
|
-
}
|
|
6491
|
-
function resolveVault(explicitVault, cwd = process.cwd()) {
|
|
6492
|
-
if (explicitVault) {
|
|
6493
|
-
return { root: toAbsolute(explicitVault, cwd), source: "option" };
|
|
6494
|
-
}
|
|
6495
|
-
const env = process.env.LIFEOS_VAULT;
|
|
6496
|
-
if (env?.trim()) {
|
|
6497
|
-
return { root: toAbsolute(env, cwd), source: "env" };
|
|
6498
|
-
}
|
|
6499
|
-
const walked = walkUpForVault(cwd);
|
|
6500
|
-
if (walked) {
|
|
6501
|
-
return { root: walked, source: "cwd-walk" };
|
|
6502
|
-
}
|
|
6503
|
-
const aino = readAinoLastOpenedFolder();
|
|
6504
|
-
if (aino) {
|
|
6505
|
-
return { root: aino, source: "aino-bootstrap" };
|
|
6506
|
-
}
|
|
6507
|
-
throw new Error("Could not locate a LifeOS vault. Pass `vault=<path>`, set $LIFEOS_VAULT, open a vault in Aino, or run from inside a vault (a folder containing .obsidian/ or .lifeos/).");
|
|
6508
|
-
}
|
|
6509
|
-
|
|
6510
6541
|
// dist/cli.js
|
|
6511
|
-
var VERSION = "0.1.
|
|
6542
|
+
var VERSION = "0.1.1";
|
|
6512
6543
|
function helpText() {
|
|
6513
6544
|
return [
|
|
6514
6545
|
`lifeos v${VERSION} \u2014 read & query your LifeOS vault from the command line`,
|
|
@@ -6528,6 +6559,7 @@ function helpText() {
|
|
|
6528
6559
|
" append path=<p> content=<t> Append text to an existing note",
|
|
6529
6560
|
" create path=<p> [content=] Create a note (add overwrite to replace)",
|
|
6530
6561
|
" task done|todo ref=<f>:<n> Toggle a task by its file:line reference",
|
|
6562
|
+
" skill install [vault=<path>] Install/update the lifeos skill into .agents/skills/",
|
|
6531
6563
|
" help Show this help",
|
|
6532
6564
|
"",
|
|
6533
6565
|
"Vault selection (first match wins):",
|
|
@@ -6572,6 +6604,9 @@ async function run(argv) {
|
|
|
6572
6604
|
return await runTask(args, vault);
|
|
6573
6605
|
case "theme":
|
|
6574
6606
|
return await runTheme(args, vault);
|
|
6607
|
+
case "skill":
|
|
6608
|
+
runSkillInstall(args);
|
|
6609
|
+
return;
|
|
6575
6610
|
default:
|
|
6576
6611
|
console.error(`Unknown command "${args.command}". Run \`lifeos help\` for usage.`);
|
|
6577
6612
|
process.exitCode = 1;
|