@dayofweek/dcli 1.1.3 → 1.2.0

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.
Files changed (2) hide show
  1. package/dist/bin/dcli.js +71 -28
  2. package/package.json +1 -1
package/dist/bin/dcli.js CHANGED
@@ -233,14 +233,22 @@ agent
233
233
  });
234
234
  // ── Skill Commands ───────────────────────────────────────────────────────────
235
235
  const skill = program.command("skill").description("Manage the Day of Week agent skill");
236
- skill
237
- .command("install")
238
- .description("Install the agent skill (requires valid auth)")
239
- .option("--dir <path>", "Custom install directory")
240
- .action(async (opts) => {
241
- const client = getClient();
242
- const bundle = await client.getSkillBundle();
243
- const targetDir = opts.dir ?? join(homedir(), ".agents", "skills", bundle.name);
236
+ function resolveTargetDirs(target, bundleName, customDir) {
237
+ if (customDir)
238
+ return [customDir];
239
+ const agentsDir = join(homedir(), ".agents", "skills", bundleName);
240
+ const claudeDir = join(homedir(), ".claude", "skills", bundleName);
241
+ const claudeRootExists = existsSync(join(homedir(), ".claude"));
242
+ switch (target) {
243
+ case "agents":
244
+ return [agentsDir];
245
+ case "claude":
246
+ return [claudeDir];
247
+ case "all":
248
+ return claudeRootExists ? [agentsDir, claudeDir] : [agentsDir];
249
+ }
250
+ }
251
+ function writeBundle(bundle, targetDir) {
244
252
  let filesWritten = 0;
245
253
  for (const file of bundle.files) {
246
254
  const filePath = join(targetDir, file.path);
@@ -248,42 +256,77 @@ skill
248
256
  writeFileSync(filePath, file.content, "utf-8");
249
257
  filesWritten++;
250
258
  }
251
- console.log(`Installed ${filesWritten} files to ${targetDir}`);
259
+ return filesWritten;
260
+ }
261
+ function parseTarget(value) {
262
+ const v = (value ?? "all").toLowerCase();
263
+ if (v !== "agents" && v !== "claude" && v !== "all") {
264
+ console.error(`Invalid --target: ${value}. Use agents, claude, or all.`);
265
+ process.exit(1);
266
+ }
267
+ return v;
268
+ }
269
+ skill
270
+ .command("install")
271
+ .description("Install the agent skill (requires valid auth)")
272
+ .option("--dir <path>", "Custom install directory (overrides --target)")
273
+ .option("--target <target>", "Install target: agents, claude, or all (default: all)")
274
+ .action(async (opts) => {
275
+ const client = getClient();
276
+ const bundle = await client.getSkillBundle();
277
+ const target = parseTarget(opts.target);
278
+ const dirs = resolveTargetDirs(target, bundle.name, opts.dir);
279
+ for (const dir of dirs) {
280
+ const count = writeBundle(bundle, dir);
281
+ console.log(`Installed ${count} files to ${dir}`);
282
+ }
252
283
  console.log("Any compatible agent will discover the skill automatically.");
253
284
  });
254
285
  skill
255
286
  .command("update")
256
287
  .description("Update the skill to the latest version")
257
- .option("--dir <path>", "Custom install directory")
288
+ .option("--dir <path>", "Custom install directory (overrides --target)")
289
+ .option("--target <target>", "Install target: agents, claude, or all (default: all)")
258
290
  .action(async (opts) => {
259
- // Same as install — overwrites
260
291
  const client = getClient();
261
292
  const bundle = await client.getSkillBundle();
262
- const targetDir = opts.dir ?? join(homedir(), ".agents", "skills", bundle.name);
263
- let filesWritten = 0;
264
- for (const file of bundle.files) {
265
- const filePath = join(targetDir, file.path);
266
- mkdirSync(dirname(filePath), { recursive: true });
267
- writeFileSync(filePath, file.content, "utf-8");
268
- filesWritten++;
293
+ const target = parseTarget(opts.target);
294
+ const dirs = resolveTargetDirs(target, bundle.name, opts.dir);
295
+ for (const dir of dirs) {
296
+ const count = writeBundle(bundle, dir);
297
+ console.log(`Updated ${count} files in ${dir}`);
269
298
  }
270
- console.log(`Updated ${filesWritten} files in ${targetDir}`);
271
299
  });
272
300
  skill
273
301
  .command("status")
274
302
  .description("Check if the skill is installed")
275
- .option("--dir <path>", "Custom install directory")
303
+ .option("--dir <path>", "Custom install directory (overrides --target)")
304
+ .option("--target <target>", "Check target: agents, claude, or all (default: all)")
276
305
  .action(async (opts) => {
277
- const dir = opts.dir ?? join(homedir(), ".agents", "skills", "dayofweek-platform");
278
- const skillPath = join(dir, "SKILL.md");
279
- if (!existsSync(skillPath)) {
280
- console.log("Not installed. Run: dcli skill install");
306
+ const bundleName = "dayofweek-platform";
307
+ const target = parseTarget(opts.target);
308
+ const dirs = opts.dir
309
+ ? [opts.dir]
310
+ : target === "all"
311
+ ? [join(homedir(), ".agents", "skills", bundleName), join(homedir(), ".claude", "skills", bundleName)]
312
+ : resolveTargetDirs(target, bundleName);
313
+ let anyInstalled = false;
314
+ for (const dir of dirs) {
315
+ const skillPath = join(dir, "SKILL.md");
316
+ if (!existsSync(skillPath)) {
317
+ console.log(`Not installed at: ${dir}`);
318
+ continue;
319
+ }
320
+ anyInstalled = true;
321
+ const content = readFileSync(skillPath, "utf-8");
322
+ const versionMatch = content.match(/version:\s*"([^"]+)"/);
323
+ console.log(`Installed at: ${dir}`);
324
+ console.log(` Version: ${versionMatch?.[1] ?? "unknown"}`);
325
+ }
326
+ if (!anyInstalled) {
327
+ console.log("\nRun: dcli skill install");
281
328
  process.exit(1);
282
329
  }
283
- const content = readFileSync(skillPath, "utf-8");
284
- const versionMatch = content.match(/version:\s*"([^"]+)"/);
285
- console.log(`Installed at: ${dir}`);
286
- console.log(`Version: ${versionMatch?.[1] ?? "unknown"}`);
287
330
  console.log("\nTo update: dcli skill update");
288
331
  });
289
332
  // ── Helpers ──────────────────────────────────────────────────────────────────
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dayofweek/dcli",
3
- "version": "1.1.3",
3
+ "version": "1.2.0",
4
4
  "description": "CLI for the Day of Week AgTech platform — read data and submit proposals for review",
5
5
  "license": "MIT",
6
6
  "type": "module",