lokuma-cli 1.1.0 → 1.2.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/index.js +15 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -9,6 +9,7 @@ import { dirname as dirname3, join as join3 } from "path";
|
|
|
9
9
|
// src/commands/init.ts
|
|
10
10
|
import { mkdir, writeFile, access } from "node:fs/promises";
|
|
11
11
|
import { dirname, join } from "node:path";
|
|
12
|
+
import { homedir } from "node:os";
|
|
12
13
|
import { readFileSync } from "node:fs";
|
|
13
14
|
import { fileURLToPath } from "node:url";
|
|
14
15
|
import chalk from "chalk";
|
|
@@ -31,6 +32,7 @@ var AI_TYPES = [
|
|
|
31
32
|
"continue",
|
|
32
33
|
"codebuddy",
|
|
33
34
|
"droid",
|
|
35
|
+
"openclaw",
|
|
34
36
|
"all"
|
|
35
37
|
];
|
|
36
38
|
var AI_DISPLAY_NAMES = {
|
|
@@ -48,6 +50,7 @@ var AI_DISPLAY_NAMES = {
|
|
|
48
50
|
continue: "Continue",
|
|
49
51
|
codebuddy: "CodeBuddy",
|
|
50
52
|
droid: "Droid (Factory)",
|
|
53
|
+
openclaw: "OpenClaw",
|
|
51
54
|
all: "All assistants"
|
|
52
55
|
};
|
|
53
56
|
var AI_SKILL_PATHS = {
|
|
@@ -64,7 +67,9 @@ var AI_SKILL_PATHS = {
|
|
|
64
67
|
opencode: { root: ".opencode", skillMd: ".opencode/OPENCODE.md", scriptPy: ".opencode/lokuma/scripts/search.py" },
|
|
65
68
|
continue: { root: ".continue", skillMd: ".continue/lokuma/SKILL.md", scriptPy: ".continue/lokuma/scripts/search.py" },
|
|
66
69
|
codebuddy: { root: ".codebuddy", skillMd: ".codebuddy/lokuma/SKILL.md", scriptPy: ".codebuddy/lokuma/scripts/search.py" },
|
|
67
|
-
droid: { root: ".factory", skillMd: ".factory/skills/lokuma/SKILL.md", scriptPy: ".factory/skills/lokuma/scripts/search.py" }
|
|
70
|
+
droid: { root: ".factory", skillMd: ".factory/skills/lokuma/SKILL.md", scriptPy: ".factory/skills/lokuma/scripts/search.py" },
|
|
71
|
+
// OpenClaw installs to a fixed absolute path (not relative to cwd)
|
|
72
|
+
openclaw: { root: "~/.openclaw/workspace/skills/lokuma", skillMd: "~/.openclaw/workspace/skills/lokuma/SKILL.md", scriptPy: "~/.openclaw/workspace/skills/lokuma/scripts/search.py" }
|
|
68
73
|
};
|
|
69
74
|
|
|
70
75
|
// src/commands/init.ts
|
|
@@ -72,6 +77,10 @@ import { createRequire } from "node:module";
|
|
|
72
77
|
var _require = createRequire(import.meta.url);
|
|
73
78
|
var _pkgDir = dirname(dirname(fileURLToPath(import.meta.url)));
|
|
74
79
|
var SEARCH_PY = readFileSync(join(_pkgDir, "assets", "search.py"), "utf-8");
|
|
80
|
+
function resolvePath(p) {
|
|
81
|
+
if (p.startsWith("~/")) return join(homedir(), p.slice(2));
|
|
82
|
+
return p;
|
|
83
|
+
}
|
|
75
84
|
function buildSkillMd(scriptPath) {
|
|
76
85
|
return `---
|
|
77
86
|
name: lokuma
|
|
@@ -150,7 +159,11 @@ async function initCommand(options) {
|
|
|
150
159
|
const installed = [];
|
|
151
160
|
try {
|
|
152
161
|
for (const t of targets) {
|
|
153
|
-
const
|
|
162
|
+
const rawPaths = AI_SKILL_PATHS[t];
|
|
163
|
+
const paths = {
|
|
164
|
+
skillMd: resolvePath(rawPaths.skillMd),
|
|
165
|
+
scriptPy: resolvePath(rawPaths.scriptPy)
|
|
166
|
+
};
|
|
154
167
|
if (!options.force && await exists(paths.skillMd)) {
|
|
155
168
|
spinner.warn(`${AI_DISPLAY_NAMES[t]}: already installed (use --force to overwrite)`);
|
|
156
169
|
spinner.start();
|