lokuma-cli 1.4.4 → 1.4.6
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 +11 -24
- 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,7 +84,9 @@ function buildSkillMd(scriptPath, apiKey) {
|
|
|
84
84
|
const keyLine = apiKey ? `LOKUMA_API_KEY = ${apiKey}
|
|
85
85
|
|
|
86
86
|
` : "";
|
|
87
|
-
return `${keyLine}
|
|
87
|
+
return `${keyLine}> \u26A0\uFE0F Fetching the design style takes ~30 seconds. You MUST wait for the full design recommendation before generating any code!
|
|
88
|
+
|
|
89
|
+
---
|
|
88
90
|
name: frontend-designer
|
|
89
91
|
description: >
|
|
90
92
|
Lokuma design intelligence. Use this skill whenever building or modifying UI:
|
|
@@ -277,7 +279,7 @@ async function initCommand(options) {
|
|
|
277
279
|
|
|
278
280
|
// src/commands/auth.ts
|
|
279
281
|
import { writeFileSync, readFileSync as readFileSync2, existsSync, mkdirSync } from "node:fs";
|
|
280
|
-
import {
|
|
282
|
+
import { join as join2 } from "node:path";
|
|
281
283
|
import { homedir as homedir2 } from "node:os";
|
|
282
284
|
import { createInterface } from "node:readline";
|
|
283
285
|
import chalk2 from "chalk";
|
|
@@ -308,27 +310,12 @@ function updateAllSkillMds(key) {
|
|
|
308
310
|
}
|
|
309
311
|
return updated;
|
|
310
312
|
}
|
|
311
|
-
function detectShellRc() {
|
|
312
|
-
const shell = process.env.SHELL ?? "";
|
|
313
|
-
const home = process.env.HOME ?? "";
|
|
314
|
-
if (shell.includes("zsh")) return join2(home, ".zshrc");
|
|
315
|
-
if (shell.includes("bash")) return process.platform === "darwin" ? join2(home, ".bash_profile") : join2(home, ".bashrc");
|
|
316
|
-
return join2(home, ".profile");
|
|
317
|
-
}
|
|
318
313
|
function persistKey(key) {
|
|
319
|
-
const
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
export LOKUMA_API_KEY="${key}"
|
|
325
|
-
`;
|
|
326
|
-
writeFileSync(rc, content, "utf-8");
|
|
327
|
-
const envFile = join2(process.env.HOME ?? "", ".lokuma");
|
|
328
|
-
mkdirSync(dirname2(envFile), { recursive: true });
|
|
329
|
-
writeFileSync(envFile, `LOKUMA_API_KEY=${key}
|
|
330
|
-
`, "utf-8");
|
|
331
|
-
return rc;
|
|
314
|
+
const configDir = join2(homedir2(), ".lokuma");
|
|
315
|
+
const configFile = join2(configDir, "config.json");
|
|
316
|
+
mkdirSync(configDir, { recursive: true });
|
|
317
|
+
writeFileSync(configFile, JSON.stringify({ apiKey: key }, null, 2) + "\n", { mode: 384 });
|
|
318
|
+
return configFile;
|
|
332
319
|
}
|
|
333
320
|
async function prompt(question, hidden = false) {
|
|
334
321
|
return new Promise((resolve) => {
|
|
@@ -437,7 +424,7 @@ async function updateCommand(options = {}) {
|
|
|
437
424
|
|
|
438
425
|
// src/index.ts
|
|
439
426
|
var __filename = fileURLToPath2(import.meta.url);
|
|
440
|
-
var __dirname =
|
|
427
|
+
var __dirname = dirname2(__filename);
|
|
441
428
|
var pkg = JSON.parse(readFileSync3(join3(__dirname, "../package.json"), "utf-8"));
|
|
442
429
|
var program = new Command();
|
|
443
430
|
program.name("lokuma").description("Install Lokuma design intelligence skill for AI coding assistants").version(pkg.version);
|