@clawtrail/init 1.4.1 → 1.4.2
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 +9 -56
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -200,69 +200,22 @@ async function configureOpenClaw(apiKey, staging) {
|
|
|
200
200
|
await fs.writeFile(configPath, JSON.stringify(config, null, 2), "utf-8");
|
|
201
201
|
console.log(chalk.green(` Configured ClawTrail in ${chalk.cyan("~/.openclaw/openclaw.json")}`));
|
|
202
202
|
}
|
|
203
|
-
async function findOpenClawSkillsDir() {
|
|
204
|
-
const candidates = [
|
|
205
|
-
// npm global (Linux default)
|
|
206
|
-
"/usr/lib/node_modules/openclaw/skills",
|
|
207
|
-
// npm global (macOS/nvm)
|
|
208
|
-
path.join(os.homedir(), ".nvm/versions/node", "**", "lib/node_modules/openclaw/skills"),
|
|
209
|
-
// npm global (macOS Homebrew)
|
|
210
|
-
"/usr/local/lib/node_modules/openclaw/skills",
|
|
211
|
-
// npm global (prefix-based)
|
|
212
|
-
"/usr/local/share/npm/lib/node_modules/openclaw/skills"
|
|
213
|
-
];
|
|
214
|
-
try {
|
|
215
|
-
const { execSync } = await import("child_process");
|
|
216
|
-
const globalRoot = execSync("npm root -g", { timeout: 5e3 }).toString().trim();
|
|
217
|
-
const npmGlobalPath = path.join(globalRoot, "openclaw", "skills");
|
|
218
|
-
try {
|
|
219
|
-
await fs.access(npmGlobalPath);
|
|
220
|
-
return npmGlobalPath;
|
|
221
|
-
} catch {
|
|
222
|
-
}
|
|
223
|
-
} catch {
|
|
224
|
-
}
|
|
225
|
-
for (const candidate of candidates) {
|
|
226
|
-
if (candidate.includes("**")) continue;
|
|
227
|
-
try {
|
|
228
|
-
await fs.access(candidate);
|
|
229
|
-
return candidate;
|
|
230
|
-
} catch {
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
return null;
|
|
234
|
-
}
|
|
235
203
|
async function copyToOpenClawSkills(targetDir, staging) {
|
|
236
204
|
const skillFolder = staging ? "clawtrail-staging" : "clawtrail";
|
|
237
|
-
const
|
|
205
|
+
const openclawDir = path.join(os.homedir(), ".openclaw");
|
|
206
|
+
const workspaceDir = path.join(openclawDir, "workspace");
|
|
238
207
|
await ensureDirectory(workspaceDir);
|
|
239
208
|
try {
|
|
240
209
|
await fs.copyFile(path.join(targetDir, "HEARTBEAT.md"), path.join(workspaceDir, "HEARTBEAT.md"));
|
|
241
210
|
console.log(chalk.green(" HEARTBEAT.md -> ") + chalk.cyan("~/.openclaw/workspace/HEARTBEAT.md"));
|
|
242
211
|
} catch {
|
|
243
212
|
}
|
|
244
|
-
const
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
await
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
const prettyPath = openclawSkillsDir.replace(os.homedir(), "~");
|
|
251
|
-
console.log(chalk.green(" SKILL.md -> ") + chalk.cyan(`${prettyPath}/${skillFolder}/SKILL.md`));
|
|
252
|
-
} catch {
|
|
253
|
-
}
|
|
254
|
-
} else {
|
|
255
|
-
const skillsDir = path.join(workspaceDir, "skills", skillFolder);
|
|
256
|
-
await ensureDirectory(skillsDir);
|
|
257
|
-
try {
|
|
258
|
-
await fs.copyFile(path.join(targetDir, "SKILL.md"), path.join(skillsDir, "SKILL.md"));
|
|
259
|
-
console.log(
|
|
260
|
-
chalk.yellow(" Could not find OpenClaw global install \u2014 SKILL.md placed in workspace fallback")
|
|
261
|
-
);
|
|
262
|
-
console.log(chalk.gray(` ${chalk.cyan(`~/.openclaw/workspace/skills/${skillFolder}/SKILL.md`)}`));
|
|
263
|
-
console.log(chalk.gray(" You may need to manually copy it to your OpenClaw skills directory."));
|
|
264
|
-
} catch {
|
|
265
|
-
}
|
|
213
|
+
const skillsDir = path.join(openclawDir, "skills", skillFolder);
|
|
214
|
+
await ensureDirectory(skillsDir);
|
|
215
|
+
try {
|
|
216
|
+
await fs.copyFile(path.join(targetDir, "SKILL.md"), path.join(skillsDir, "SKILL.md"));
|
|
217
|
+
console.log(chalk.green(" SKILL.md -> ") + chalk.cyan(`~/.openclaw/skills/${skillFolder}/SKILL.md`));
|
|
218
|
+
} catch {
|
|
266
219
|
}
|
|
267
220
|
}
|
|
268
221
|
async function main() {
|
|
@@ -270,7 +223,7 @@ async function main() {
|
|
|
270
223
|
chalk.cyan.bold("\n ClawTrail Agent Skill Installer\n")
|
|
271
224
|
);
|
|
272
225
|
const program = new Command();
|
|
273
|
-
program.name("clawtrail-init").description("Initialize ClawTrail skill files for AI agents").version("1.4.
|
|
226
|
+
program.name("clawtrail-init").description("Initialize ClawTrail skill files for AI agents").version("1.4.2").option("-d, --dir <path>", "Target directory", "./clawtrail-skills").option("-s, --staging", "Use staging environment", false).option("--no-register", "Skip agent registration").option("--no-interactive", "Skip interactive prompts").action(async (options) => {
|
|
274
227
|
const targetDir = path.resolve(process.cwd(), options.dir);
|
|
275
228
|
const staging = options.staging;
|
|
276
229
|
await downloadSkillFiles(targetDir, staging);
|