@claudeskill/core 0.1.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/dist/crypto.d.ts +95 -0
- package/dist/crypto.d.ts.map +1 -0
- package/dist/crypto.js +228 -0
- package/dist/crypto.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/dist/skill.d.ts +109 -0
- package/dist/skill.d.ts.map +1 -0
- package/dist/skill.js +453 -0
- package/dist/skill.js.map +1 -0
- package/dist/types.d.ts +127 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +5 -0
- package/dist/types.js.map +1 -0
- package/package.json +31 -0
package/dist/crypto.d.ts
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zero-knowledge encryption module
|
|
3
|
+
*
|
|
4
|
+
* Key hierarchy:
|
|
5
|
+
* 1. User passphrase (in user's head)
|
|
6
|
+
* 2. Derived key (Argon2id from passphrase + salt)
|
|
7
|
+
* 3. Master key (random 256-bit, encrypted with derived key)
|
|
8
|
+
* 4. Skill data (encrypted with master key)
|
|
9
|
+
*/
|
|
10
|
+
import type { DerivedKey, RecoveryKey } from "./types.js";
|
|
11
|
+
/**
|
|
12
|
+
* Generate cryptographically secure random bytes
|
|
13
|
+
*/
|
|
14
|
+
export declare const generateRandomBytes: (length: number) => Uint8Array;
|
|
15
|
+
/**
|
|
16
|
+
* Generate a salt for key derivation
|
|
17
|
+
*/
|
|
18
|
+
export declare const generateSalt: () => Uint8Array;
|
|
19
|
+
/**
|
|
20
|
+
* Generate a random master key
|
|
21
|
+
*/
|
|
22
|
+
export declare const generateMasterKey: () => Uint8Array;
|
|
23
|
+
/**
|
|
24
|
+
* Derive a key from a passphrase using Argon2id
|
|
25
|
+
*/
|
|
26
|
+
export declare const deriveKeyFromPassphrase: (passphrase: string, salt: Uint8Array) => DerivedKey;
|
|
27
|
+
/**
|
|
28
|
+
* Generate a recovery key (8 random words)
|
|
29
|
+
*/
|
|
30
|
+
export declare const generateRecoveryKey: () => RecoveryKey;
|
|
31
|
+
/**
|
|
32
|
+
* Parse a recovery key from words
|
|
33
|
+
*/
|
|
34
|
+
export declare const parseRecoveryKey: (wordsInput: string) => RecoveryKey | null;
|
|
35
|
+
/**
|
|
36
|
+
* Derive a key from a recovery key
|
|
37
|
+
*/
|
|
38
|
+
export declare const deriveKeyFromRecoveryKey: (recoveryKey: RecoveryKey, salt: Uint8Array) => DerivedKey;
|
|
39
|
+
/**
|
|
40
|
+
* Encrypt data using AES-256-GCM
|
|
41
|
+
*/
|
|
42
|
+
export declare const encrypt: (plaintext: Uint8Array, key: Uint8Array) => {
|
|
43
|
+
ciphertext: Uint8Array;
|
|
44
|
+
iv: Uint8Array;
|
|
45
|
+
tag: Uint8Array;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Decrypt data using AES-256-GCM
|
|
49
|
+
*/
|
|
50
|
+
export declare const decrypt: (ciphertext: Uint8Array, key: Uint8Array, iv: Uint8Array, tag: Uint8Array) => Uint8Array;
|
|
51
|
+
/**
|
|
52
|
+
* Encrypt a string and return base64-encoded components
|
|
53
|
+
*/
|
|
54
|
+
export declare const encryptString: (plaintext: string, key: Uint8Array) => {
|
|
55
|
+
ciphertext: string;
|
|
56
|
+
iv: string;
|
|
57
|
+
tag: string;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Decrypt base64-encoded components to a string
|
|
61
|
+
*/
|
|
62
|
+
export declare const decryptString: (ciphertext: string, key: Uint8Array, iv: string, tag: string) => string;
|
|
63
|
+
/**
|
|
64
|
+
* Encrypt the master key with a derived key (for storage)
|
|
65
|
+
*/
|
|
66
|
+
export declare const encryptMasterKey: (masterKey: Uint8Array, derivedKey: Uint8Array) => {
|
|
67
|
+
encrypted: Uint8Array;
|
|
68
|
+
iv: Uint8Array;
|
|
69
|
+
tag: Uint8Array;
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* Decrypt the master key with a derived key
|
|
73
|
+
*/
|
|
74
|
+
export declare const decryptMasterKey: (encryptedMasterKey: Uint8Array, derivedKey: Uint8Array, iv: Uint8Array, tag: Uint8Array) => Uint8Array;
|
|
75
|
+
/**
|
|
76
|
+
* Format recovery key for display
|
|
77
|
+
*/
|
|
78
|
+
export declare const formatRecoveryKey: (recoveryKey: RecoveryKey) => string;
|
|
79
|
+
/**
|
|
80
|
+
* Convert Uint8Array to base64 string
|
|
81
|
+
*/
|
|
82
|
+
export declare const toBase64: (bytes: Uint8Array) => string;
|
|
83
|
+
/**
|
|
84
|
+
* Convert base64 string to Uint8Array
|
|
85
|
+
*/
|
|
86
|
+
export declare const fromBase64: (base64: string) => Uint8Array;
|
|
87
|
+
/**
|
|
88
|
+
* Compute SHA-256 hash of content, return short hash (8 chars like git)
|
|
89
|
+
*/
|
|
90
|
+
export declare const computeContentHash: (content: string) => string;
|
|
91
|
+
/**
|
|
92
|
+
* Compute full SHA-256 hash of content
|
|
93
|
+
*/
|
|
94
|
+
export declare const computeFullHash: (content: string) => string;
|
|
95
|
+
//# sourceMappingURL=crypto.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crypto.d.ts","sourceRoot":"","sources":["../src/crypto.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AASH,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAkD1D;;GAEG;AACH,eAAO,MAAM,mBAAmB,GAAI,QAAQ,MAAM,KAAG,UAEpD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,YAAY,QAAO,UAE/B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,iBAAiB,QAAO,UAEpC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,uBAAuB,GAClC,YAAY,MAAM,EAClB,MAAM,UAAU,KACf,UAWF,CAAC;AAEF;;GAEG;AACH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;AACH,eAAO,MAAM,QAAQ,GAAI,OAAO,UAAU,KAAG,MAE5C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,UAAU,GAAI,QAAQ,MAAM,KAAG,UAE3C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,kBAAkB,GAAI,SAAS,MAAM,KAAG,MAEpD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,GAAI,SAAS,MAAM,KAAG,MAEjD,CAAC"}
|
package/dist/crypto.js
ADDED
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zero-knowledge encryption module
|
|
3
|
+
*
|
|
4
|
+
* Key hierarchy:
|
|
5
|
+
* 1. User passphrase (in user's head)
|
|
6
|
+
* 2. Derived key (Argon2id from passphrase + salt)
|
|
7
|
+
* 3. Master key (random 256-bit, encrypted with derived key)
|
|
8
|
+
* 4. Skill data (encrypted with master key)
|
|
9
|
+
*/
|
|
10
|
+
import { argon2id } from "@noble/hashes/argon2";
|
|
11
|
+
import { randomBytes, createCipheriv, createDecipheriv, createHash, } from "node:crypto";
|
|
12
|
+
/** AES-256-GCM configuration */
|
|
13
|
+
const AES_KEY_LENGTH = 32; // 256 bits
|
|
14
|
+
const AES_IV_LENGTH = 12; // 96 bits (recommended for GCM)
|
|
15
|
+
const AES_TAG_LENGTH = 16; // 128 bits
|
|
16
|
+
const AES_ALGORITHM = "aes-256-gcm";
|
|
17
|
+
/** Argon2id configuration (OWASP recommended) */
|
|
18
|
+
const ARGON2_MEMORY = 65536; // 64 MiB
|
|
19
|
+
const ARGON2_ITERATIONS = 3;
|
|
20
|
+
const ARGON2_PARALLELISM = 4;
|
|
21
|
+
const ARGON2_SALT_LENGTH = 16;
|
|
22
|
+
/** BIP39-like wordlist for recovery keys (simplified 256 common words) */
|
|
23
|
+
const WORDLIST = [
|
|
24
|
+
"apple", "armor", "arrow", "badge", "baker", "beach", "beast", "berry",
|
|
25
|
+
"blade", "blank", "blaze", "blend", "bless", "block", "bloom", "board",
|
|
26
|
+
"bonus", "boost", "bound", "brain", "brand", "brave", "bread", "break",
|
|
27
|
+
"brick", "brief", "bring", "broad", "brook", "brush", "build", "burst",
|
|
28
|
+
"cabin", "cable", "camel", "candy", "cargo", "carry", "catch", "cause",
|
|
29
|
+
"chain", "chair", "chalk", "charm", "chase", "cheap", "check", "chess",
|
|
30
|
+
"chief", "child", "chill", "claim", "clamp", "clash", "class", "clean",
|
|
31
|
+
"clear", "clerk", "click", "cliff", "climb", "clock", "close", "cloth",
|
|
32
|
+
"cloud", "coach", "coast", "coral", "couch", "cover", "craft", "crane",
|
|
33
|
+
"crash", "crawl", "cream", "creek", "crisp", "cross", "crowd", "crown",
|
|
34
|
+
"crush", "curve", "cycle", "dance", "delta", "depot", "depth", "diary",
|
|
35
|
+
"digit", "dodge", "draft", "drain", "drama", "drank", "dream", "dress",
|
|
36
|
+
"drift", "drill", "drink", "drive", "drown", "drums", "dusty", "dwarf",
|
|
37
|
+
"eagle", "earth", "elbow", "elder", "elite", "ember", "empty", "enemy",
|
|
38
|
+
"enjoy", "enter", "equal", "error", "essay", "event", "exact", "exile",
|
|
39
|
+
"exist", "extra", "fable", "faith", "fancy", "fault", "feast", "fence",
|
|
40
|
+
"fetch", "fever", "fiber", "field", "fifth", "fifty", "fight", "final",
|
|
41
|
+
"flair", "flame", "flash", "fleet", "flesh", "fling", "float", "flock",
|
|
42
|
+
"flood", "floor", "flour", "fluid", "flush", "flute", "focus", "force",
|
|
43
|
+
"forge", "forth", "forum", "found", "frame", "frank", "fresh", "frost",
|
|
44
|
+
"fruit", "fuels", "giant", "glass", "gleam", "glide", "globe", "glory",
|
|
45
|
+
"grace", "grade", "grain", "grand", "grant", "grape", "grasp", "grass",
|
|
46
|
+
"grave", "great", "green", "greet", "grief", "grill", "grind", "group",
|
|
47
|
+
"grove", "guard", "guess", "guest", "guide", "guilt", "habit", "happy",
|
|
48
|
+
"harsh", "haste", "haven", "heart", "heavy", "hedge", "heist", "hello",
|
|
49
|
+
"honor", "horse", "hotel", "house", "human", "humor", "ideal", "image",
|
|
50
|
+
"index", "inner", "input", "intro", "issue", "ivory", "jelly", "jewel",
|
|
51
|
+
"joint", "joker", "jolly", "judge", "juice", "jumbo", "kayak", "khaki",
|
|
52
|
+
"knife", "knock", "label", "labor", "lance", "large", "laser", "latch",
|
|
53
|
+
"later", "laugh", "layer", "learn", "lease", "leave", "legal", "lemon",
|
|
54
|
+
"level", "lever", "light", "limit", "linen", "links", "liver", "llama",
|
|
55
|
+
"local", "lodge", "logic", "lunar", "lunch", "maker", "manor", "maple",
|
|
56
|
+
];
|
|
57
|
+
/**
|
|
58
|
+
* Generate cryptographically secure random bytes
|
|
59
|
+
*/
|
|
60
|
+
export const generateRandomBytes = (length) => {
|
|
61
|
+
return new Uint8Array(randomBytes(length));
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* Generate a salt for key derivation
|
|
65
|
+
*/
|
|
66
|
+
export const generateSalt = () => {
|
|
67
|
+
return generateRandomBytes(ARGON2_SALT_LENGTH);
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* Generate a random master key
|
|
71
|
+
*/
|
|
72
|
+
export const generateMasterKey = () => {
|
|
73
|
+
return generateRandomBytes(AES_KEY_LENGTH);
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* Derive a key from a passphrase using Argon2id
|
|
77
|
+
*/
|
|
78
|
+
export const deriveKeyFromPassphrase = (passphrase, salt) => {
|
|
79
|
+
const passphraseBytes = new TextEncoder().encode(passphrase);
|
|
80
|
+
const key = argon2id(passphraseBytes, salt, {
|
|
81
|
+
t: ARGON2_ITERATIONS,
|
|
82
|
+
m: ARGON2_MEMORY,
|
|
83
|
+
p: ARGON2_PARALLELISM,
|
|
84
|
+
dkLen: AES_KEY_LENGTH,
|
|
85
|
+
});
|
|
86
|
+
return { key, salt };
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
* Generate a recovery key (8 random words)
|
|
90
|
+
*/
|
|
91
|
+
export const generateRecoveryKey = () => {
|
|
92
|
+
// Generate 11 bytes (88 bits) of randomness
|
|
93
|
+
// 8 words * 8 bits each = 64 bits minimum, but we use indices into 256-word list
|
|
94
|
+
// so each word is 8 bits (log2(256) = 8)
|
|
95
|
+
const bytes = generateRandomBytes(8);
|
|
96
|
+
const words = Array.from(bytes).map((byte) => {
|
|
97
|
+
const index = byte % WORDLIST.length;
|
|
98
|
+
return WORDLIST[index];
|
|
99
|
+
});
|
|
100
|
+
return { words, bytes };
|
|
101
|
+
};
|
|
102
|
+
/**
|
|
103
|
+
* Parse a recovery key from words
|
|
104
|
+
*/
|
|
105
|
+
export const parseRecoveryKey = (wordsInput) => {
|
|
106
|
+
const words = wordsInput
|
|
107
|
+
.toLowerCase()
|
|
108
|
+
.split(/[-\s]+/)
|
|
109
|
+
.filter(Boolean);
|
|
110
|
+
if (words.length !== 8) {
|
|
111
|
+
return null;
|
|
112
|
+
}
|
|
113
|
+
const indices = words.map((word) => WORDLIST.indexOf(word));
|
|
114
|
+
if (indices.some((index) => index === -1)) {
|
|
115
|
+
return null;
|
|
116
|
+
}
|
|
117
|
+
const bytes = new Uint8Array(indices);
|
|
118
|
+
return { words, bytes };
|
|
119
|
+
};
|
|
120
|
+
/**
|
|
121
|
+
* Derive a key from a recovery key
|
|
122
|
+
*/
|
|
123
|
+
export const deriveKeyFromRecoveryKey = (recoveryKey, salt) => {
|
|
124
|
+
// Use the recovery key bytes as input to Argon2id
|
|
125
|
+
const key = argon2id(recoveryKey.bytes, salt, {
|
|
126
|
+
t: ARGON2_ITERATIONS,
|
|
127
|
+
m: ARGON2_MEMORY,
|
|
128
|
+
p: ARGON2_PARALLELISM,
|
|
129
|
+
dkLen: AES_KEY_LENGTH,
|
|
130
|
+
});
|
|
131
|
+
return { key, salt };
|
|
132
|
+
};
|
|
133
|
+
/**
|
|
134
|
+
* Encrypt data using AES-256-GCM
|
|
135
|
+
*/
|
|
136
|
+
export const encrypt = (plaintext, key) => {
|
|
137
|
+
const iv = generateRandomBytes(AES_IV_LENGTH);
|
|
138
|
+
const cipher = createCipheriv(AES_ALGORITHM, key, iv, {
|
|
139
|
+
authTagLength: AES_TAG_LENGTH,
|
|
140
|
+
});
|
|
141
|
+
const encrypted = Buffer.concat([cipher.update(plaintext), cipher.final()]);
|
|
142
|
+
const tag = cipher.getAuthTag();
|
|
143
|
+
return {
|
|
144
|
+
ciphertext: new Uint8Array(encrypted),
|
|
145
|
+
iv,
|
|
146
|
+
tag: new Uint8Array(tag),
|
|
147
|
+
};
|
|
148
|
+
};
|
|
149
|
+
/**
|
|
150
|
+
* Decrypt data using AES-256-GCM
|
|
151
|
+
*/
|
|
152
|
+
export const decrypt = (ciphertext, key, iv, tag) => {
|
|
153
|
+
const decipher = createDecipheriv(AES_ALGORITHM, key, iv, {
|
|
154
|
+
authTagLength: AES_TAG_LENGTH,
|
|
155
|
+
});
|
|
156
|
+
decipher.setAuthTag(tag);
|
|
157
|
+
const decrypted = Buffer.concat([
|
|
158
|
+
decipher.update(ciphertext),
|
|
159
|
+
decipher.final(),
|
|
160
|
+
]);
|
|
161
|
+
return new Uint8Array(decrypted);
|
|
162
|
+
};
|
|
163
|
+
/**
|
|
164
|
+
* Encrypt a string and return base64-encoded components
|
|
165
|
+
*/
|
|
166
|
+
export const encryptString = (plaintext, key) => {
|
|
167
|
+
const plaintextBytes = new TextEncoder().encode(plaintext);
|
|
168
|
+
const { ciphertext, iv, tag } = encrypt(plaintextBytes, key);
|
|
169
|
+
return {
|
|
170
|
+
ciphertext: Buffer.from(ciphertext).toString("base64"),
|
|
171
|
+
iv: Buffer.from(iv).toString("base64"),
|
|
172
|
+
tag: Buffer.from(tag).toString("base64"),
|
|
173
|
+
};
|
|
174
|
+
};
|
|
175
|
+
/**
|
|
176
|
+
* Decrypt base64-encoded components to a string
|
|
177
|
+
*/
|
|
178
|
+
export const decryptString = (ciphertext, key, iv, tag) => {
|
|
179
|
+
const ciphertextBytes = new Uint8Array(Buffer.from(ciphertext, "base64"));
|
|
180
|
+
const ivBytes = new Uint8Array(Buffer.from(iv, "base64"));
|
|
181
|
+
const tagBytes = new Uint8Array(Buffer.from(tag, "base64"));
|
|
182
|
+
const decrypted = decrypt(ciphertextBytes, key, ivBytes, tagBytes);
|
|
183
|
+
return new TextDecoder().decode(decrypted);
|
|
184
|
+
};
|
|
185
|
+
/**
|
|
186
|
+
* Encrypt the master key with a derived key (for storage)
|
|
187
|
+
*/
|
|
188
|
+
export const encryptMasterKey = (masterKey, derivedKey) => {
|
|
189
|
+
const { ciphertext, iv, tag } = encrypt(masterKey, derivedKey);
|
|
190
|
+
return { encrypted: ciphertext, iv, tag };
|
|
191
|
+
};
|
|
192
|
+
/**
|
|
193
|
+
* Decrypt the master key with a derived key
|
|
194
|
+
*/
|
|
195
|
+
export const decryptMasterKey = (encryptedMasterKey, derivedKey, iv, tag) => {
|
|
196
|
+
return decrypt(encryptedMasterKey, derivedKey, iv, tag);
|
|
197
|
+
};
|
|
198
|
+
/**
|
|
199
|
+
* Format recovery key for display
|
|
200
|
+
*/
|
|
201
|
+
export const formatRecoveryKey = (recoveryKey) => {
|
|
202
|
+
return recoveryKey.words.map((w) => w.toUpperCase()).join("-");
|
|
203
|
+
};
|
|
204
|
+
/**
|
|
205
|
+
* Convert Uint8Array to base64 string
|
|
206
|
+
*/
|
|
207
|
+
export const toBase64 = (bytes) => {
|
|
208
|
+
return Buffer.from(bytes).toString("base64");
|
|
209
|
+
};
|
|
210
|
+
/**
|
|
211
|
+
* Convert base64 string to Uint8Array
|
|
212
|
+
*/
|
|
213
|
+
export const fromBase64 = (base64) => {
|
|
214
|
+
return new Uint8Array(Buffer.from(base64, "base64"));
|
|
215
|
+
};
|
|
216
|
+
/**
|
|
217
|
+
* Compute SHA-256 hash of content, return short hash (8 chars like git)
|
|
218
|
+
*/
|
|
219
|
+
export const computeContentHash = (content) => {
|
|
220
|
+
return createHash("sha256").update(content, "utf8").digest("hex").slice(0, 8);
|
|
221
|
+
};
|
|
222
|
+
/**
|
|
223
|
+
* Compute full SHA-256 hash of content
|
|
224
|
+
*/
|
|
225
|
+
export const computeFullHash = (content) => {
|
|
226
|
+
return createHash("sha256").update(content, "utf8").digest("hex");
|
|
227
|
+
};
|
|
228
|
+
//# sourceMappingURL=crypto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crypto.js","sourceRoot":"","sources":["../src/crypto.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EACL,WAAW,EACX,cAAc,EACd,gBAAgB,EAChB,UAAU,GACX,MAAM,aAAa,CAAC;AAGrB,gCAAgC;AAChC,MAAM,cAAc,GAAG,EAAE,CAAC,CAAC,WAAW;AACtC,MAAM,aAAa,GAAG,EAAE,CAAC,CAAC,gCAAgC;AAC1D,MAAM,cAAc,GAAG,EAAE,CAAC,CAAC,WAAW;AACtC,MAAM,aAAa,GAAG,aAAa,CAAC;AAEpC,iDAAiD;AACjD,MAAM,aAAa,GAAG,KAAK,CAAC,CAAC,SAAS;AACtC,MAAM,iBAAiB,GAAG,CAAC,CAAC;AAC5B,MAAM,kBAAkB,GAAG,CAAC,CAAC;AAC7B,MAAM,kBAAkB,GAAG,EAAE,CAAC;AAE9B,0EAA0E;AAC1E,MAAM,QAAQ,GAAG;IACf,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO;IACtE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO;IACtE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO;IACtE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,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,CAAC,CAAC,CAAC;AAChF,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,OAAe,EAAU,EAAE;IACzD,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AACpE,CAAC,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @claude-skill-sync/core
|
|
3
|
+
*
|
|
4
|
+
* Core encryption and skill management for Claude Skill Sync
|
|
5
|
+
*/
|
|
6
|
+
export type { Config, Credentials, DerivedKey, EncryptedBlob, RecoveryKey, Skill, SkillMetadata, SkillType, SyncedSkill, SyncStatus, Vault, } from "./types.js";
|
|
7
|
+
export { computeContentHash, computeFullHash, decrypt, decryptMasterKey, decryptString, deriveKeyFromPassphrase, deriveKeyFromRecoveryKey, encrypt, encryptMasterKey, encryptString, formatRecoveryKey, fromBase64, generateMasterKey, generateRandomBytes, generateRecoveryKey, generateSalt, parseRecoveryKey, toBase64, } from "./crypto.js";
|
|
8
|
+
export { buildDependencyGraph, computeSkillHash, detectImplicitDependencies, formatSkillSize, getClaudeDir, getExplicitDependencies, getSkillDependencies, getSkillDescription, getSkillKey, getSkillSize, getSkillsPath, getSkillTools, getSkillTriggers, listAllSkills, listDirectorySkills, listSkills, parseFrontmatter, readDirectorySkill, readSkill, serializeFrontmatter, validateSkill, } from "./skill.js";
|
|
9
|
+
export type { DependencyNode } from "./skill.js";
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,YAAY,EACV,MAAM,EACN,WAAW,EACX,UAAU,EACV,aAAa,EACb,WAAW,EACX,KAAK,EACL,aAAa,EACb,SAAS,EACT,WAAW,EACX,UAAU,EACV,KAAK,GACN,MAAM,YAAY,CAAC;AAGpB,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,OAAO,EACP,gBAAgB,EAChB,aAAa,EACb,uBAAuB,EACvB,wBAAwB,EACxB,OAAO,EACP,gBAAgB,EAChB,aAAa,EACb,iBAAiB,EACjB,UAAU,EACV,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACnB,YAAY,EACZ,gBAAgB,EAChB,QAAQ,GACT,MAAM,aAAa,CAAC;AAGrB,OAAO,EACL,oBAAoB,EACpB,gBAAgB,EAChB,0BAA0B,EAC1B,eAAe,EACf,YAAY,EACZ,uBAAuB,EACvB,oBAAoB,EACpB,mBAAmB,EACnB,WAAW,EACX,YAAY,EACZ,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,aAAa,EACb,mBAAmB,EACnB,UAAU,EACV,gBAAgB,EAChB,kBAAkB,EAClB,SAAS,EACT,oBAAoB,EACpB,aAAa,GACd,MAAM,YAAY,CAAC;AAGpB,YAAY,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @claude-skill-sync/core
|
|
3
|
+
*
|
|
4
|
+
* Core encryption and skill management for Claude Skill Sync
|
|
5
|
+
*/
|
|
6
|
+
// Crypto operations
|
|
7
|
+
export { computeContentHash, computeFullHash, decrypt, decryptMasterKey, decryptString, deriveKeyFromPassphrase, deriveKeyFromRecoveryKey, encrypt, encryptMasterKey, encryptString, formatRecoveryKey, fromBase64, generateMasterKey, generateRandomBytes, generateRecoveryKey, generateSalt, parseRecoveryKey, toBase64, } from "./crypto.js";
|
|
8
|
+
// Skill operations
|
|
9
|
+
export { buildDependencyGraph, computeSkillHash, detectImplicitDependencies, formatSkillSize, getClaudeDir, getExplicitDependencies, getSkillDependencies, getSkillDescription, getSkillKey, getSkillSize, getSkillsPath, getSkillTools, getSkillTriggers, listAllSkills, listDirectorySkills, listSkills, parseFrontmatter, readDirectorySkill, readSkill, serializeFrontmatter, validateSkill, } from "./skill.js";
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAiBH,oBAAoB;AACpB,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,OAAO,EACP,gBAAgB,EAChB,aAAa,EACb,uBAAuB,EACvB,wBAAwB,EACxB,OAAO,EACP,gBAAgB,EAChB,aAAa,EACb,iBAAiB,EACjB,UAAU,EACV,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACnB,YAAY,EACZ,gBAAgB,EAChB,QAAQ,GACT,MAAM,aAAa,CAAC;AAErB,mBAAmB;AACnB,OAAO,EACL,oBAAoB,EACpB,gBAAgB,EAChB,0BAA0B,EAC1B,eAAe,EACf,YAAY,EACZ,uBAAuB,EACvB,oBAAoB,EACpB,mBAAmB,EACnB,WAAW,EACX,YAAY,EACZ,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,aAAa,EACb,mBAAmB,EACnB,UAAU,EACV,gBAAgB,EAChB,kBAAkB,EAClB,SAAS,EACT,oBAAoB,EACpB,aAAa,GACd,MAAM,YAAY,CAAC"}
|
package/dist/skill.d.ts
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Skill parsing and validation module
|
|
3
|
+
*/
|
|
4
|
+
import type { Skill, SkillMetadata, SkillType } from "./types.js";
|
|
5
|
+
/**
|
|
6
|
+
* Parse YAML-like frontmatter from skill content
|
|
7
|
+
* Simple parser that doesn't require external dependencies
|
|
8
|
+
*/
|
|
9
|
+
export declare const parseFrontmatter: (content: string) => {
|
|
10
|
+
metadata: SkillMetadata;
|
|
11
|
+
body: string;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Serialize metadata to frontmatter
|
|
15
|
+
*/
|
|
16
|
+
export declare const serializeFrontmatter: (metadata: SkillMetadata, body: string) => string;
|
|
17
|
+
/**
|
|
18
|
+
* Get the skills directory path
|
|
19
|
+
*/
|
|
20
|
+
export declare const getSkillsPath: (customPath?: string) => string;
|
|
21
|
+
/**
|
|
22
|
+
* Read a single skill file
|
|
23
|
+
*/
|
|
24
|
+
export declare const readSkill: (filePath: string, type?: SkillType) => Promise<Skill>;
|
|
25
|
+
/**
|
|
26
|
+
* Read a directory-based skill (like ~/.claude/skills/*)
|
|
27
|
+
*/
|
|
28
|
+
export declare const readDirectorySkill: (dirPath: string, type?: SkillType) => Promise<Skill | null>;
|
|
29
|
+
/**
|
|
30
|
+
* List all skills in a directory (file-based)
|
|
31
|
+
*/
|
|
32
|
+
export declare const listSkills: (skillsPath?: string, type?: SkillType) => Promise<Skill[]>;
|
|
33
|
+
/**
|
|
34
|
+
* List directory-based skills (like ~/.claude/skills/*)
|
|
35
|
+
*/
|
|
36
|
+
export declare const listDirectorySkills: (basePath: string, type?: SkillType) => Promise<Skill[]>;
|
|
37
|
+
/**
|
|
38
|
+
* Get the base Claude directory
|
|
39
|
+
*/
|
|
40
|
+
export declare const getClaudeDir: () => string;
|
|
41
|
+
/**
|
|
42
|
+
* List ALL skills from all directories (commands, skills, agents)
|
|
43
|
+
*/
|
|
44
|
+
export declare const listAllSkills: () => Promise<Skill[]>;
|
|
45
|
+
/**
|
|
46
|
+
* Validate a skill structure
|
|
47
|
+
*/
|
|
48
|
+
export declare const validateSkill: (skill: Skill) => {
|
|
49
|
+
valid: boolean;
|
|
50
|
+
errors: string[];
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Get skill triggers from metadata or content
|
|
54
|
+
*/
|
|
55
|
+
export declare const getSkillTriggers: (skill: Skill) => string[];
|
|
56
|
+
/**
|
|
57
|
+
* Extract a summary/description from skill content
|
|
58
|
+
*/
|
|
59
|
+
export declare const getSkillDescription: (skill: Skill) => string;
|
|
60
|
+
/**
|
|
61
|
+
* Calculate skill size in bytes
|
|
62
|
+
*/
|
|
63
|
+
export declare const getSkillSize: (skill: Skill) => number;
|
|
64
|
+
/**
|
|
65
|
+
* Format skill size for display
|
|
66
|
+
*/
|
|
67
|
+
export declare const formatSkillSize: (bytes: number) => string;
|
|
68
|
+
/**
|
|
69
|
+
* Get tools used by a skill/agent
|
|
70
|
+
*/
|
|
71
|
+
export declare const getSkillTools: (skill: Skill) => string[];
|
|
72
|
+
/**
|
|
73
|
+
* Extract explicit dependencies from metadata
|
|
74
|
+
*/
|
|
75
|
+
export declare const getExplicitDependencies: (skill: Skill) => string[];
|
|
76
|
+
/**
|
|
77
|
+
* Detect implicit dependencies by scanning content for references
|
|
78
|
+
*/
|
|
79
|
+
export declare const detectImplicitDependencies: (skill: Skill, allSkillNames: string[]) => string[];
|
|
80
|
+
/**
|
|
81
|
+
* Get all dependencies for a skill (explicit + implicit)
|
|
82
|
+
*/
|
|
83
|
+
export declare const getSkillDependencies: (skill: Skill, allSkillNames: string[]) => {
|
|
84
|
+
explicit: string[];
|
|
85
|
+
implicit: string[];
|
|
86
|
+
};
|
|
87
|
+
/** Dependency graph node */
|
|
88
|
+
export type DependencyNode = {
|
|
89
|
+
name: string;
|
|
90
|
+
type: SkillType;
|
|
91
|
+
dependencies: string[];
|
|
92
|
+
dependents: string[];
|
|
93
|
+
tools: string[];
|
|
94
|
+
model: string | null;
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
* Build a dependency graph from all skills
|
|
98
|
+
*/
|
|
99
|
+
export declare const buildDependencyGraph: (skills: Skill[]) => Map<string, DependencyNode>;
|
|
100
|
+
/**
|
|
101
|
+
* Compute a deterministic hash for a skill's content
|
|
102
|
+
* This hash is computed BEFORE encryption so same content = same hash
|
|
103
|
+
*/
|
|
104
|
+
export declare const computeSkillHash: (skill: Skill) => string;
|
|
105
|
+
/**
|
|
106
|
+
* Get the skill key (type:name format used for indexing)
|
|
107
|
+
*/
|
|
108
|
+
export declare const getSkillKey: (skill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AgB,GAAI,OAAO,KAAK,KAAG,MAS/C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,WAAW,GAAI,OAAO,KAAK,KAAG,MAE1C,CAAC"}
|
package/dist/skill.js
ADDED
|
@@ -0,0 +1,453 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Skill parsing and validation module
|
|
3
|
+
*/
|
|
4
|
+
import { readFile, readdir, stat } from "node:fs/promises";
|
|
5
|
+
import { join, basename, extname } from "node:path";
|
|
6
|
+
import { computeContentHash } from "./crypto.js";
|
|
7
|
+
/** Claude Code directory structure */
|
|
8
|
+
const CLAUDE_DIR = ".claude";
|
|
9
|
+
const SKILL_DIRS = [
|
|
10
|
+
{ path: "commands", type: "command", isDirectory: false },
|
|
11
|
+
{ path: "skills", type: "skill", isDirectory: true },
|
|
12
|
+
{ path: "agents", type: "agent", isDirectory: false },
|
|
13
|
+
];
|
|
14
|
+
/** Default skills directory (legacy) */
|
|
15
|
+
const DEFAULT_SKILLS_PATH = ".claude/commands";
|
|
16
|
+
/**
|
|
17
|
+
* Parse YAML-like frontmatter from skill content
|
|
18
|
+
* Simple parser that doesn't require external dependencies
|
|
19
|
+
*/
|
|
20
|
+
export const parseFrontmatter = (content) => {
|
|
21
|
+
const frontmatterRegex = /^---\r?\n([\s\S]*?)\r?\n---\r?\n([\s\S]*)$/;
|
|
22
|
+
const match = content.match(frontmatterRegex);
|
|
23
|
+
const defaultMetadata = {
|
|
24
|
+
description: null,
|
|
25
|
+
triggers: null,
|
|
26
|
+
author: null,
|
|
27
|
+
version: null,
|
|
28
|
+
"allowed-tools": null,
|
|
29
|
+
tools: null,
|
|
30
|
+
model: null,
|
|
31
|
+
permissionMode: null,
|
|
32
|
+
"depends-on": null,
|
|
33
|
+
category: null,
|
|
34
|
+
tags: null,
|
|
35
|
+
};
|
|
36
|
+
if (!match) {
|
|
37
|
+
return {
|
|
38
|
+
metadata: defaultMetadata,
|
|
39
|
+
body: content,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
const [, frontmatter, body] = match;
|
|
43
|
+
const metadata = { ...defaultMetadata };
|
|
44
|
+
// Simple YAML-like parsing (key: value or key: [array])
|
|
45
|
+
const lines = frontmatter.split("\n");
|
|
46
|
+
lines.forEach((line) => {
|
|
47
|
+
const trimmed = line.trim();
|
|
48
|
+
if (!trimmed || trimmed.startsWith("#"))
|
|
49
|
+
return;
|
|
50
|
+
const colonIndex = trimmed.indexOf(":");
|
|
51
|
+
if (colonIndex === -1)
|
|
52
|
+
return;
|
|
53
|
+
const key = trimmed.slice(0, colonIndex).trim();
|
|
54
|
+
let value = trimmed.slice(colonIndex + 1).trim();
|
|
55
|
+
// Handle arrays like [item1, item2]
|
|
56
|
+
if (value.startsWith("[") && value.endsWith("]")) {
|
|
57
|
+
const items = value
|
|
58
|
+
.slice(1, -1)
|
|
59
|
+
.split(",")
|
|
60
|
+
.map((s) => s.trim().replace(/^["']|["']$/g, ""))
|
|
61
|
+
.filter(Boolean);
|
|
62
|
+
metadata[key] = items;
|
|
63
|
+
}
|
|
64
|
+
// Handle quoted strings
|
|
65
|
+
else if ((value.startsWith('"') && value.endsWith('"')) ||
|
|
66
|
+
(value.startsWith("'") && value.endsWith("'"))) {
|
|
67
|
+
metadata[key] = value.slice(1, -1);
|
|
68
|
+
}
|
|
69
|
+
// Handle plain values
|
|
70
|
+
else {
|
|
71
|
+
metadata[key] = value;
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
return { metadata, body: body ?? "" };
|
|
75
|
+
};
|
|
76
|
+
/**
|
|
77
|
+
* Serialize metadata to frontmatter
|
|
78
|
+
*/
|
|
79
|
+
export const serializeFrontmatter = (metadata, body) => {
|
|
80
|
+
const entries = Object.entries(metadata).filter(([, v]) => v !== undefined && v !== null);
|
|
81
|
+
if (entries.length === 0) {
|
|
82
|
+
return body;
|
|
83
|
+
}
|
|
84
|
+
const lines = ["---"];
|
|
85
|
+
const metadataLines = entries.map(([key, value]) => {
|
|
86
|
+
if (Array.isArray(value)) {
|
|
87
|
+
return `${key}: [${value.map((v) => `"${v}"`).join(", ")}]`;
|
|
88
|
+
}
|
|
89
|
+
if (typeof value === "string") {
|
|
90
|
+
// Quote strings with special characters
|
|
91
|
+
if (value.includes(":") || value.includes("#") || value.includes('"')) {
|
|
92
|
+
return `${key}: "${value.replace(/"/g, '\\"')}"`;
|
|
93
|
+
}
|
|
94
|
+
return `${key}: ${value}`;
|
|
95
|
+
}
|
|
96
|
+
return `${key}: ${String(value)}`;
|
|
97
|
+
});
|
|
98
|
+
lines.push(...metadataLines);
|
|
99
|
+
lines.push("---");
|
|
100
|
+
lines.push(body);
|
|
101
|
+
return lines.join("\n");
|
|
102
|
+
};
|
|
103
|
+
/**
|
|
104
|
+
* Get the skills directory path
|
|
105
|
+
*/
|
|
106
|
+
export const getSkillsPath = (customPath) => {
|
|
107
|
+
if (customPath) {
|
|
108
|
+
return customPath;
|
|
109
|
+
}
|
|
110
|
+
const home = process.env["HOME"] ?? process.env["USERPROFILE"] ?? "";
|
|
111
|
+
return join(home, DEFAULT_SKILLS_PATH);
|
|
112
|
+
};
|
|
113
|
+
/**
|
|
114
|
+
* Read a single skill file
|
|
115
|
+
*/
|
|
116
|
+
export const readSkill = async (filePath, type = "command") => {
|
|
117
|
+
const content = await readFile(filePath, "utf-8");
|
|
118
|
+
const { metadata } = parseFrontmatter(content);
|
|
119
|
+
const stats = await stat(filePath);
|
|
120
|
+
const name = basename(filePath, extname(filePath));
|
|
121
|
+
return {
|
|
122
|
+
name,
|
|
123
|
+
content,
|
|
124
|
+
metadata,
|
|
125
|
+
path: filePath,
|
|
126
|
+
modifiedAt: stats.mtime,
|
|
127
|
+
type,
|
|
128
|
+
};
|
|
129
|
+
};
|
|
130
|
+
/**
|
|
131
|
+
* Read a directory-based skill (like ~/.claude/skills/*)
|
|
132
|
+
*/
|
|
133
|
+
export const readDirectorySkill = async (dirPath, type = "skill") => {
|
|
134
|
+
try {
|
|
135
|
+
const entries = await readdir(dirPath, { withFileTypes: true });
|
|
136
|
+
const name = basename(dirPath);
|
|
137
|
+
// Find the main skill file (SKILL.md, skill.md, or <name>.md)
|
|
138
|
+
const mainFile = entries.find((e) => {
|
|
139
|
+
if (!e.isFile())
|
|
140
|
+
return false;
|
|
141
|
+
const lower = e.name.toLowerCase();
|
|
142
|
+
return (lower === "skill.md" ||
|
|
143
|
+
lower === `${name.toLowerCase()}.md` ||
|
|
144
|
+
lower === "index.md");
|
|
145
|
+
});
|
|
146
|
+
if (!mainFile)
|
|
147
|
+
return null;
|
|
148
|
+
const mainPath = join(dirPath, mainFile.name);
|
|
149
|
+
const content = await readFile(mainPath, "utf-8");
|
|
150
|
+
const { metadata } = parseFrontmatter(content);
|
|
151
|
+
const stats = await stat(mainPath);
|
|
152
|
+
// Read supporting files
|
|
153
|
+
const supportingFiles = await Promise.all(entries
|
|
154
|
+
.filter((e) => e.isFile() && e.name !== mainFile.name)
|
|
155
|
+
.map(async (e) => {
|
|
156
|
+
const filePath = join(dirPath, e.name);
|
|
157
|
+
const fileContent = await readFile(filePath, "utf-8");
|
|
158
|
+
return { name: e.name, content: fileContent };
|
|
159
|
+
}));
|
|
160
|
+
return {
|
|
161
|
+
name,
|
|
162
|
+
content,
|
|
163
|
+
metadata,
|
|
164
|
+
path: dirPath,
|
|
165
|
+
modifiedAt: stats.mtime,
|
|
166
|
+
type,
|
|
167
|
+
files: supportingFiles.length > 0 ? supportingFiles : undefined,
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
catch {
|
|
171
|
+
return null;
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
/**
|
|
175
|
+
* List all skills in a directory (file-based)
|
|
176
|
+
*/
|
|
177
|
+
export const listSkills = async (skillsPath, type = "command") => {
|
|
178
|
+
const dirPath = getSkillsPath(skillsPath);
|
|
179
|
+
try {
|
|
180
|
+
const entries = await readdir(dirPath, { withFileTypes: true });
|
|
181
|
+
const skillPromises = entries
|
|
182
|
+
.filter((entry) => {
|
|
183
|
+
if (!entry.isFile())
|
|
184
|
+
return false;
|
|
185
|
+
const ext = extname(entry.name).toLowerCase();
|
|
186
|
+
return ext === ".md" || ext === ".txt" || ext === "";
|
|
187
|
+
})
|
|
188
|
+
.map(async (entry) => {
|
|
189
|
+
const filePath = join(dirPath, entry.name);
|
|
190
|
+
try {
|
|
191
|
+
return await readSkill(filePath, type);
|
|
192
|
+
}
|
|
193
|
+
catch {
|
|
194
|
+
// Skip files that can't be read
|
|
195
|
+
return null;
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
const skills = (await Promise.all(skillPromises)).filter((skill) => skill !== null);
|
|
199
|
+
return skills.sort((a, b) => a.name.localeCompare(b.name));
|
|
200
|
+
}
|
|
201
|
+
catch {
|
|
202
|
+
// Directory doesn't exist or can't be read
|
|
203
|
+
return [];
|
|
204
|
+
}
|
|
205
|
+
};
|
|
206
|
+
/**
|
|
207
|
+
* List directory-based skills (like ~/.claude/skills/*)
|
|
208
|
+
*/
|
|
209
|
+
export const listDirectorySkills = async (basePath, type = "skill") => {
|
|
210
|
+
try {
|
|
211
|
+
const entries = await readdir(basePath, { withFileTypes: true });
|
|
212
|
+
const skillPromises = entries
|
|
213
|
+
.filter((entry) => entry.isDirectory() && !entry.name.startsWith("."))
|
|
214
|
+
.map(async (entry) => {
|
|
215
|
+
const dirPath = join(basePath, entry.name);
|
|
216
|
+
return await readDirectorySkill(dirPath, type);
|
|
217
|
+
});
|
|
218
|
+
const skills = (await Promise.all(skillPromises)).filter((skill) => skill !== null);
|
|
219
|
+
return skills.sort((a, b) => a.name.localeCompare(b.name));
|
|
220
|
+
}
|
|
221
|
+
catch {
|
|
222
|
+
return [];
|
|
223
|
+
}
|
|
224
|
+
};
|
|
225
|
+
/**
|
|
226
|
+
* Get the base Claude directory
|
|
227
|
+
*/
|
|
228
|
+
export const getClaudeDir = () => {
|
|
229
|
+
const home = process.env["HOME"] ?? process.env["USERPROFILE"] ?? "";
|
|
230
|
+
return join(home, CLAUDE_DIR);
|
|
231
|
+
};
|
|
232
|
+
/**
|
|
233
|
+
* List ALL skills from all directories (commands, skills, agents)
|
|
234
|
+
*/
|
|
235
|
+
export const listAllSkills = async () => {
|
|
236
|
+
const claudeDir = getClaudeDir();
|
|
237
|
+
const allSkillsPromises = SKILL_DIRS.map(async ({ path, type, isDirectory }) => {
|
|
238
|
+
const fullPath = join(claudeDir, path);
|
|
239
|
+
if (isDirectory) {
|
|
240
|
+
return await listDirectorySkills(fullPath, type);
|
|
241
|
+
}
|
|
242
|
+
return await listSkills(fullPath, type);
|
|
243
|
+
});
|
|
244
|
+
const skillArrays = await Promise.all(allSkillsPromises);
|
|
245
|
+
const allSkills = skillArrays.flat();
|
|
246
|
+
return allSkills.sort((a, b) => {
|
|
247
|
+
// Sort by type first, then by name
|
|
248
|
+
if (a.type !== b.type) {
|
|
249
|
+
const typeOrder = { command: 0, skill: 1, agent: 2 };
|
|
250
|
+
return typeOrder[a.type] - typeOrder[b.type];
|
|
251
|
+
}
|
|
252
|
+
return a.name.localeCompare(b.name);
|
|
253
|
+
});
|
|
254
|
+
};
|
|
255
|
+
/**
|
|
256
|
+
* Validate a skill structure
|
|
257
|
+
*/
|
|
258
|
+
export const validateSkill = (skill) => {
|
|
259
|
+
const errors = [];
|
|
260
|
+
if (!skill.name || skill.name.trim() === "") {
|
|
261
|
+
errors.push("Skill name is required");
|
|
262
|
+
}
|
|
263
|
+
if (!skill.content || skill.content.trim() === "") {
|
|
264
|
+
errors.push("Skill content is empty");
|
|
265
|
+
}
|
|
266
|
+
// Check for common issues
|
|
267
|
+
if (skill.name.includes(" ")) {
|
|
268
|
+
errors.push("Skill name should not contain spaces");
|
|
269
|
+
}
|
|
270
|
+
if (skill.name.startsWith(".")) {
|
|
271
|
+
errors.push("Skill name should not start with a dot");
|
|
272
|
+
}
|
|
273
|
+
return {
|
|
274
|
+
valid: errors.length === 0,
|
|
275
|
+
errors,
|
|
276
|
+
};
|
|
277
|
+
};
|
|
278
|
+
/**
|
|
279
|
+
* Get skill triggers from metadata or content
|
|
280
|
+
*/
|
|
281
|
+
export const getSkillTriggers = (skill) => {
|
|
282
|
+
const triggers = [];
|
|
283
|
+
// From metadata
|
|
284
|
+
if (skill.metadata["triggers"]) {
|
|
285
|
+
const metaTriggers = skill.metadata["triggers"];
|
|
286
|
+
if (Array.isArray(metaTriggers)) {
|
|
287
|
+
triggers.push(...metaTriggers.map(String));
|
|
288
|
+
}
|
|
289
|
+
else if (typeof metaTriggers === "string") {
|
|
290
|
+
triggers.push(metaTriggers);
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
// Skill name as trigger (e.g., /commit)
|
|
294
|
+
if (!triggers.includes(`/${skill.name}`)) {
|
|
295
|
+
triggers.push(`/${skill.name}`);
|
|
296
|
+
}
|
|
297
|
+
return triggers;
|
|
298
|
+
};
|
|
299
|
+
/**
|
|
300
|
+
* Extract a summary/description from skill content
|
|
301
|
+
*/
|
|
302
|
+
export const getSkillDescription = (skill) => {
|
|
303
|
+
// From metadata first
|
|
304
|
+
if (skill.metadata["description"]) {
|
|
305
|
+
return String(skill.metadata["description"]);
|
|
306
|
+
}
|
|
307
|
+
// Try to extract from first paragraph of content
|
|
308
|
+
const { body } = parseFrontmatter(skill.content);
|
|
309
|
+
const lines = body.split("\n").filter((l) => l.trim() !== "");
|
|
310
|
+
// Skip headings, find first paragraph
|
|
311
|
+
const firstParagraph = lines.find((line) => {
|
|
312
|
+
const trimmed = line.trim();
|
|
313
|
+
return !trimmed.startsWith("#") && trimmed.length > 10;
|
|
314
|
+
});
|
|
315
|
+
if (firstParagraph) {
|
|
316
|
+
const trimmed = firstParagraph.trim();
|
|
317
|
+
return trimmed.length > 100 ? trimmed.slice(0, 97) + "..." : trimmed;
|
|
318
|
+
}
|
|
319
|
+
return "No description";
|
|
320
|
+
};
|
|
321
|
+
/**
|
|
322
|
+
* Calculate skill size in bytes
|
|
323
|
+
*/
|
|
324
|
+
export const getSkillSize = (skill) => {
|
|
325
|
+
return new TextEncoder().encode(skill.content).length;
|
|
326
|
+
};
|
|
327
|
+
/**
|
|
328
|
+
* Format skill size for display
|
|
329
|
+
*/
|
|
330
|
+
export const formatSkillSize = (bytes) => {
|
|
331
|
+
if (bytes < 1024) {
|
|
332
|
+
return `${bytes} B`;
|
|
333
|
+
}
|
|
334
|
+
return `${(bytes / 1024).toFixed(1)} KB`;
|
|
335
|
+
};
|
|
336
|
+
/**
|
|
337
|
+
* Get tools used by a skill/agent
|
|
338
|
+
*/
|
|
339
|
+
export const getSkillTools = (skill) => {
|
|
340
|
+
const toolsStr = skill.metadata["allowed-tools"] ?? skill.metadata["tools"] ?? "";
|
|
341
|
+
if (!toolsStr || typeof toolsStr !== "string")
|
|
342
|
+
return [];
|
|
343
|
+
return toolsStr
|
|
344
|
+
.split(",")
|
|
345
|
+
.map((t) => t.trim())
|
|
346
|
+
.filter(Boolean);
|
|
347
|
+
};
|
|
348
|
+
/**
|
|
349
|
+
* Extract explicit dependencies from metadata
|
|
350
|
+
*/
|
|
351
|
+
export const getExplicitDependencies = (skill) => {
|
|
352
|
+
const deps = skill.metadata["depends-on"];
|
|
353
|
+
if (!deps)
|
|
354
|
+
return [];
|
|
355
|
+
if (Array.isArray(deps))
|
|
356
|
+
return deps.map(String);
|
|
357
|
+
if (typeof deps === "string")
|
|
358
|
+
return [deps];
|
|
359
|
+
return [];
|
|
360
|
+
};
|
|
361
|
+
/**
|
|
362
|
+
* Detect implicit dependencies by scanning content for references
|
|
363
|
+
*/
|
|
364
|
+
export const detectImplicitDependencies = (skill, allSkillNames) => {
|
|
365
|
+
const deps = new Set();
|
|
366
|
+
const content = skill.content;
|
|
367
|
+
// Pattern 1: Markdown links to other skills (../skill-name/SKILL.md)
|
|
368
|
+
const linkPattern = /\.\.\/([\w-]+)\/(?:SKILL|skill)\.md/gi;
|
|
369
|
+
let match;
|
|
370
|
+
while ((match = linkPattern.exec(content)) !== null) {
|
|
371
|
+
const ref = match[1];
|
|
372
|
+
if (ref && allSkillNames.includes(ref) && ref !== skill.name) {
|
|
373
|
+
deps.add(ref);
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
// Pattern 2: Slash command references (/skill-name)
|
|
377
|
+
const slashPattern = /(?:^|[^/\w])\/([a-z][\w-]*)/gi;
|
|
378
|
+
while ((match = slashPattern.exec(content)) !== null) {
|
|
379
|
+
const ref = match[1];
|
|
380
|
+
if (ref && allSkillNames.includes(ref) && ref !== skill.name) {
|
|
381
|
+
deps.add(ref);
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
// Pattern 3: "after /skill-name" or "from skill-name" patterns
|
|
385
|
+
const afterPattern = /(?:after|from|using|run|invoke)\s+\/?([a-z][\w-]*)/gi;
|
|
386
|
+
while ((match = afterPattern.exec(content)) !== null) {
|
|
387
|
+
const ref = match[1];
|
|
388
|
+
if (ref && allSkillNames.includes(ref) && ref !== skill.name) {
|
|
389
|
+
deps.add(ref);
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
return [...deps];
|
|
393
|
+
};
|
|
394
|
+
/**
|
|
395
|
+
* Get all dependencies for a skill (explicit + implicit)
|
|
396
|
+
*/
|
|
397
|
+
export const getSkillDependencies = (skill, allSkillNames) => {
|
|
398
|
+
const explicit = getExplicitDependencies(skill);
|
|
399
|
+
const implicit = detectImplicitDependencies(skill, allSkillNames).filter((d) => !explicit.includes(d));
|
|
400
|
+
return { explicit, implicit };
|
|
401
|
+
};
|
|
402
|
+
/**
|
|
403
|
+
* Build a dependency graph from all skills
|
|
404
|
+
*/
|
|
405
|
+
export const buildDependencyGraph = (skills) => {
|
|
406
|
+
const graph = new Map();
|
|
407
|
+
const allNames = skills.map((s) => s.name);
|
|
408
|
+
// First pass: create nodes with dependencies
|
|
409
|
+
skills.forEach((skill) => {
|
|
410
|
+
const { explicit, implicit } = getSkillDependencies(skill, allNames);
|
|
411
|
+
graph.set(skill.name, {
|
|
412
|
+
name: skill.name,
|
|
413
|
+
type: skill.type,
|
|
414
|
+
dependencies: [...explicit, ...implicit],
|
|
415
|
+
dependents: [],
|
|
416
|
+
tools: getSkillTools(skill),
|
|
417
|
+
model: typeof skill.metadata["model"] === "string"
|
|
418
|
+
? skill.metadata["model"]
|
|
419
|
+
: null,
|
|
420
|
+
});
|
|
421
|
+
});
|
|
422
|
+
// Second pass: populate dependents (reverse links)
|
|
423
|
+
graph.forEach((node) => {
|
|
424
|
+
node.dependencies.forEach((depName) => {
|
|
425
|
+
const depNode = graph.get(depName);
|
|
426
|
+
if (depNode && !depNode.dependents.includes(node.name)) {
|
|
427
|
+
depNode.dependents.push(node.name);
|
|
428
|
+
}
|
|
429
|
+
});
|
|
430
|
+
});
|
|
431
|
+
return graph;
|
|
432
|
+
};
|
|
433
|
+
/**
|
|
434
|
+
* Compute a deterministic hash for a skill's content
|
|
435
|
+
* This hash is computed BEFORE encryption so same content = same hash
|
|
436
|
+
*/
|
|
437
|
+
export const computeSkillHash = (skill) => {
|
|
438
|
+
// Create a canonical JSON representation
|
|
439
|
+
const canonical = JSON.stringify({
|
|
440
|
+
name: skill.name,
|
|
441
|
+
type: skill.type,
|
|
442
|
+
content: skill.content,
|
|
443
|
+
files: skill.files?.map((f) => ({ name: f.name, content: f.content })) ?? [],
|
|
444
|
+
});
|
|
445
|
+
return computeContentHash(canonical);
|
|
446
|
+
};
|
|
447
|
+
/**
|
|
448
|
+
* Get the skill key (type:name format used for indexing)
|
|
449
|
+
*/
|
|
450
|
+
export const getSkillKey = (skill) => {
|
|
451
|
+
return `${skill.type}:${skill.name}`;
|
|
452
|
+
};
|
|
453
|
+
//# sourceMappingURL=skill.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skill.js","sourceRoot":"","sources":["../src/skill.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW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/** Unique identifier */
|
|
7
|
+
id: string;
|
|
8
|
+
/** Base64 encoded encrypted data */
|
|
9
|
+
ciphertext: string;
|
|
10
|
+
/** Base64 encoded initialization vector */
|
|
11
|
+
iv: string;
|
|
12
|
+
/** Base64 encoded authentication tag (for AES-GCM) */
|
|
13
|
+
tag: string;
|
|
14
|
+
/** ISO timestamp of last update */
|
|
15
|
+
updatedAt: string;
|
|
16
|
+
};
|
|
17
|
+
/** Type of skill/command/agent */
|
|
18
|
+
export type SkillType = "command" | "skill" | "agent";
|
|
19
|
+
/** Decrypted skill data */
|
|
20
|
+
export type Skill = {
|
|
21
|
+
/** Skill name (derived from filename) */
|
|
22
|
+
name: string;
|
|
23
|
+
/** Raw skill content (markdown) */
|
|
24
|
+
content: string;
|
|
25
|
+
/** Parsed metadata from frontmatter */
|
|
26
|
+
metadata: SkillMetadata;
|
|
27
|
+
/** Local file path */
|
|
28
|
+
path: string;
|
|
29
|
+
/** Last modified timestamp */
|
|
30
|
+
modifiedAt: Date;
|
|
31
|
+
/** Type of skill */
|
|
32
|
+
type: SkillType;
|
|
33
|
+
/** Supporting files (for directory-based skills) */
|
|
34
|
+
files?: {
|
|
35
|
+
name: string;
|
|
36
|
+
content: string;
|
|
37
|
+
}[];
|
|
38
|
+
};
|
|
39
|
+
/** Skill metadata from frontmatter */
|
|
40
|
+
export type SkillMetadata = {
|
|
41
|
+
/** Skill description */
|
|
42
|
+
description: string | null;
|
|
43
|
+
/** Trigger commands (e.g., /deploy) */
|
|
44
|
+
triggers: string[] | null;
|
|
45
|
+
/** Skill author */
|
|
46
|
+
author: string | null;
|
|
47
|
+
/** Skill version */
|
|
48
|
+
version: string | null;
|
|
49
|
+
/** Allowed tools (for skills/agents) */
|
|
50
|
+
"allowed-tools": string | null;
|
|
51
|
+
tools: string | null;
|
|
52
|
+
/** Model preference (for agents) */
|
|
53
|
+
model: string | null;
|
|
54
|
+
/** Permission mode (for agents) */
|
|
55
|
+
permissionMode: string | null;
|
|
56
|
+
/** Explicit dependencies */
|
|
57
|
+
"depends-on": string[] | null;
|
|
58
|
+
/** Category for grouping */
|
|
59
|
+
category: string | null;
|
|
60
|
+
/** Tags for filtering */
|
|
61
|
+
tags: string[] | null;
|
|
62
|
+
/** Custom fields */
|
|
63
|
+
[key: string]: unknown;
|
|
64
|
+
};
|
|
65
|
+
/** Sync status for a skill */
|
|
66
|
+
export type SyncStatus = "synced" | "local_only" | "remote_only" | "local_modified" | "remote_modified" | "conflict";
|
|
67
|
+
/** Skill with sync information */
|
|
68
|
+
export type SyncedSkill = Skill & {
|
|
69
|
+
/** Current sync status */
|
|
70
|
+
syncStatus: SyncStatus;
|
|
71
|
+
/** Remote blob ID if synced */
|
|
72
|
+
remoteId: string | null;
|
|
73
|
+
/** Remote last modified */
|
|
74
|
+
remoteModifiedAt: Date | null;
|
|
75
|
+
};
|
|
76
|
+
/** User vault containing encryption keys */
|
|
77
|
+
export type Vault = {
|
|
78
|
+
/** Salt for key derivation (stored on server) */
|
|
79
|
+
salt: Uint8Array;
|
|
80
|
+
/** Encrypted master key (encrypted with derived key) */
|
|
81
|
+
encryptedMasterKey: Uint8Array;
|
|
82
|
+
/** Master key IV */
|
|
83
|
+
masterKeyIv: Uint8Array;
|
|
84
|
+
/** Master key auth tag */
|
|
85
|
+
masterKeyTag: Uint8Array;
|
|
86
|
+
};
|
|
87
|
+
/** Derived key material from passphrase */
|
|
88
|
+
export type DerivedKey = {
|
|
89
|
+
/** The derived key bytes */
|
|
90
|
+
key: Uint8Array;
|
|
91
|
+
/** Salt used for derivation */
|
|
92
|
+
salt: Uint8Array;
|
|
93
|
+
};
|
|
94
|
+
/** Recovery key (8 words from BIP39-like wordlist) */
|
|
95
|
+
export type RecoveryKey = {
|
|
96
|
+
/** The 8 words */
|
|
97
|
+
words: string[];
|
|
98
|
+
/** Raw bytes the words encode */
|
|
99
|
+
bytes: Uint8Array;
|
|
100
|
+
};
|
|
101
|
+
/** Configuration stored locally */
|
|
102
|
+
export type Config = {
|
|
103
|
+
/** Sync mode */
|
|
104
|
+
mode: "cloud" | "selfhosted" | "local";
|
|
105
|
+
/** Server URL for cloud/selfhosted modes */
|
|
106
|
+
serverUrl: string | null;
|
|
107
|
+
/** User email */
|
|
108
|
+
email: string | null;
|
|
109
|
+
/** Path to skills directory */
|
|
110
|
+
skillsPath: string;
|
|
111
|
+
/** Enable auto sync */
|
|
112
|
+
autoSync: boolean;
|
|
113
|
+
/** Sync interval in seconds */
|
|
114
|
+
syncInterval: number;
|
|
115
|
+
};
|
|
116
|
+
/** Credentials stored locally (encrypted) */
|
|
117
|
+
export type Credentials = {
|
|
118
|
+
/** JWT access token */
|
|
119
|
+
accessToken: string;
|
|
120
|
+
/** JWT refresh token */
|
|
121
|
+
refreshToken: string;
|
|
122
|
+
/** Encrypted master key (base64) */
|
|
123
|
+
encryptedMasterKey: string;
|
|
124
|
+
/** Salt for key derivation (base64) */
|
|
125
|
+
salt: string;
|
|
126
|
+
};
|
|
127
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,0CAA0C;AAC1C,MAAM,MAAM,aAAa,GAAG;IAC1B,wBAAwB;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,oCAAoC;IACpC,UAAU,EAAE,MAAM,CAAC;IACnB,2CAA2C;IAC3C,EAAE,EAAE,MAAM,CAAC;IACX,sDAAsD;IACtD,GAAG,EAAE,MAAM,CAAC;IACZ,mCAAmC;IACnC,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,kCAAkC;AAClC,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,OAAO,CAAC;AAEtD,2BAA2B;AAC3B,MAAM,MAAM,KAAK,GAAG;IAClB,yCAAyC;IACzC,IAAI,EAAE,MAAM,CAAC;IACb,mCAAmC;IACnC,OAAO,EAAE,MAAM,CAAC;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MAAM,CAAC;IACrB,oCAAoC;IACpC,kBAAkB,EAAE,MAAM,CAAC;IAC3B,uCAAuC;IACvC,IAAI,EAAE,MAAM,CAAC;CACd,CAAC"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG"}
|
package/package.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@claudeskill/core",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Core encryption and skill management for Claude Skill Sync",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"files": ["dist"],
|
|
15
|
+
"publishConfig": {
|
|
16
|
+
"access": "public"
|
|
17
|
+
},
|
|
18
|
+
"scripts": {
|
|
19
|
+
"build": "tsc",
|
|
20
|
+
"dev": "tsc --watch",
|
|
21
|
+
"typecheck": "tsc --noEmit",
|
|
22
|
+
"test": "node --test --experimental-strip-types src/**/*.test.ts",
|
|
23
|
+
"clean": "rm -rf dist .turbo"
|
|
24
|
+
},
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"@noble/hashes": "^1.7.1"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"typescript": "^5.7.2"
|
|
30
|
+
}
|
|
31
|
+
}
|