pnpm-plugin-skills 0.1.0 → 0.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.
package/README.md ADDED
@@ -0,0 +1,54 @@
1
+ # pnpm-plugin-skills
2
+
3
+ A pnpm plugin that automatically installs agent skills during `pnpm install`.
4
+
5
+ ## How It Works
6
+
7
+ This plugin hooks into pnpm's `preResolution` lifecycle to run skill installation before dependency resolution. On every `pnpm install`, it:
8
+
9
+ 1. Reads `skills.json` from the workspace root
10
+ 2. Resolves and syncs `skills-lock.yaml`
11
+ 3. Materializes skills into the configured `installDir`
12
+ 4. Creates symlinks for configured `linkTargets`
13
+ 5. Skips if the lockfile hasn't changed (fast path)
14
+
15
+ ## Setup
16
+
17
+ Install as a config dependency:
18
+
19
+ ```bash
20
+ pnpm add pnpm-plugin-skills --config
21
+ ```
22
+
23
+ Then create a `skills.json` in your project root:
24
+
25
+ ```jsonc
26
+ {
27
+ "installDir": ".agents/skills",
28
+ "linkTargets": [".claude/skills"],
29
+ "skills": {
30
+ "my-skill": "https://github.com/owner/repo.git#path:/skills/my-skill"
31
+ }
32
+ }
33
+ ```
34
+
35
+ Now `pnpm install` will automatically install your skills.
36
+
37
+ ## Architecture
38
+
39
+ The plugin is built as a single CJS bundle (via Rslib with `autoExternal: false`) that inlines all dependencies including `skills-package-manager`. This ensures it works as a standalone `pnpmfile.cjs` plugin without any external runtime dependencies.
40
+
41
+ ```
42
+ pnpm-plugin-skills/
43
+ ├── pnpmfile.cjs # Plugin entry — exports { hooks: { preResolution } }
44
+ ├── src/
45
+ │ └── index.ts # Imports installCommand from skills-pm
46
+ └── dist/
47
+ └── index.js # Bundled CJS output (~350 kB, all deps inlined)
48
+ ```
49
+
50
+ ## Build
51
+
52
+ ```bash
53
+ pnpm build # Builds with Rslib (CJS bundle mode)
54
+ ```
package/dist/index.js CHANGED
@@ -1,5 +1,59 @@
1
1
  "use strict";
