lokuma-cli 1.4.2 → 1.4.4
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/index.js +55 -20
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -54,21 +54,20 @@ var AI_DISPLAY_NAMES = {
|
|
|
54
54
|
all: "All assistants"
|
|
55
55
|
};
|
|
56
56
|
var AI_SKILL_PATHS = {
|
|
57
|
-
claude: { root: "
|
|
58
|
-
cursor: { root: "
|
|
59
|
-
windsurf: { root: "
|
|
60
|
-
copilot: { root: "
|
|
61
|
-
kiro: { root: "
|
|
62
|
-
roocode: { root: "
|
|
63
|
-
codex: { root: "
|
|
64
|
-
qoder: { root: "
|
|
65
|
-
gemini: { root: "
|
|
66
|
-
trae: { root: "
|
|
67
|
-
opencode: { root: "
|
|
68
|
-
continue: { root: "
|
|
69
|
-
codebuddy: { root: "
|
|
70
|
-
droid: { root: "
|
|
71
|
-
// OpenClaw installs to a fixed absolute path (not relative to cwd)
|
|
57
|
+
claude: { root: "~/.claude/skills/lokuma", skillMd: "~/.claude/skills/lokuma/SKILL.md", scriptPy: "~/.claude/skills/lokuma/scripts/design.py" },
|
|
58
|
+
cursor: { root: "~/.cursor/skills/lokuma", skillMd: "~/.cursor/skills/lokuma/SKILL.md", scriptPy: "~/.cursor/skills/lokuma/scripts/design.py" },
|
|
59
|
+
windsurf: { root: "~/.windsurf/skills/lokuma", skillMd: "~/.windsurf/skills/lokuma/SKILL.md", scriptPy: "~/.windsurf/skills/lokuma/scripts/design.py" },
|
|
60
|
+
copilot: { root: "~/.github/skills/lokuma", skillMd: "~/.github/skills/lokuma/SKILL.md", scriptPy: "~/.github/skills/lokuma/scripts/design.py" },
|
|
61
|
+
kiro: { root: "~/.kiro/skills/lokuma", skillMd: "~/.kiro/skills/lokuma/SKILL.md", scriptPy: "~/.kiro/skills/lokuma/scripts/design.py" },
|
|
62
|
+
roocode: { root: "~/.roo/skills/lokuma", skillMd: "~/.roo/skills/lokuma/SKILL.md", scriptPy: "~/.roo/skills/lokuma/scripts/design.py" },
|
|
63
|
+
codex: { root: "~/.codex/skills/lokuma", skillMd: "~/.codex/skills/lokuma/SKILL.md", scriptPy: "~/.codex/skills/lokuma/scripts/design.py" },
|
|
64
|
+
qoder: { root: "~/.qoder/skills/lokuma", skillMd: "~/.qoder/skills/lokuma/SKILL.md", scriptPy: "~/.qoder/skills/lokuma/scripts/design.py" },
|
|
65
|
+
gemini: { root: "~/.gemini/skills/lokuma", skillMd: "~/.gemini/skills/lokuma/SKILL.md", scriptPy: "~/.gemini/skills/lokuma/scripts/design.py" },
|
|
66
|
+
trae: { root: "~/.trae/skills/lokuma", skillMd: "~/.trae/skills/lokuma/SKILL.md", scriptPy: "~/.trae/skills/lokuma/scripts/design.py" },
|
|
67
|
+
opencode: { root: "~/.opencode/skills/lokuma", skillMd: "~/.opencode/skills/lokuma/SKILL.md", scriptPy: "~/.opencode/skills/lokuma/scripts/design.py" },
|
|
68
|
+
continue: { root: "~/.continue/skills/lokuma", skillMd: "~/.continue/skills/lokuma/SKILL.md", scriptPy: "~/.continue/skills/lokuma/scripts/design.py" },
|
|
69
|
+
codebuddy: { root: "~/.codebuddy/skills/lokuma", skillMd: "~/.codebuddy/skills/lokuma/SKILL.md", scriptPy: "~/.codebuddy/skills/lokuma/scripts/design.py" },
|
|
70
|
+
droid: { root: "~/.factory/skills/lokuma", skillMd: "~/.factory/skills/lokuma/SKILL.md", scriptPy: "~/.factory/skills/lokuma/scripts/design.py" },
|
|
72
71
|
openclaw: { root: "~/.openclaw/workspace/skills/lokuma", skillMd: "~/.openclaw/workspace/skills/lokuma/SKILL.md", scriptPy: "~/.openclaw/workspace/skills/lokuma/scripts/design.py" }
|
|
73
72
|
};
|
|
74
73
|
|
|
@@ -81,8 +80,11 @@ function resolvePath(p) {
|
|
|
81
80
|
if (p.startsWith("~/")) return join(homedir(), p.slice(2));
|
|
82
81
|
return p;
|
|
83
82
|
}
|
|
84
|
-
function buildSkillMd(scriptPath) {
|
|
85
|
-
|
|
83
|
+
function buildSkillMd(scriptPath, apiKey) {
|
|
84
|
+
const keyLine = apiKey ? `LOKUMA_API_KEY = ${apiKey}
|
|
85
|
+
|
|
86
|
+
` : "";
|
|
87
|
+
return `${keyLine}---
|
|
86
88
|
name: frontend-designer
|
|
87
89
|
description: >
|
|
88
90
|
Lokuma design intelligence. Use this skill whenever building or modifying UI:
|
|
@@ -240,7 +242,8 @@ async function initCommand(options) {
|
|
|
240
242
|
}
|
|
241
243
|
await mkdir(dirname(paths.skillMd), { recursive: true });
|
|
242
244
|
await mkdir(dirname(paths.scriptPy), { recursive: true });
|
|
243
|
-
|
|
245
|
+
const apiKey = process.env.LOKUMA_API_KEY ?? "";
|
|
246
|
+
await writeFile(paths.skillMd, buildSkillMd(paths.scriptPy, apiKey), "utf-8");
|
|
244
247
|
await writeFile(paths.scriptPy, DESIGN_PY, "utf-8");
|
|
245
248
|
installed.push({ name: AI_DISPLAY_NAMES[t], skillMd: paths.skillMd, scriptPy: paths.scriptPy });
|
|
246
249
|
}
|
|
@@ -275,8 +278,36 @@ async function initCommand(options) {
|
|
|
275
278
|
// src/commands/auth.ts
|
|
276
279
|
import { writeFileSync, readFileSync as readFileSync2, existsSync, mkdirSync } from "node:fs";
|
|
277
280
|
import { dirname as dirname2, join as join2 } from "node:path";
|
|
281
|
+
import { homedir as homedir2 } from "node:os";
|
|
278
282
|
import { createInterface } from "node:readline";
|
|
279
283
|
import chalk2 from "chalk";
|
|
284
|
+
function resolvePath2(p) {
|
|
285
|
+
if (p.startsWith("~/")) return join2(homedir2(), p.slice(2));
|
|
286
|
+
return p;
|
|
287
|
+
}
|
|
288
|
+
function updateSkillMdKey(skillMdPath, key) {
|
|
289
|
+
if (!existsSync(skillMdPath)) return false;
|
|
290
|
+
let content = readFileSync2(skillMdPath, "utf-8");
|
|
291
|
+
if (content.startsWith("LOKUMA_API_KEY =")) {
|
|
292
|
+
content = content.replace(/^LOKUMA_API_KEY = .+\n\n?/, `LOKUMA_API_KEY = ${key}
|
|
293
|
+
|
|
294
|
+
`);
|
|
295
|
+
} else {
|
|
296
|
+
content = `LOKUMA_API_KEY = ${key}
|
|
297
|
+
|
|
298
|
+
` + content;
|
|
299
|
+
}
|
|
300
|
+
writeFileSync(skillMdPath, content, "utf-8");
|
|
301
|
+
return true;
|
|
302
|
+
}
|
|
303
|
+
function updateAllSkillMds(key) {
|
|
304
|
+
const updated = [];
|
|
305
|
+
for (const t of AI_TYPES.filter((t2) => t2 !== "all")) {
|
|
306
|
+
const p = resolvePath2(AI_SKILL_PATHS[t].skillMd);
|
|
307
|
+
if (updateSkillMdKey(p, key)) updated.push(p);
|
|
308
|
+
}
|
|
309
|
+
return updated;
|
|
310
|
+
}
|
|
280
311
|
function detectShellRc() {
|
|
281
312
|
const shell = process.env.SHELL ?? "";
|
|
282
313
|
const home = process.env.HOME ?? "";
|
|
@@ -337,7 +368,7 @@ async function prompt(question, hidden = false) {
|
|
|
337
368
|
async function authLoginCommand() {
|
|
338
369
|
console.log();
|
|
339
370
|
console.log(chalk2.bold(" Lokuma \u2014 API Key Setup"));
|
|
340
|
-
console.log(chalk2.dim(" Get your key at https://lokuma.ai"));
|
|
371
|
+
console.log(chalk2.dim(" Get your key at https://agent.lokuma.ai"));
|
|
341
372
|
console.log();
|
|
342
373
|
const existing = process.env.LOKUMA_API_KEY;
|
|
343
374
|
if (existing) {
|
|
@@ -358,14 +389,18 @@ async function authLoginCommand() {
|
|
|
358
389
|
}
|
|
359
390
|
if (!key.startsWith("lokuma_")) {
|
|
360
391
|
console.log(chalk2.red(" \u2717 Invalid key format (should start with lokuma_)"));
|
|
361
|
-
console.log(chalk2.dim(" Visit https://lokuma.ai to get a valid key."));
|
|
392
|
+
console.log(chalk2.dim(" Visit https://agent.lokuma.ai to get a valid key."));
|
|
362
393
|
console.log();
|
|
363
394
|
process.exit(1);
|
|
364
395
|
}
|
|
365
396
|
const rc = persistKey(key);
|
|
397
|
+
const updated = updateAllSkillMds(key);
|
|
366
398
|
console.log();
|
|
367
399
|
console.log(chalk2.green(" \u2713 API key saved!"));
|
|
368
400
|
console.log(chalk2.dim(` Written to: ${rc}`));
|
|
401
|
+
if (updated.length > 0) {
|
|
402
|
+
console.log(chalk2.dim(` Updated ${updated.length} SKILL.md file(s) with new key.`));
|
|
403
|
+
}
|
|
369
404
|
console.log();
|
|
370
405
|
console.log(chalk2.dim(" Reload your shell to apply:"));
|
|
371
406
|
console.log(chalk2.cyan(` source ${rc}`));
|