lokuma-cli 1.4.5 → 1.4.7
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/assets/design.py +15 -1
- package/dist/index.js +13 -26
- package/package.json +1 -1
package/assets/design.py
CHANGED
|
@@ -48,11 +48,25 @@ _BASE = f"{API_BASE}/{API_VERSION}"
|
|
|
48
48
|
|
|
49
49
|
|
|
50
50
|
def _get_api_key() -> str:
|
|
51
|
+
# 1. Try ~/.lokuma/config.json first
|
|
52
|
+
config_path = os.path.expanduser("~/.lokuma/config.json")
|
|
53
|
+
if os.path.exists(config_path):
|
|
54
|
+
try:
|
|
55
|
+
with open(config_path, "r") as f:
|
|
56
|
+
config = json.loads(f.read())
|
|
57
|
+
key = config.get("apiKey", "").strip()
|
|
58
|
+
if key:
|
|
59
|
+
return key
|
|
60
|
+
except Exception:
|
|
61
|
+
pass
|
|
62
|
+
|
|
63
|
+
# 2. Fallback to environment variable
|
|
51
64
|
key = os.environ.get("LOKUMA_API_KEY", "").strip()
|
|
52
65
|
if not key:
|
|
53
66
|
print(
|
|
54
67
|
"Error: LOKUMA_API_KEY is not set.\n"
|
|
55
|
-
"
|
|
68
|
+
"Run: lokuma auth login\n"
|
|
69
|
+
"Or: export LOKUMA_API_KEY=lokuma_your_key_here\n"
|
|
56
70
|
"Get your key at https://agent.lokuma.ai",
|
|
57
71
|
file=sys.stderr,
|
|
58
72
|
)
|
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import { Command } from "commander";
|
|
5
5
|
import { readFileSync as readFileSync3 } from "fs";
|
|
6
6
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
7
|
-
import { dirname as
|
|
7
|
+
import { dirname as dirname2, join as join3 } from "path";
|
|
8
8
|
|
|
9
9
|
// src/commands/init.ts
|
|
10
10
|
import { mkdir, writeFile, access } from "node:fs/promises";
|
|
@@ -84,9 +84,7 @@ function buildSkillMd(scriptPath, apiKey) {
|
|
|
84
84
|
const keyLine = apiKey ? `LOKUMA_API_KEY = ${apiKey}
|
|
85
85
|
|
|
86
86
|
` : "";
|
|
87
|
-
return `${keyLine}
|
|
88
|
-
|
|
89
|
-
---
|
|
87
|
+
return `${keyLine}---
|
|
90
88
|
name: frontend-designer
|
|
91
89
|
description: >
|
|
92
90
|
Lokuma design intelligence. Use this skill whenever building or modifying UI:
|
|
@@ -201,6 +199,10 @@ Before shipping UI code, verify:
|
|
|
201
199
|
- [ ] Motion feels intentional, not noisy
|
|
202
200
|
- [ ] Icons are consistent and non-emoji
|
|
203
201
|
- [ ] The UI matches the user's product, audience, and brand tone
|
|
202
|
+
|
|
203
|
+
---
|
|
204
|
+
|
|
205
|
+
> \u26A0\uFE0F Fetching the design style takes ~30 seconds. You MUST wait for the full design recommendation before generating any code!
|
|
204
206
|
`;
|
|
205
207
|
}
|
|
206
208
|
async function exists(path) {
|
|
@@ -279,7 +281,7 @@ async function initCommand(options) {
|
|
|
279
281
|
|
|
280
282
|
// src/commands/auth.ts
|
|
281
283
|
import { writeFileSync, readFileSync as readFileSync2, existsSync, mkdirSync } from "node:fs";
|
|
282
|
-
import {
|
|
284
|
+
import { join as join2 } from "node:path";
|
|
283
285
|
import { homedir as homedir2 } from "node:os";
|
|
284
286
|
import { createInterface } from "node:readline";
|
|
285
287
|
import chalk2 from "chalk";
|
|
@@ -310,27 +312,12 @@ function updateAllSkillMds(key) {
|
|
|
310
312
|
}
|
|
311
313
|
return updated;
|
|
312
314
|
}
|
|
313
|
-
function detectShellRc() {
|
|
314
|
-
const shell = process.env.SHELL ?? "";
|
|
315
|
-
const home = process.env.HOME ?? "";
|
|
316
|
-
if (shell.includes("zsh")) return join2(home, ".zshrc");
|
|
317
|
-
if (shell.includes("bash")) return process.platform === "darwin" ? join2(home, ".bash_profile") : join2(home, ".bashrc");
|
|
318
|
-
return join2(home, ".profile");
|
|
319
|
-
}
|
|
320
315
|
function persistKey(key) {
|
|
321
|
-
const
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
export LOKUMA_API_KEY="${key}"
|
|
327
|
-
`;
|
|
328
|
-
writeFileSync(rc, content, "utf-8");
|
|
329
|
-
const envFile = join2(process.env.HOME ?? "", ".lokuma");
|
|
330
|
-
mkdirSync(dirname2(envFile), { recursive: true });
|
|
331
|
-
writeFileSync(envFile, `LOKUMA_API_KEY=${key}
|
|
332
|
-
`, "utf-8");
|
|
333
|
-
return rc;
|
|
316
|
+
const configDir = join2(homedir2(), ".lokuma");
|
|
317
|
+
const configFile = join2(configDir, "config.json");
|
|
318
|
+
mkdirSync(configDir, { recursive: true });
|
|
319
|
+
writeFileSync(configFile, JSON.stringify({ apiKey: key }, null, 2) + "\n", { mode: 384 });
|
|
320
|
+
return configFile;
|
|
334
321
|
}
|
|
335
322
|
async function prompt(question, hidden = false) {
|
|
336
323
|
return new Promise((resolve) => {
|
|
@@ -439,7 +426,7 @@ async function updateCommand(options = {}) {
|
|
|
439
426
|
|
|
440
427
|
// src/index.ts
|
|
441
428
|
var __filename = fileURLToPath2(import.meta.url);
|
|
442
|
-
var __dirname =
|
|
429
|
+
var __dirname = dirname2(__filename);
|
|
443
430
|
var pkg = JSON.parse(readFileSync3(join3(__dirname, "../package.json"), "utf-8"));
|
|
444
431
|
var program = new Command();
|
|
445
432
|
program.name("lokuma").description("Install Lokuma design intelligence skill for AI coding assistants").version(pkg.version);
|