2
2
  var __webpack_modules__ = {
3
+ "../../node_modules/.pnpm/sisteransi@1.0.5/node_modules/sisteransi/src/index.js" (module) {
4
+ const ESC = '\x1B';
5
+ const CSI = `${ESC}[`;
6
+ const beep = '\u0007';
7
+ const cursor = {
8
+ to (x, y) {
9
+ if (!y) return `${CSI}${x + 1}G`;
10
+ return `${CSI}${y + 1};${x + 1}H`;
11
+ },
12
+ move (x, y) {
13
+ let ret = '';
14
+ if (x < 0) ret += `${CSI}${-x}D`;
15
+ else if (x > 0) ret += `${CSI}${x}C`;
16
+ if (y < 0) ret += `${CSI}${-y}A`;
17
+ else if (y > 0) ret += `${CSI}${y}B`;
18
+ return ret;
19
+ },
20
+ up: (count = 1)=>`${CSI}${count}A`,
21
+ down: (count = 1)=>`${CSI}${count}B`,
22
+ forward: (count = 1)=>`${CSI}${count}C`,
23
+ backward: (count = 1)=>`${CSI}${count}D`,
24
+ nextLine: (count = 1)=>`${CSI}E`.repeat(count),
25
+ prevLine: (count = 1)=>`${CSI}F`.repeat(count),
26
+ left: `${CSI}G`,
27
+ hide: `${CSI}?25l`,
28
+ show: `${CSI}?25h`,
29
+ save: `${ESC}7`,
30
+ restore: `${ESC}8`
31
+ };
32
+ const scroll = {
33
+ up: (count = 1)=>`${CSI}S`.repeat(count),
34
+ down: (count = 1)=>`${CSI}T`.repeat(count)
35
+ };
36
+ const erase = {
37
+ screen: `${CSI}2J`,
38
+ up: (count = 1)=>`${CSI}1J`.repeat(count),
39
+ down: (count = 1)=>`${CSI}J`.repeat(count),
40
+ line: `${CSI}2K`,
41
+ lineEnd: `${CSI}K`,
42
+ lineStart: `${CSI}1K`,
43
+ lines (count) {
44
+ let clear = '';
45
+ for(let i = 0; i < count; i++)clear += this.line + (i < count - 1 ? cursor.up() : '');
46
+ if (count) clear += cursor.left;
47
+ return clear;
48
+ }
49
+ };
50
+ module.exports = {
51
+ cursor,
52
+ scroll,
53
+ erase,
54
+ beep
55
+ };
56
+ },
3
57
  buffer (module) {
4
58
  module.exports = require("buffer");
5
59
  },
@@ -6382,9 +6436,144 @@ var __webpack_exports__ = {};
6382
6436
  const external_node_path_namespaceObject = require("node:path");
6383
6437
  var dist = __webpack_require__("../../node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/index.js");
6384
6438
  const external_node_crypto_namespaceObject = require("node:crypto");
6439
+ const external_node_os_namespaceObject = require("node:os");
6385
6440
  const external_node_child_process_namespaceObject = require("node:child_process");
6386
6441
  const external_node_util_namespaceObject = require("node:util");
6387
- const external_node_os_namespaceObject = require("node:os");
6442
+ if ("u" > typeof process) {
6443
+ "u" > typeof Deno && "string" == typeof Deno.version?.deno || "u" > typeof Bun && Bun.version;
6444
+ process.platform, process.arch, process.version;
6445
+ process.argv;
6446
+ } else "u" < typeof navigator || (navigator.platform, navigator.userAgent);
6447
+ const external_node_process_namespaceObject = require("node:process");
6448
+ require("node:readline");
6449
+ __webpack_require__("../../node_modules/.pnpm/sisteransi@1.0.5/node_modules/sisteransi/src/index.js");
6450
+ require("node:tty");
6451
+ const dist_at = (t)=>161 === t || 164 === t || 167 === t || 168 === t || 170 === t || 173 === t || 174 === t || t >= 176 && t <= 180 || t >= 182 && t <= 186 || t >= 188 && t <= 191 || 198 === t || 208 === t || 215 === t || 216 === t || t >= 222 && t <= 225 || 230 === t || t >= 232 && t <= 234 || 236 === t || 237 === t || 240 === t || 242 === t || 243 === t || t >= 247 && t <= 250 || 252 === t || 254 === t || 257 === t || 273 === t || 275 === t || 283 === t || 294 === t || 295 === t || 299 === t || t >= 305 && t <= 307 || 312 === t || t >= 319 && t <= 322 || 324 === t || t >= 328 && t <= 331 || 333 === t || 338 === t || 339 === t || 358 === t || 359 === t || 363 === t || 462 === t || 464 === t || 466 === t || 468 === t || 470 === t || 472 === t || 474 === t || 476 === t || 593 === t || 609 === t || 708 === t || 711 === t || t >= 713 && t <= 715 || 717 === t || 720 === t || t >= 728 && t <= 731 || 733 === t || 735 === t || t >= 768 && t <= 879 || t >= 913 && t <= 929 || t >= 931 && t <= 937 || t >= 945 && t <= 961 || t >= 963 && t <= 969 || 1025 === t || t >= 1040 && t <= 1103 || 1105 === t || 8208 === t || t >= 8211 && t <= 8214 || 8216 === t || 8217 === t || 8220 === t || 8221 === t || t >= 8224 && t <= 8226 || t >= 8228 && t <= 8231 || 8240 === t || 8242 === t || 8243 === t || 8245 === t || 8251 === t || 8254 === t || 8308 === t || 8319 === t || t >= 8321 && t <= 8324 || 8364 === t || 8451 === t || 8453 === t || 8457 === t || 8467 === t || 8470 === t || 8481 === t || 8482 === t || 8486 === t || 8491 === t || 8531 === t || 8532 === t || t >= 8539 && t <= 8542 || t >= 8544 && t <= 8555 || t >= 8560 && t <= 8569 || 8585 === t || t >= 8592 && t <= 8601 || 8632 === t || 8633 === t || 8658 === t || 8660 === t || 8679 === t || 8704 === t || 8706 === t || 8707 === t || 8711 === t || 8712 === t || 8715 === t || 8719 === t || 8721 === t || 8725 === t || 8730 === t || t >= 8733 && t <= 8736 || 8739 === t || 8741 === t || t >= 8743 && t <= 8748 || 8750 === t || t >= 8756 && t <= 8759 || 8764 === t || 8765 === t || 8776 === t || 8780 === t || 8786 === t || 8800 === t || 8801 === t || t >= 8804 && t <= 8807 || 8810 === t || 8811 === t || 8814 === t || 8815 === t || 8834 === t || 8835 === t || 8838 === t || 8839 === t || 8853 === t || 8857 === t || 8869 === t || 8895 === t || 8978 === t || t >= 9312 && t <= 9449 || t >= 9451 && t <= 9547 || t >= 9552 && t <= 9587 || t >= 9600 && t <= 9615 || t >= 9618 && t <= 9621 || 9632 === t || 9633 === t || t >= 9635 && t <= 9641 || 9650 === t || 9651 === t || 9654 === t || 9655 === t || 9660 === t || 9661 === t || 9664 === t || 9665 === t || t >= 9670 && t <= 9672 || 9675 === t || t >= 9678 && t <= 9681 || t >= 9698 && t <= 9701 || 9711 === t || 9733 === t || 9734 === t || 9737 === t || 9742 === t || 9743 === t || 9756 === t || 9758 === t || 9792 === t || 9794 === t || 9824 === t || 9825 === t || t >= 9827 && t <= 9829 || t >= 9831 && t <= 9834 || 9836 === t || 9837 === t || 9839 === t || 9886 === t || 9887 === t || 9919 === t || t >= 9926 && t <= 9933 || t >= 9935 && t <= 9939 || t >= 9941 && t <= 9953 || 9955 === t || 9960 === t || 9961 === t || t >= 9963 && t <= 9969 || 9972 === t || t >= 9974 && t <= 9977 || 9979 === t || 9980 === t || 9982 === t || 9983 === t || 10045 === t || t >= 10102 && t <= 10111 || t >= 11094 && t <= 11097 || t >= 12872 && t <= 12879 || t >= 57344 && t <= 63743 || t >= 65024 && t <= 65039 || 65533 === t || t >= 127232 && t <= 127242 || t >= 127248 && t <= 127277 || t >= 127280 && t <= 127337 || t >= 127344 && t <= 127373 || 127375 === t || 127376 === t || t >= 127387 && t <= 127404 || t >= 917760 && t <= 917999 || t >= 983040 && t <= 1048573 || t >= 1048576 && t <= 1114109, dist_lt = (t)=>12288 === t || t >= 65281 && t <= 65376 || t >= 65504 && t <= 65510, dist_ht = (t)=>t >= 4352 && t <= 4447 || 8986 === t || 8987 === t || 9001 === t || 9002 === t || t >= 9193 && t <= 9196 || 9200 === t || 9203 === t || 9725 === t || 9726 === t || 9748 === t || 9749 === t || t >= 9800 && t <= 9811 || 9855 === t || 9875 === t || 9889 === t || 9898 === t || 9899 === t || 9917 === t || 9918 === t || 9924 === t || 9925 === t || 9934 === t || 9940 === t || 9962 === t || 9970 === t || 9971 === t || 9973 === t || 9978 === t || 9981 === t || 9989 === t || 9994 === t || 9995 === t || 10024 === t || 10060 === t || 10062 === t || t >= 10067 && t <= 10069 || 10071 === t || t >= 10133 && t <= 10135 || 10160 === t || 10175 === t || 11035 === t || 11036 === t || 11088 === t || 11093 === t || t >= 11904 && t <= 11929 || t >= 11931 && t <= 12019 || t >= 12032 && t <= 12245 || t >= 12272 && t <= 12287 || t >= 12289 && t <= 12350 || t >= 12353 && t <= 12438 || t >= 12441 && t <= 12543 || t >= 12549 && t <= 12591 || t >= 12593 && t <= 12686 || t >= 12688 && t <= 12771 || t >= 12783 && t <= 12830 || t >= 12832 && t <= 12871 || t >= 12880 && t <= 19903 || t >= 19968 && t <= 42124 || t >= 42128 && t <= 42182 || t >= 43360 && t <= 43388 || t >= 44032 && t <= 55203 || t >= 63744 && t <= 64255 || t >= 65040 && t <= 65049 || t >= 65072 && t <= 65106 || t >= 65108 && t <= 65126 || t >= 65128 && t <= 65131 || t >= 94176 && t <= 94180 || 94192 === t || 94193 === t || t >= 94208 && t <= 100343 || t >= 100352 && t <= 101589 || t >= 101632 && t <= 101640 || t >= 110576 && t <= 110579 || t >= 110581 && t <= 110587 || 110589 === t || 110590 === t || t >= 110592 && t <= 110882 || 110898 === t || t >= 110928 && t <= 110930 || 110933 === t || t >= 110948 && t <= 110951 || t >= 110960 && t <= 111355 || 126980 === t || 127183 === t || 127374 === t || t >= 127377 && t <= 127386 || t >= 127488 && t <= 127490 || t >= 127504 && t <= 127547 || t >= 127552 && t <= 127560 || 127568 === t || 127569 === t || t >= 127584 && t <= 127589 || t >= 127744 && t <= 127776 || t >= 127789 && t <= 127797 || t >= 127799 && t <= 127868 || t >= 127870 && t <= 127891 || t >= 127904 && t <= 127946 || t >= 127951 && t <= 127955 || t >= 127968 && t <= 127984 || 127988 === t || t >= 127992 && t <= 128062 || 128064 === t || t >= 128066 && t <= 128252 || t >= 128255 && t <= 128317 || t >= 128331 && t <= 128334 || t >= 128336 && t <= 128359 || 128378 === t || 128405 === t || 128406 === t || 128420 === t || t >= 128507 && t <= 128591 || t >= 128640 && t <= 128709 || 128716 === t || t >= 128720 && t <= 128722 || t >= 128725 && t <= 128727 || t >= 128732 && t <= 128735 || 128747 === t || 128748 === t || t >= 128756 && t <= 128764 || t >= 128992 && t <= 129003 || 129008 === t || t >= 129292 && t <= 129338 || t >= 129340 && t <= 129349 || t >= 129351 && t <= 129535 || t >= 129648 && t <= 129660 || t >= 129664 && t <= 129672 || t >= 129680 && t <= 129725 || t >= 129727 && t <= 129733 || t >= 129742 && t <= 129755 || t >= 129760 && t <= 129768 || t >= 129776 && t <= 129784 || t >= 131072 && t <= 196605 || t >= 196608 && t <= 262141, dist_O = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y, dist_y = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y, dist_L = /\t{1,1000}/y, dist_P = /[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/yu, dist_M = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y, dist_ct = /\p{M}+/gu, ft = {
6452
+ limit: 1 / 0,
6453
+ ellipsis: ""
6454
+ }, X = (t, e = {}, s = {})=>{
6455
+ const i = e.limit ?? 1 / 0, r = e.ellipsis ?? "", n = e?.ellipsisWidth ?? (r ? X(r, ft, s).width : 0), u = s.ansiWidth ?? 0, a = s.controlWidth ?? 0, l = s.tabWidth ?? 8, E = s.ambiguousWidth ?? 1, g = s.emojiWidth ?? 2, m = s.fullWidthWidth ?? 2, A = s.regularWidth ?? 1, V = s.wideWidth ?? 2;
6456
+ let h = 0, o = 0, p = t.length, v = 0, F = !1, d = p, b = Math.max(0, i - n), C = 0, w = 0, c = 0, f = 0;
6457
+ t: for(;;){
6458
+ if (w > C || o >= p && o > h) {
6459
+ const ut = t.slice(C, w) || t.slice(h, o);
6460
+ v = 0;
6461
+ for (const Y of ut.replaceAll(dist_ct, "")){
6462
+ const $ = Y.codePointAt(0) || 0;
6463
+ if (dist_lt($) ? f = m : dist_ht($) ? f = V : E !== A && dist_at($) ? f = E : f = A, c + f > b && (d = Math.min(d, Math.max(C, h) + v)), c + f > i) {
6464
+ F = !0;
6465
+ break t;
6466
+ }
6467
+ v += Y.length, c += f;
6468
+ }
6469
+ C = w = 0;
6470
+ }
6471
+ if (o >= p) break;
6472
+ if (dist_M.lastIndex = o, dist_M.test(t)) {
6473
+ if (v = dist_M.lastIndex - o, f = v * A, c + f > b && (d = Math.min(d, o + Math.floor((b - c) / A))), c + f > i) {
6474
+ F = !0;
6475
+ break;
6476
+ }
6477
+ c += f, C = h, w = o, o = h = dist_M.lastIndex;
6478
+ continue;
6479
+ }
6480
+ if (dist_O.lastIndex = o, dist_O.test(t)) {
6481
+ if (c + u > b && (d = Math.min(d, o)), c + u > i) {
6482
+ F = !0;
6483
+ break;
6484
+ }
6485
+ c += u, C = h, w = o, o = h = dist_O.lastIndex;
6486
+ continue;
6487
+ }
6488
+ if (dist_y.lastIndex = o, dist_y.test(t)) {
6489
+ if (v = dist_y.lastIndex - o, f = v * a, c + f > b && (d = Math.min(d, o + Math.floor((b - c) / a))), c + f > i) {
6490
+ F = !0;
6491
+ break;
6492
+ }
6493
+ c += f, C = h, w = o, o = h = dist_y.lastIndex;
6494
+ continue;
6495
+ }
6496
+ if (dist_L.lastIndex = o, dist_L.test(t)) {
6497
+ if (v = dist_L.lastIndex - o, f = v * l, c + f > b && (d = Math.min(d, o + Math.floor((b - c) / l))), c + f > i) {
6498
+ F = !0;
6499
+ break;
6500
+ }
6501
+ c += f, C = h, w = o, o = h = dist_L.lastIndex;
6502
+ continue;
6503
+ }
6504
+ if (dist_P.lastIndex = o, dist_P.test(t)) {
6505
+ if (c + g > b && (d = Math.min(d, o)), c + g > i) {
6506
+ F = !0;
6507
+ break;
6508
+ }
6509
+ c += g, C = h, w = o, o = h = dist_P.lastIndex;
6510
+ continue;
6511
+ }
6512
+ o += 1;
6513
+ }
6514
+ return {
6515
+ width: F ? b : c,
6516
+ index: F ? d : p,
6517
+ truncated: F,
6518
+ ellipsed: F && i >= n
6519
+ };
6520
+ }, pt = {
6521
+ limit: 1 / 0,
6522
+ ellipsis: "",
6523
+ ellipsisWidth: 0
6524
+ }, dist_j = "\x07", Q = "[", dist_dt = "]", U = `${dist_dt}8;;`, dist_et = new RegExp(`(?:\\${Q}(?<code>\\d+)m|\\${U}(?<uri>.*)${dist_j})`, "y");
6525
+ const At = [
6526
+ "up",
6527
+ "down",
6528
+ "left",
6529
+ "right",
6530
+ "space",
6531
+ "enter",
6532
+ "cancel"
6533
+ ], dist_ = {
6534
+ actions: new Set(At),
6535
+ aliases: new Map([
6536
+ [
6537
+ "k",
6538
+ "up"
6539
+ ],
6540
+ [
6541
+ "j",
6542
+ "down"
6543
+ ],
6544
+ [
6545
+ "h",
6546
+ "left"
6547
+ ],
6548
+ [
6549
+ "l",
6550
+ "right"
6551
+ ],
6552
+ [
6553
+ "",
6554
+ "cancel"
6555
+ ],
6556
+ [
6557
+ "escape",
6558
+ "cancel"
6559
+ ]
6560
+ ]),
6561
+ messages: {
6562
+ cancel: "Canceled",
6563
+ error: "Something went wrong"
6564
+ },
6565
+ withGuide: !0
6566
+ };
6567
+ globalThis.process.platform.startsWith("win");
6568
+ Symbol("clack:cancel");
6569
+ require("node:fs");
6570
+ function dist_pt() {
6571
+ return "win32" !== external_node_process_namespaceObject.platform ? "linux" !== external_node_process_namespaceObject.env.TERM : !!external_node_process_namespaceObject.env.CI || !!external_node_process_namespaceObject.env.WT_SESSION || !!external_node_process_namespaceObject.env.TERMINUS_SUBLIME || "{cmd::Cmder}" === external_node_process_namespaceObject.env.ConEmuTask || "Terminus-Sublime" === external_node_process_namespaceObject.env.TERM_PROGRAM || "vscode" === external_node_process_namespaceObject.env.TERM_PROGRAM || "xterm-256color" === external_node_process_namespaceObject.env.TERM || "alacritty" === external_node_process_namespaceObject.env.TERM || "JetBrains-JediTerm" === external_node_process_namespaceObject.env.TERMINAL_EMULATOR;
6572
+ }
6573
+ const ee = dist_pt(), dist_I = (e, r)=>ee ? e : r, dist_h = (dist_I("\u25C6", "*"), dist_I("\u25A0", "x"), dist_I("\u25B2", "x"), dist_I("\u25C7", "o"), dist_I("\u250C", "T"), dist_I("\u2502", "|")), Ce = (dist_I("\u2514", "\u2014"), dist_I("\u2510", "T"), dist_I("\u2518", "\u2014"), dist_I("\u25CF", ">"), dist_I("\u25CB", " "), dist_I("\u25FB", "[\u2022]"), dist_I("\u25FC", "[+]"), dist_I("\u25FB", "[ ]"), dist_I("\u25AA", "\u2022"), dist_I("\u2500", "-"), dist_I("\u256E", "+"), dist_I("\u251C", "+"), dist_I("\u256F", "+"), dist_I("\u2570", "+"), dist_I("\u256D", "+"), dist_I("\u25CF", "\u2022"), dist_I("\u25C6", "*"), dist_I("\u25B2", "!"), dist_I("\u25A0", "x"), "\x07"), ke = "[", dist_wt = "]", Se = `${dist_wt}8;;`;
6574
+ new RegExp(`(?:\\${ke}(?<code>\\d+)m|\\${Se}(?<uri>.*)${Ce})`, "y");
6575
+ dist_I("\u2500", "-"), dist_I("\u2501", "="), dist_I("\u2588", "#");
6576
+ (0, external_node_util_namespaceObject.styleText)("gray", dist_h);
6388
6577
  async function readSkillsLock(rootDir) {
6389
6578
  const filePath = external_node_path_namespaceObject.join(rootDir, 'skills-lock.yaml');
6390
6579
  try {
@@ -6458,19 +6647,58 @@ var __webpack_exports__ = {};
6458
6647
  return `sha256-${(0, external_node_crypto_namespaceObject.createHash)('sha256').update(content).digest('hex')}`;
6459
6648
  }
6460
6649
  const execFileAsync = (0, external_node_util_namespaceObject.promisify)(external_node_child_process_namespaceObject.execFile);
6650
+ async function resolveGitCommitByLsRemote(url, target) {
6651
+ try {
6652
+ const { stdout } = await execFileAsync('git', [
6653
+ 'ls-remote',
6654
+ url,
6655
+ target,
6656
+ `${target}^{}`
6657
+ ]);
6658
+ const lines = stdout.trim().split('\n').map((line)=>line.trim()).filter(Boolean);
6659
+ const peeledLine = lines.find((line)=>line.endsWith('^{}'));
6660
+ const resolvedLine = peeledLine ?? lines[0];
6661
+ return resolvedLine?.split('\t')[0]?.trim() || null;
6662
+ } catch {
6663
+ return null;
6664
+ }
6665
+ }
6666
+ async function resolveGitCommitByClone(url, target) {
6667
+ const checkoutRoot = await (0, promises_namespaceObject.mkdtemp)(external_node_path_namespaceObject.join((0, external_node_os_namespaceObject.tmpdir)(), 'skills-pm-git-ref-'));
6668
+ try {
6669
+ await execFileAsync('git', [
6670
+ 'clone',
6671
+ '--bare',
6672
+ '--quiet',
6673
+ url,
6674
+ checkoutRoot
6675
+ ]);
6676
+ const { stdout } = await execFileAsync('git', [
6677
+ 'rev-parse',
6678
+ '--verify',
6679
+ `${target}^{commit}`
6680
+ ], {
6681
+ cwd: checkoutRoot
6682
+ });
6683
+ return stdout.trim().split('\n')[0]?.trim() || null;
6684
+ } catch {
6685
+ return null;
6686
+ } finally{
6687
+ await (0, promises_namespaceObject.rm)(checkoutRoot, {
6688
+ recursive: true,
6689
+ force: true
6690
+ }).catch(()=>{});
6691
+ }
6692
+ }
6461
6693
  async function resolveGitCommit(url, ref) {
6462
6694
  const target = ref ?? 'HEAD';
6463
- const { stdout } = await execFileAsync('git', [
6464
- 'ls-remote',
6465
- url,
6466
- target
6467
- ]);
6468
- const line = stdout.trim().split('\n')[0];
6469
- const commit = line?.split('\t')[0]?.trim();
6470
- if (!commit) throw new Error(`Unable to resolve git ref ${target} for ${url}`);
6471
- return commit;
6695
+ const commit = await resolveGitCommitByLsRemote(url, target);
6696
+ if (commit) return commit;
6697
+ const clonedCommit = await resolveGitCommitByClone(url, target);
6698
+ if (clonedCommit) return clonedCommit;
6699
+ throw new Error(`Unable to resolve git ref ${target} for ${url}`);
6472
6700
  }
6473
- async function createLockEntry(cwd, specifier) {
6701
+ async function resolveLockEntry(cwd, specifier) {
6474
6702
  const normalized = normalizeSpecifier(specifier);
6475
6703
  if ('file' === normalized.type) {
6476
6704
  const sourceRoot = external_node_path_namespaceObject.resolve(cwd, normalized.source.slice(5));
@@ -6480,7 +6708,7 @@ var __webpack_exports__ = {};
6480
6708
  specifier: normalized.normalized,
6481
6709
  resolution: {
6482
6710
  type: 'file',
6483
- path: sourceRoot
6711
+ path: external_node_path_namespaceObject.relative(cwd, sourceRoot) || '.'
6484
6712
  },
6485
6713
  digest: sha256(`${sourceRoot}:${normalized.path}`)
6486
6714
  }
@@ -6507,7 +6735,7 @@ var __webpack_exports__ = {};
6507
6735
  async function syncSkillsLock(cwd, manifest, existingLock) {
6508
6736
  const nextSkills = {};
6509
6737
  for (const specifier of Object.values(manifest.skills)){
6510
- const { skillName, entry } = await createLockEntry(cwd, specifier);
6738
+ const { skillName, entry } = await resolveLockEntry(cwd, specifier);
6511
6739
  nextSkills[skillName] = entry;
6512
6740
  }
6513
6741
  return {
@@ -6521,6 +6749,14 @@ var __webpack_exports__ = {};
6521
6749
  const filePath = external_node_path_namespaceObject.join(rootDir, 'skills-lock.yaml');
6522
6750
  await (0, promises_namespaceObject.writeFile)(filePath, dist.stringify(lockfile), 'utf8');
6523
6751
  }
6752
+ (0, external_node_util_namespaceObject.promisify)(external_node_child_process_namespaceObject.execFile);
6753
+ new Set([
6754
+ 'node_modules',
6755
+ '.git',
6756
+ 'dist',
6757
+ 'build',
6758
+ '__pycache__'
6759
+ ]);
6524
6760
  async function ensureDir(dirPath) {
6525
6761
  await (0, promises_namespaceObject.mkdir)(dirPath, {
6526
6762
  recursive: true
@@ -6575,11 +6811,59 @@ var __webpack_exports__ = {};
6575
6811
  });
6576
6812
  await writeJson(external_node_path_namespaceObject.join(targetDir, '.skills-pm.json'), {
6577
6813
  name: skillName,
6578
- installedBy: 'skills-pm',
6814
+ installedBy: 'skills-package-manager',
6579
6815
  version: '0.1.0'
6580
6816
  });
6581
6817
  }
6582
6818
  const materializeGitSkill_execFileAsync = (0, external_node_util_namespaceObject.promisify)(external_node_child_process_namespaceObject.execFile);
6819
+ async function checkoutCommit(checkoutRoot, commit) {
6820
+ await materializeGitSkill_execFileAsync('git', [
6821
+ 'checkout',
6822
+ commit
6823
+ ], {
6824
+ cwd: checkoutRoot
6825
+ });
6826
+ }
6827
+ async function fetchCommitFallback(checkoutRoot, commit) {
6828
+ try {
6829
+ await materializeGitSkill_execFileAsync('git', [
6830
+ 'fetch',
6831
+ '--depth',
6832
+ '1',
6833
+ 'origin',
6834
+ commit
6835
+ ], {
6836
+ cwd: checkoutRoot
6837
+ });
6838
+ return;
6839
+ } catch {}
6840
+ try {
6841
+ await materializeGitSkill_execFileAsync('git', [
6842
+ 'fetch',
6843
+ '--tags',
6844
+ 'origin'
6845
+ ], {
6846
+ cwd: checkoutRoot
6847
+ });
6848
+ return;
6849
+ } catch {}
6850
+ try {
6851
+ await materializeGitSkill_execFileAsync('git', [
6852
+ 'fetch',
6853
+ '--unshallow',
6854
+ 'origin'
6855
+ ], {
6856
+ cwd: checkoutRoot
6857
+ });
6858
+ } catch {
6859
+ await materializeGitSkill_execFileAsync('git', [
6860
+ 'fetch',
6861
+ 'origin'
6862
+ ], {
6863
+ cwd: checkoutRoot
6864
+ });
6865
+ }
6866
+ }
6583
6867
  async function materializeGitSkill(rootDir, skillName, repoUrl, commit, sourcePath, installDir) {
6584
6868
  const checkoutRoot = await (0, promises_namespaceObject.mkdtemp)(external_node_path_namespaceObject.join((0, external_node_os_namespaceObject.tmpdir)(), 'skills-pm-git-checkout-'));
6585
6869
  try {
@@ -6590,12 +6874,12 @@ var __webpack_exports__ = {};
6590
6874
  repoUrl,
6591
6875
  checkoutRoot
6592
6876
  ]);
6593
- if (commit && 'HEAD' !== commit) await materializeGitSkill_execFileAsync('git', [
6594
- 'checkout',
6595
- commit
6596
- ], {
6597
- cwd: checkoutRoot
6598
- });
6877
+ if (commit && 'HEAD' !== commit) try {
6878
+ await checkoutCommit(checkoutRoot, commit);
6879
+ } catch {
6880
+ await fetchCommitFallback(checkoutRoot, commit);
6881
+ await checkoutCommit(checkoutRoot, commit);
6882
+ }
6599
6883
  const skillDocPath = external_node_path_namespaceObject.join(checkoutRoot, sourcePath.replace(/^\//, ''), 'SKILL.md');
6600
6884
  await (0, promises_namespaceObject.readFile)(skillDocPath, 'utf8');
6601
6885
  await materializeLocalSkill(rootDir, skillName, checkoutRoot, sourcePath, installDir);
@@ -6609,7 +6893,7 @@ var __webpack_exports__ = {};
6609
6893
  async function isManagedSkillDir(dirPath) {
6610
6894
  try {
6611
6895
  const marker = JSON.parse(await (0, promises_namespaceObject.readFile)(external_node_path_namespaceObject.join(dirPath, '.skills-pm.json'), 'utf8'));
6612
- return marker?.installedBy === 'skills-pm';
6896
+ return marker?.installedBy === 'skills-package-manager';
6613
6897
  } catch {
6614
6898
  return false;
6615
6899
  }
@@ -6643,21 +6927,17 @@ var __webpack_exports__ = {};
6643
6927
  }
6644
6928
  } catch {}
6645
6929
  }
6930
+ const installStageHooks = {
6931
+ beforeFetch: async (_rootDir, _manifest, _lockfile)=>{}
6932
+ };
6646
6933
  function extractSkillPath(specifier, skillName) {
6647
6934
  const marker = '#path:';
6648
6935
  const index = specifier.indexOf(marker);
6649
6936
  if (index >= 0) return specifier.slice(index + marker.length);
6650
6937
  return `/${skillName}`;
6651
6938
  }
6652
- async function installSkills(rootDir) {
6653
- const manifest = await readSkillsManifest(rootDir);
6654
- if (!manifest) return {
6655
- status: 'skipped',
6656
- reason: 'manifest-missing'
6657
- };
6658
- const currentLock = await readSkillsLock(rootDir);
6659
- const lockfile = await syncSkillsLock(rootDir, manifest, currentLock);
6660
- await writeSkillsLock(rootDir, lockfile);
6939
+ async function fetchSkillsFromLock(rootDir, manifest, lockfile) {
6940
+ await installStageHooks.beforeFetch(rootDir, manifest, lockfile);
6661
6941
  const lockDigest = sha256(JSON.stringify(lockfile));
6662
6942
  const state = await readInstallState(rootDir);
6663
6943
  if (state?.lockDigest === lockDigest) return {
@@ -6668,10 +6948,15 @@ var __webpack_exports__ = {};
6668
6948
  const linkTargets = manifest.linkTargets ?? [];
6669
6949
  await pruneManagedSkills(rootDir, installDir, linkTargets, Object.keys(lockfile.skills));
6670
6950
  for (const [skillName, entry] of Object.entries(lockfile.skills)){
6671
- if ('file' === entry.resolution.type) await materializeLocalSkill(rootDir, skillName, entry.resolution.path, extractSkillPath(entry.specifier, skillName), installDir);
6672
- else if ('git' === entry.resolution.type) await materializeGitSkill(rootDir, skillName, entry.resolution.url, entry.resolution.commit, entry.resolution.path, installDir);
6673
- else throw new Error(`Unsupported resolution type in 0.1.0 core flow: ${entry.resolution.type}`);
6674
- for (const linkTarget of linkTargets)await linkSkill(rootDir, installDir, linkTarget, skillName);
6951
+ if ('file' === entry.resolution.type) {
6952
+ await materializeLocalSkill(rootDir, skillName, external_node_path_namespaceObject.resolve(rootDir, entry.resolution.path), extractSkillPath(entry.specifier, skillName), installDir);
6953
+ continue;
6954
+ }
6955
+ if ('git' === entry.resolution.type) {
6956
+ await materializeGitSkill(rootDir, skillName, entry.resolution.url, entry.resolution.commit, entry.resolution.path, installDir);
6957
+ continue;
6958
+ }
6959
+ throw new Error(`Unsupported resolution type in 0.1.0 core flow: ${entry.resolution.type}`);
6675
6960
  }
6676
6961
  await writeInstallState(rootDir, {
6677
6962
  lockDigest,
@@ -6680,6 +6965,31 @@ var __webpack_exports__ = {};
6680
6965
  installerVersion: '0.1.0',
6681
6966
  installedAt: new Date().toISOString()
6682
6967
  });
6968
+ return {
6969
+ status: 'fetched',
6970
+ fetched: Object.keys(lockfile.skills)
6971
+ };
6972
+ }
6973
+ async function linkSkillsFromLock(rootDir, manifest, lockfile) {
6974
+ const installDir = manifest.installDir ?? '.agents/skills';
6975
+ const linkTargets = manifest.linkTargets ?? [];
6976
+ for (const skillName of Object.keys(lockfile.skills))for (const linkTarget of linkTargets)await linkSkill(rootDir, installDir, linkTarget, skillName);
6977
+ return {
6978
+ status: 'linked',
6979
+ linked: Object.keys(lockfile.skills)
6980
+ };
6981
+ }
6982
+ async function installSkills(rootDir) {
6983
+ const manifest = await readSkillsManifest(rootDir);
6984
+ if (!manifest) return {
6985
+ status: 'skipped',
6986
+ reason: 'manifest-missing'
6987
+ };
6988
+ const currentLock = await readSkillsLock(rootDir);
6989
+ const lockfile = await syncSkillsLock(rootDir, manifest, currentLock);
6990
+ await fetchSkillsFromLock(rootDir, manifest, lockfile);
6991
+ await linkSkillsFromLock(rootDir, manifest, lockfile);
6992
+ await writeSkillsLock(rootDir, lockfile);
6683
6993
  return {
6684
6994
  status: 'installed',
6685
6995
  installed: Object.keys(lockfile.skills)
@@ -6688,6 +6998,10 @@ var __webpack_exports__ = {};
6688
6998
  async function installCommand(options) {
6689
6999
  return installSkills(options.cwd);
6690
7000
  }
7001
+ var package_namespaceObject = {
7002
+ rE: "0.2.0"
7003
+ };
7004
+ package_namespaceObject.rE;
6691
7005
  async function preResolution(options = {}) {
6692
7006
  const lockfileDir = options.lockfileDir;
6693
7007
  if (!lockfileDir) return;