vibe-cokit 1.1.0 → 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/cli.js +92 -5
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -611,12 +611,14 @@ import { join as join2 } from "path";
611
611
  // src/utils/config.ts
612
612
  import { homedir } from "os";
613
613
  import { join } from "path";
614
- import { mkdir, cp, rm, stat } from "fs/promises";
614
+ import { mkdir, cp, rm, stat, readdir } from "fs/promises";
615
615
  import { execFile } from "child_process";
616
616
  import { promisify } from "util";
617
617
  var exec = promisify(execFile);
618
618
  var REPO = "vibe-cokit/claude-code";
619
+ var SKILLS_REPO = "vibe-cokit/skills";
619
620
  var CLAUDE_DIR = join(homedir(), ".claude");
621
+ var SKILLS_DIR = join(CLAUDE_DIR, "skills");
620
622
  var CONFIG_FOLDERS = ["agents", "commands", "hooks", "prompts", "workflows"];
621
623
  var TEMP_DIR = join(homedir(), ".vibe-cokit-tmp");
622
624
  function log(step) {
@@ -629,9 +631,9 @@ async function verifyPrerequisites() {
629
631
  throw new Error("gh CLI not found. Install: https://cli.github.com");
630
632
  }
631
633
  }
632
- async function cloneRepo(tmpDir) {
634
+ async function cloneRepo(tmpDir, repo = REPO) {
633
635
  try {
634
- await exec("gh", ["repo", "clone", REPO, tmpDir]);
636
+ await exec("gh", ["repo", "clone", repo, tmpDir]);
635
637
  } catch (err) {
636
638
  const msg = err instanceof Error ? err.message : String(err);
637
639
  throw new Error(`Failed to clone repo: ${msg}`);
@@ -708,14 +710,45 @@ async function getCurrentVersion() {
708
710
  }
709
711
  return null;
710
712
  }
711
- async function getRemoteSha(ref) {
713
+ async function getRemoteSha(ref, repo = REPO) {
712
714
  const target = ref ?? "HEAD";
713
- const { stdout } = await exec("git", ["ls-remote", `https://github.com/${REPO}.git`, target]);
715
+ const { stdout } = await exec("git", ["ls-remote", `https://github.com/${repo}.git`, target]);
714
716
  const sha = stdout.trim().split("\t")[0];
715
717
  if (!sha)
716
718
  throw new Error(`Could not resolve ref: ${target}`);
717
719
  return sha;
718
720
  }
721
+ async function copySkillFolders(srcDir) {
722
+ await mkdir(SKILLS_DIR, { recursive: true });
723
+ const entries = await readdir(srcDir, { withFileTypes: true });
724
+ for (const entry of entries) {
725
+ if (entry.isDirectory() && !entry.name.startsWith(".")) {
726
+ const src = join(srcDir, entry.name);
727
+ const dest = join(SKILLS_DIR, entry.name);
728
+ await cp(src, dest, { recursive: true, force: true });
729
+ log(`Copied skill: ${entry.name}/`);
730
+ }
731
+ }
732
+ }
733
+ async function updateSkillsVersion(commitSha) {
734
+ const settingsPath = join(CLAUDE_DIR, "settings.json");
735
+ let settings = {};
736
+ const file = Bun.file(settingsPath);
737
+ if (await file.exists()) {
738
+ settings = await file.json();
739
+ }
740
+ settings.skillsVersion = commitSha;
741
+ await Bun.write(settingsPath, JSON.stringify(settings, null, 2));
742
+ }
743
+ async function getSkillsVersion() {
744
+ const settingsPath = join(CLAUDE_DIR, "settings.json");
745
+ const file = Bun.file(settingsPath);
746
+ if (await file.exists()) {
747
+ const settings = await file.json();
748
+ return settings.skillsVersion ?? null;
749
+ }
750
+ return null;
751
+ }
719
752
 
720
753
  // src/commands/init.ts
721
754
  async function initCommand() {
@@ -808,6 +841,59 @@ vibe-cokit update
808
841
  }
809
842
  }
810
843
 
844
+ // src/commands/skills.ts
845
+ import { join as join4 } from "path";
846
+ import { execFile as execFile3 } from "child_process";
847
+ import { promisify as promisify3 } from "util";
848
+ var exec3 = promisify3(execFile3);
849
+ async function skillsCommand(ref) {
850
+ const tmpDir = join4(TEMP_DIR, crypto.randomUUID());
851
+ try {
852
+ console.log(`
853
+ vibe-cokit skills
854
+ `);
855
+ log("Verifying prerequisites...");
856
+ await verifyPrerequisites();
857
+ log("Checking current skills version...");
858
+ const currentSha = await getSkillsVersion();
859
+ log("Fetching latest skills version...");
860
+ const targetSha = await getRemoteSha(ref, SKILLS_REPO);
861
+ if (currentSha && currentSha === targetSha) {
862
+ console.log(`
863
+ \u2713 Skills already up-to-date (${currentSha.slice(0, 8)})
864
+ `);
865
+ return;
866
+ }
867
+ log("Cloning skills repository...");
868
+ await cloneRepo(tmpDir, SKILLS_REPO);
869
+ if (ref) {
870
+ log(`Checking out ${ref}...`);
871
+ await exec3("git", ["-C", tmpDir, "checkout", ref]);
872
+ }
873
+ log("Copying skills to ~/.claude/skills/");
874
+ await copySkillFolders(tmpDir);
875
+ log("Updating skills version...");
876
+ const sha = await getCommitSha(tmpDir);
877
+ await updateSkillsVersion(sha);
878
+ log("Cleaning up...");
879
+ await cleanup(tmpDir);
880
+ const from = currentSha ? currentSha.slice(0, 8) : "none";
881
+ console.log(`
882
+ \u2713 Skills installed successfully!`);
883
+ console.log(` From: ${from}`);
884
+ console.log(` To: ${sha.slice(0, 8)}`);
885
+ console.log(` Skills: ~/.claude/skills/
886
+ `);
887
+ } catch (err) {
888
+ await cleanup(tmpDir);
889
+ const msg = err instanceof Error ? err.message : String(err);
890
+ console.error(`
891
+ \u2717 Skills setup failed: ${msg}
892
+ `);
893
+ process.exit(1);
894
+ }
895
+ }
896
+
811
897
  // src/cli.ts
812
898
  var cli = dist_default("vibe-cokit");
813
899
  cli.command("", "A toolkit for interacting with Claude Code").action(() => {
@@ -815,6 +901,7 @@ cli.command("", "A toolkit for interacting with Claude Code").action(() => {
815
901
  });
816
902
  cli.command("init", "Initialize vibe-cokit for current project").action(initCommand);
817
903
  cli.command("update [ref]", "Update vibe-cokit to latest or specific version").alias("upgrade").action(updateCommand);
904
+ cli.command("skills [ref]", "Install or update skills from vibe-cokit").action(skillsCommand);
818
905
  cli.help();
819
906
  cli.version(version);
820
907
  cli.parse();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vibe-cokit",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "A toolkit for interacting with Claude Code",
5
5
  "module": "index.ts",
6
6
  "type": "module",