lokuma-cli 1.4.5 → 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 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
- "Set it with: export LOKUMA_API_KEY=lokuma_your_key_here\n"
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 dirname3, join as join3 } from "path";
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";
@@ -279,7 +279,7 @@ async function initCommand(options) {
279
279
 
280
280
  // src/commands/auth.ts
281
281
  import { writeFileSync, readFileSync as readFileSync2, existsSync, mkdirSync } from "node:fs";
282
- import { dirname as dirname2, join as join2 } from "node:path";
282
+ import { join as join2 } from "node:path";
283
283
  import { homedir as homedir2 } from "node:os";
284
284
  import { createInterface } from "node:readline";
285
285
  import chalk2 from "chalk";
@@ -310,27 +310,12 @@ function updateAllSkillMds(key) {
310
310
  }
311
311
  return updated;
312
312
  }
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
313
  function persistKey(key) {
321
- const rc = detectShellRc();
322
- let content = existsSync(rc) ? readFileSync2(rc, "utf-8") : "";
323
- content = content.replace(/\n?# Lokuma API key\nexport LOKUMA_API_KEY=.*\n?/g, "");
324
- content += `
325
- # Lokuma API key
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;
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;
334
319
  }
335
320
  async function prompt(question, hidden = false) {
336
321
  return new Promise((resolve) => {
@@ -439,7 +424,7 @@ async function updateCommand(options = {}) {
439
424
 
440
425
  // src/index.ts
441
426
  var __filename = fileURLToPath2(import.meta.url);
442
- var __dirname = dirname3(__filename);
427
+ var __dirname = dirname2(__filename);
443
428
  var pkg = JSON.parse(readFileSync3(join3(__dirname, "../package.json"), "utf-8"));
444
429
  var program = new Command();
445
430
  program.name("lokuma").description("Install Lokuma design intelligence skill for AI coding assistants").version(pkg.version);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lokuma-cli",
3
- "version": "1.4.5",
3
+ "version": "1.4.6",
4
4
  "description": "CLI to install Lokuma design intelligence skill for AI coding assistants",
5
5
  "type": "module",
6
6
  "bin": {