@clawtrail/init 1.4.0 → 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 +14 -78
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -200,86 +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
|
|
204
|
-
const
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
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
|
-
];
|
|
203
|
+
async function copyToOpenClawSkills(targetDir, staging) {
|
|
204
|
+
const skillFolder = staging ? "clawtrail-staging" : "clawtrail";
|
|
205
|
+
const openclawDir = path.join(os.homedir(), ".openclaw");
|
|
206
|
+
const workspaceDir = path.join(openclawDir, "workspace");
|
|
207
|
+
await ensureDirectory(workspaceDir);
|
|
214
208
|
try {
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
const npmGlobalPath = path.join(globalRoot, "openclaw", "skills");
|
|
218
|
-
try {
|
|
219
|
-
await fs.access(npmGlobalPath);
|
|
220
|
-
return npmGlobalPath;
|
|
221
|
-
} catch {
|
|
222
|
-
}
|
|
209
|
+
await fs.copyFile(path.join(targetDir, "HEARTBEAT.md"), path.join(workspaceDir, "HEARTBEAT.md"));
|
|
210
|
+
console.log(chalk.green(" HEARTBEAT.md -> ") + chalk.cyan("~/.openclaw/workspace/HEARTBEAT.md"));
|
|
223
211
|
} catch {
|
|
224
212
|
}
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
return null;
|
|
234
|
-
}
|
|
235
|
-
async function copyToOpenClawSkills(targetDir, staging) {
|
|
236
|
-
const skillFolder = staging ? "clawtrail-staging" : "clawtrail";
|
|
237
|
-
const openclawSkillsDir = await findOpenClawSkillsDir();
|
|
238
|
-
if (openclawSkillsDir) {
|
|
239
|
-
const destDir = path.join(openclawSkillsDir, skillFolder);
|
|
240
|
-
await ensureDirectory(destDir);
|
|
241
|
-
const copies = [
|
|
242
|
-
{ file: "SKILL.md", dest: path.join(destDir, "SKILL.md") },
|
|
243
|
-
{ file: "HEARTBEAT.md", dest: path.join(destDir, "HEARTBEAT.md") }
|
|
244
|
-
];
|
|
245
|
-
let copied = 0;
|
|
246
|
-
for (const { file, dest } of copies) {
|
|
247
|
-
const src = path.join(targetDir, file);
|
|
248
|
-
try {
|
|
249
|
-
await fs.copyFile(src, dest);
|
|
250
|
-
copied++;
|
|
251
|
-
} catch {
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
const prettyPath = openclawSkillsDir.replace(os.homedir(), "~");
|
|
255
|
-
console.log(
|
|
256
|
-
chalk.green(` Installed ${copied} file${copied !== 1 ? "s" : ""} to OpenClaw skills`)
|
|
257
|
-
);
|
|
258
|
-
console.log(chalk.gray(` ${chalk.cyan(`${prettyPath}/${skillFolder}/SKILL.md`)}`));
|
|
259
|
-
console.log(chalk.gray(` ${chalk.cyan(`${prettyPath}/${skillFolder}/HEARTBEAT.md`)}`));
|
|
260
|
-
} else {
|
|
261
|
-
const workspaceDir = path.join(os.homedir(), ".openclaw", "workspace");
|
|
262
|
-
const skillsDir = path.join(workspaceDir, "skills", skillFolder);
|
|
263
|
-
await ensureDirectory(workspaceDir);
|
|
264
|
-
await ensureDirectory(skillsDir);
|
|
265
|
-
const copies = [
|
|
266
|
-
{ file: "SKILL.md", dest: path.join(skillsDir, "SKILL.md") },
|
|
267
|
-
{ file: "HEARTBEAT.md", dest: path.join(skillsDir, "HEARTBEAT.md") }
|
|
268
|
-
];
|
|
269
|
-
let copied = 0;
|
|
270
|
-
for (const { file, dest } of copies) {
|
|
271
|
-
const src = path.join(targetDir, file);
|
|
272
|
-
try {
|
|
273
|
-
await fs.copyFile(src, dest);
|
|
274
|
-
copied++;
|
|
275
|
-
} catch {
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
console.log(
|
|
279
|
-
chalk.yellow(` Could not find OpenClaw global install \u2014 placed files in workspace fallback`)
|
|
280
|
-
);
|
|
281
|
-
console.log(chalk.gray(` ${chalk.cyan(`~/.openclaw/workspace/skills/${skillFolder}/`)}`));
|
|
282
|
-
console.log(chalk.gray(` You may need to manually copy SKILL.md to your OpenClaw skills directory.`));
|
|
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 {
|
|
283
219
|
}
|
|
284
220
|
}
|
|
285
221
|
async function main() {
|
|
@@ -287,7 +223,7 @@ async function main() {
|
|
|
287
223
|
chalk.cyan.bold("\n ClawTrail Agent Skill Installer\n")
|
|
288
224
|
);
|
|
289
225
|
const program = new Command();
|
|
290
|
-
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) => {
|
|
291
227
|
const targetDir = path.resolve(process.cwd(), options.dir);
|
|
292
228
|
const staging = options.staging;
|
|
293
229
|
await downloadSkillFiles(targetDir, staging);
|