simba-skills 0.2.0 → 0.3.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.
package/README.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Simba
2
2
 
3
+ <p align="center">
4
+ <img src="assets/simba.jpg" alt="Simba the cat" width="600">
5
+ </p>
6
+
3
7
  [![npm version](https://img.shields.io/npm/v/simba-skills)](https://www.npmjs.com/package/simba-skills)
4
8
  [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
5
9
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "simba-skills",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "AI skills manager - central store with symlink-based distribution across 14+ coding agents",
5
5
  "publishConfig": {
6
6
  "access": "public",
@@ -31,7 +31,7 @@
31
31
  },
32
32
  "files": [
33
33
  "src",
34
- "!src/**/*.test.ts"
34
+ "!assets"
35
35
  ],
36
36
  "scripts": {
37
37
  "dev": "bun run src/index.ts",
@@ -281,6 +281,7 @@ export interface InstallOptions {
281
281
  skillsDir: string
282
282
  registryPath: string
283
283
  useSSH: boolean
284
+ skillName?: string // Install specific skill by name, skip selection
284
285
  onSelect: (skills: DiscoveredSkill[]) => Promise<string[]>
285
286
  }
286
287
 
@@ -346,16 +347,30 @@ export async function runInstall(options: InstallOptions): Promise<void> {
346
347
  return
347
348
  }
348
349
 
349
- console.log(`\nFound ${discovered.length} skills:`)
350
- for (const skill of discovered) {
351
- console.log(` * ${skill.name}${skill.description ? ` - ${skill.description}` : ""}`)
352
- }
350
+ let selected: string[]
353
351
 
354
- const selected = await options.onSelect(discovered)
352
+ if (options.skillName) {
353
+ // Direct install of specific skill
354
+ const skill = discovered.find(s => s.name === options.skillName)
355
+ if (!skill) {
356
+ console.log(`Skill "${options.skillName}" not found in source.`)
357
+ console.log(`Available skills: ${discovered.map(s => s.name).join(", ")}`)
358
+ return
359
+ }
360
+ selected = [options.skillName]
361
+ console.log(`Installing skill: ${options.skillName}`)
362
+ } else {
363
+ console.log(`\nFound ${discovered.length} skills:`)
364
+ for (const skill of discovered) {
365
+ console.log(` * ${skill.name}${skill.description ? ` - ${skill.description}` : ""}`)
366
+ }
355
367
 
356
- if (selected.length === 0) {
357
- console.log("No skills selected.")
358
- return
368
+ selected = await options.onSelect(discovered)
369
+
370
+ if (selected.length === 0) {
371
+ console.log("No skills selected.")
372
+ return
373
+ }
359
374
  }
360
375
 
361
376
  for (const name of selected) {
@@ -458,6 +473,7 @@ export default defineCommand({
458
473
  args: {
459
474
  source: { type: "positional", description: "GitHub repo (user/repo) or local path", required: true },
460
475
  ssh: { type: "boolean", description: "Use SSH for GitHub repos (for private repos)", default: false },
476
+ skill: { type: "string", description: "Install specific skill by name (skip selection)", required: false },
461
477
  },
462
478
  async run({ args }) {
463
479
  await runInstall({
@@ -465,6 +481,7 @@ export default defineCommand({
465
481
  skillsDir: getSkillsDir(),
466
482
  registryPath: getRegistryPath(),
467
483
  useSSH: args.ssh,
484
+ skillName: args.skill,
468
485
  onSelect: async (skills) => {
469
486
  const result = await p.multiselect({
470
487
  message: "Select skills to install:",
@@ -1,9 +1,10 @@
1
1
  import { defineCommand } from "citty"
2
- import { readFile, mkdir, rm } from "node:fs/promises"
3
- import { join } from "node:path"
2
+ import { readFile, readdir, mkdir, rm } from "node:fs/promises"
3
+ import { join, relative } from "node:path"
4
4
  import * as p from "@clack/prompts"
5
5
  import simpleGit from "simple-git"
6
6
  import { tmpdir } from "node:os"
7
+ import { createHash } from "node:crypto"
7
8
  import { RegistryStore } from "../core/registry-store"
8
9
  import { SkillsStore } from "../core/skills-store"
9
10
  import { getSkillsDir, getRegistryPath } from "../utils/paths"
@@ -12,6 +13,50 @@ import { discoverSkills } from "./install"
12
13
  import type { ManagedSkill, InstallSource } from "../core/types"
13
14
  import matter from "gray-matter"
14
15
 
16
+ /**
17
+ * Recursively get all files in a directory (sorted for deterministic hashing)
18
+ */
19
+ async function getAllFiles(dir: string): Promise<string[]> {
20
+ const files: string[] = []
21
+
22
+ async function scan(currentDir: string): Promise<void> {
23
+ const entries = await readdir(currentDir, { withFileTypes: true })
24
+ for (const entry of entries) {
25
+ const fullPath = join(currentDir, entry.name)
26
+ if (entry.isDirectory()) {
27
+ await scan(fullPath)
28
+ } else {
29
+ files.push(relative(dir, fullPath))
30
+ }
31
+ }
32
+ }
33
+
34
+ await scan(dir)
35
+ return files.sort()
36
+ }
37
+
38
+ /**
39
+ * Compute a content hash for an entire skill directory.
40
+ * Hash includes: sorted file paths + their contents
41
+ */
42
+ async function hashSkillDir(dir: string): Promise<string> {
43
+ const files = await getAllFiles(dir)
44
+ const hash = createHash("sha256")
45
+
46
+ for (const file of files) {
47
+ // Include file path in hash (detects renames/additions/deletions)
48
+ hash.update(file)
49
+ hash.update("\0")
50
+
51
+ // Include file content
52
+ const content = await readFile(join(dir, file))
53
+ hash.update(content)
54
+ hash.update("\0")
55
+ }
56
+
57
+ return hash.digest("hex")
58
+ }
59
+
15
60
  interface SkillUpdate {
16
61
  skill: ManagedSkill
17
62
  newPath: string
@@ -119,16 +164,23 @@ export async function runUpdate(options: UpdateOptions): Promise<void> {
119
164
  continue
120
165
  }
121
166
 
122
- const existingPath = join(options.skillsDir, skill.name, "SKILL.md")
123
- const existingContent = await readFile(existingPath, "utf-8")
124
- const newContent = await readFile(join(remote.path, "SKILL.md"), "utf-8")
125
-
126
- const comparison = compareFiles(existingContent, newContent, "SKILL.md")
167
+ const localDir = join(options.skillsDir, skill.name)
168
+
169
+ // Hash entire directories to detect any file changes
170
+ const [localHash, remoteHash] = await Promise.all([
171
+ hashSkillDir(localDir),
172
+ hashSkillDir(remote.path)
173
+ ])
127
174
 
128
- if (comparison.identical) {
175
+ if (localHash === remoteHash) {
129
176
  console.log(` ✓ ${skill.name}: up to date`)
130
177
  } else {
131
178
  console.log(` ↑ ${skill.name}: update available`)
179
+
180
+ // Still read SKILL.md for version display purposes
181
+ const existingContent = await readFile(join(localDir, "SKILL.md"), "utf-8")
182
+ const newContent = await readFile(join(remote.path, "SKILL.md"), "utf-8")
183
+
132
184
  allUpdates.push({
133
185
  skill,
134
186
  newPath: remote.path,
@@ -13,7 +13,7 @@ const AGENT_DEFINITIONS: [string, string, string, string, string][] = [
13
13
  ["windsurf", "Windsurf", "Windsurf", "~/.codeium/windsurf/skills", ".windsurf/skills"],
14
14
  ["amp", "Amp", "Amp", "~/.config/agents/skills", ".agents/skills"],
15
15
  ["goose", "Goose", "Goose", "~/.config/goose/skills", ".goose/skills"],
16
- ["opencode", "OpenCode", "OpenCode", "~/.config/opencode/skill", ".opencode/skill"],
16
+ ["opencode", "OpenCode", "OpenCode", "~/.config/opencode/skills", ".opencode/skills"],
17
17
  ["kilo", "Kilo Code", "Kilo", "~/.kilocode/skills", ".kilocode/skills"],
18
18
  ["roo", "Roo Code", "Roo", "~/.roo/skills", ".roo/skills"],
19
19
  ["antigravity", "Antigravity", "Antigrav", "~/.gemini/antigravity/skills", ".agent/skills"],