oathbound 0.15.0 → 0.16.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/cli.cjs +323 -481
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -11518,12 +11518,12 @@ var require_resolve_flow_scalar = __commonJS((exports2) => {
|
|
|
11518
11518
|
};
|
|
11519
11519
|
}
|
|
11520
11520
|
const valueEnd = offset + source.length;
|
|
11521
|
-
const
|
|
11521
|
+
const re = resolveEnd.resolveEnd(end, valueEnd, strict, onError);
|
|
11522
11522
|
return {
|
|
11523
11523
|
value,
|
|
11524
11524
|
type: _type,
|
|
11525
|
-
comment:
|
|
11526
|
-
range: [offset, valueEnd,
|
|
11525
|
+
comment: re.comment,
|
|
11526
|
+
range: [offset, valueEnd, re.offset]
|
|
11527
11527
|
};
|
|
11528
11528
|
}
|
|
11529
11529
|
function plainValue(source, onError) {
|
|
@@ -11895,10 +11895,10 @@ var require_compose_node = __commonJS((exports2) => {
|
|
|
11895
11895
|
if (alias.source.endsWith(":"))
|
|
11896
11896
|
onError(offset + source.length - 1, "BAD_ALIAS", "Alias ending in : is ambiguous", true);
|
|
11897
11897
|
const valueEnd = offset + source.length;
|
|
11898
|
-
const
|
|
11899
|
-
alias.range = [offset, valueEnd,
|
|
11900
|
-
if (
|
|
11901
|
-
alias.comment =
|
|
11898
|
+
const re = resolveEnd.resolveEnd(end, valueEnd, options.strict, onError);
|
|
11899
|
+
alias.range = [offset, valueEnd, re.offset];
|
|
11900
|
+
if (re.comment)
|
|
11901
|
+
alias.comment = re.comment;
|
|
11902
11902
|
return alias;
|
|
11903
11903
|
}
|
|
11904
11904
|
exports2.composeEmptyNode = composeEmptyNode;
|
|
@@ -11936,10 +11936,10 @@ var require_compose_doc = __commonJS((exports2) => {
|
|
|
11936
11936
|
}
|
|
11937
11937
|
doc.contents = value ? composeNode.composeNode(ctx, value, props, onError) : composeNode.composeEmptyNode(ctx, props.end, start, null, props, onError);
|
|
11938
11938
|
const contentEnd = doc.contents.range[2];
|
|
11939
|
-
const
|
|
11940
|
-
if (
|
|
11941
|
-
doc.comment =
|
|
11942
|
-
doc.range = [offset, contentEnd,
|
|
11939
|
+
const re = resolveEnd.resolveEnd(end, contentEnd, false, onError);
|
|
11940
|
+
if (re.comment)
|
|
11941
|
+
doc.comment = re.comment;
|
|
11942
|
+
doc.range = [offset, contentEnd, re.offset];
|
|
11943
11943
|
return doc;
|
|
11944
11944
|
}
|
|
11945
11945
|
exports2.composeDoc = composeDoc;
|
|
@@ -14157,6 +14157,7 @@ __export(exports_cli, {
|
|
|
14157
14157
|
mergeClaudeSettings: () => mergeClaudeSettings,
|
|
14158
14158
|
isNewer: () => isNewer,
|
|
14159
14159
|
installDevDependency: () => installDevDependency,
|
|
14160
|
+
findSkillsDirs: () => findSkillsDirs,
|
|
14160
14161
|
addPrepareScript: () => addPrepareScript
|
|
14161
14162
|
});
|
|
14162
14163
|
module.exports = __toCommonJS(exports_cli);
|
|
@@ -16478,9 +16479,9 @@ if (shouldShowDeprecationWarning())
|
|
|
16478
16479
|
|
|
16479
16480
|
// cli.ts
|
|
16480
16481
|
var import_node_crypto2 = require("node:crypto");
|
|
16481
|
-
var
|
|
16482
|
-
var
|
|
16483
|
-
var
|
|
16482
|
+
var import_node_child_process3 = require("node:child_process");
|
|
16483
|
+
var import_node_fs9 = require("node:fs");
|
|
16484
|
+
var import_node_path9 = require("node:path");
|
|
16484
16485
|
var import_node_os4 = require("node:os");
|
|
16485
16486
|
|
|
16486
16487
|
// node_modules/@clack/core/dist/index.mjs
|
|
@@ -16703,15 +16704,7 @@ function W(t, e) {
|
|
|
16703
16704
|
const s = t;
|
|
16704
16705
|
s.isTTY && s.setRawMode(e);
|
|
16705
16706
|
}
|
|
16706
|
-
var rt = (t) => ("columns" in t) && typeof t.columns == "number" ? t.columns : 80;
|
|
16707
16707
|
var nt = (t) => ("rows" in t) && typeof t.rows == "number" ? t.rows : 20;
|
|
16708
|
-
function Bt(t, e, s, i = s) {
|
|
16709
|
-
const r = rt(t ?? import_node_process.stdout);
|
|
16710
|
-
return K(e, r - s.length, { hard: true, trim: false }).split(`
|
|
16711
|
-
`).map((n, u) => `${u === 0 ? i : s}${n}`).join(`
|
|
16712
|
-
`);
|
|
16713
|
-
}
|
|
16714
|
-
|
|
16715
16708
|
class B {
|
|
16716
16709
|
input;
|
|
16717
16710
|
output;
|
|
@@ -16980,33 +16973,6 @@ class yt extends B {
|
|
|
16980
16973
|
});
|
|
16981
16974
|
}
|
|
16982
16975
|
}
|
|
16983
|
-
class Tt extends B {
|
|
16984
|
-
options;
|
|
16985
|
-
cursor = 0;
|
|
16986
|
-
get _selectedValue() {
|
|
16987
|
-
return this.options[this.cursor];
|
|
16988
|
-
}
|
|
16989
|
-
changeValue() {
|
|
16990
|
-
this.value = this._selectedValue.value;
|
|
16991
|
-
}
|
|
16992
|
-
constructor(e) {
|
|
16993
|
-
super(e, false), this.options = e.options;
|
|
16994
|
-
const s = this.options.findIndex(({ value: r }) => r === e.initialValue), i = s === -1 ? 0 : s;
|
|
16995
|
-
this.cursor = this.options[i].disabled ? x(i, 1, this.options) : i, this.changeValue(), this.on("cursor", (r) => {
|
|
16996
|
-
switch (r) {
|
|
16997
|
-
case "left":
|
|
16998
|
-
case "up":
|
|
16999
|
-
this.cursor = x(this.cursor, -1, this.options);
|
|
17000
|
-
break;
|
|
17001
|
-
case "down":
|
|
17002
|
-
case "right":
|
|
17003
|
-
this.cursor = x(this.cursor, 1, this.options);
|
|
17004
|
-
break;
|
|
17005
|
-
}
|
|
17006
|
-
this.changeValue();
|
|
17007
|
-
});
|
|
17008
|
-
}
|
|
17009
|
-
}
|
|
17010
16976
|
|
|
17011
16977
|
// node_modules/@clack/prompts/dist/index.mjs
|
|
17012
16978
|
var import_node_util2 = require("node:util");
|
|
@@ -17055,234 +17021,13 @@ var W2 = (e) => {
|
|
|
17055
17021
|
return import_node_util2.styleText("green", V);
|
|
17056
17022
|
}
|
|
17057
17023
|
};
|
|
17058
|
-
var ve = (e) => {
|
|
17059
|
-
switch (e) {
|
|
17060
|
-
case "initial":
|
|
17061
|
-
case "active":
|
|
17062
|
-
return import_node_util2.styleText("cyan", h);
|
|
17063
|
-
case "cancel":
|
|
17064
|
-
return import_node_util2.styleText("red", h);
|
|
17065
|
-
case "error":
|
|
17066
|
-
return import_node_util2.styleText("yellow", h);
|
|
17067
|
-
case "submit":
|
|
17068
|
-
return import_node_util2.styleText("green", h);
|
|
17069
|
-
}
|
|
17070
|
-
};
|
|
17071
|
-
var mt2 = (e) => e === 161 || e === 164 || e === 167 || e === 168 || e === 170 || e === 173 || e === 174 || e >= 176 && e <= 180 || e >= 182 && e <= 186 || e >= 188 && e <= 191 || e === 198 || e === 208 || e === 215 || e === 216 || e >= 222 && e <= 225 || e === 230 || e >= 232 && e <= 234 || e === 236 || e === 237 || e === 240 || e === 242 || e === 243 || e >= 247 && e <= 250 || e === 252 || e === 254 || e === 257 || e === 273 || e === 275 || e === 283 || e === 294 || e === 295 || e === 299 || e >= 305 && e <= 307 || e === 312 || e >= 319 && e <= 322 || e === 324 || e >= 328 && e <= 331 || e === 333 || e === 338 || e === 339 || e === 358 || e === 359 || e === 363 || e === 462 || e === 464 || e === 466 || e === 468 || e === 470 || e === 472 || e === 474 || e === 476 || e === 593 || e === 609 || e === 708 || e === 711 || e >= 713 && e <= 715 || e === 717 || e === 720 || e >= 728 && e <= 731 || e === 733 || e === 735 || e >= 768 && e <= 879 || e >= 913 && e <= 929 || e >= 931 && e <= 937 || e >= 945 && e <= 961 || e >= 963 && e <= 969 || e === 1025 || e >= 1040 && e <= 1103 || e === 1105 || e === 8208 || e >= 8211 && e <= 8214 || e === 8216 || e === 8217 || e === 8220 || e === 8221 || e >= 8224 && e <= 8226 || e >= 8228 && e <= 8231 || e === 8240 || e === 8242 || e === 8243 || e === 8245 || e === 8251 || e === 8254 || e === 8308 || e === 8319 || e >= 8321 && e <= 8324 || e === 8364 || e === 8451 || e === 8453 || e === 8457 || e === 8467 || e === 8470 || e === 8481 || e === 8482 || e === 8486 || e === 8491 || e === 8531 || e === 8532 || e >= 8539 && e <= 8542 || e >= 8544 && e <= 8555 || e >= 8560 && e <= 8569 || e === 8585 || e >= 8592 && e <= 8601 || e === 8632 || e === 8633 || e === 8658 || e === 8660 || e === 8679 || e === 8704 || e === 8706 || e === 8707 || e === 8711 || e === 8712 || e === 8715 || e === 8719 || e === 8721 || e === 8725 || e === 8730 || e >= 8733 && e <= 8736 || e === 8739 || e === 8741 || e >= 8743 && e <= 8748 || e === 8750 || e >= 8756 && e <= 8759 || e === 8764 || e === 8765 || e === 8776 || e === 8780 || e === 8786 || e === 8800 || e === 8801 || e >= 8804 && e <= 8807 || e === 8810 || e === 8811 || e === 8814 || e === 8815 || e === 8834 || e === 8835 || e === 8838 || e === 8839 || e === 8853 || e === 8857 || e === 8869 || e === 8895 || e === 8978 || e >= 9312 && e <= 9449 || e >= 9451 && e <= 9547 || e >= 9552 && e <= 9587 || e >= 9600 && e <= 9615 || e >= 9618 && e <= 9621 || e === 9632 || e === 9633 || e >= 9635 && e <= 9641 || e === 9650 || e === 9651 || e === 9654 || e === 9655 || e === 9660 || e === 9661 || e === 9664 || e === 9665 || e >= 9670 && e <= 9672 || e === 9675 || e >= 9678 && e <= 9681 || e >= 9698 && e <= 9701 || e === 9711 || e === 9733 || e === 9734 || e === 9737 || e === 9742 || e === 9743 || e === 9756 || e === 9758 || e === 9792 || e === 9794 || e === 9824 || e === 9825 || e >= 9827 && e <= 9829 || e >= 9831 && e <= 9834 || e === 9836 || e === 9837 || e === 9839 || e === 9886 || e === 9887 || e === 9919 || e >= 9926 && e <= 9933 || e >= 9935 && e <= 9939 || e >= 9941 && e <= 9953 || e === 9955 || e === 9960 || e === 9961 || e >= 9963 && e <= 9969 || e === 9972 || e >= 9974 && e <= 9977 || e === 9979 || e === 9980 || e === 9982 || e === 9983 || e === 10045 || e >= 10102 && e <= 10111 || e >= 11094 && e <= 11097 || e >= 12872 && e <= 12879 || e >= 57344 && e <= 63743 || e >= 65024 && e <= 65039 || e === 65533 || e >= 127232 && e <= 127242 || e >= 127248 && e <= 127277 || e >= 127280 && e <= 127337 || e >= 127344 && e <= 127373 || e === 127375 || e === 127376 || e >= 127387 && e <= 127404 || e >= 917760 && e <= 917999 || e >= 983040 && e <= 1048573 || e >= 1048576 && e <= 1114109;
|
|
17072
|
-
var gt2 = (e) => e === 12288 || e >= 65281 && e <= 65376 || e >= 65504 && e <= 65510;
|
|
17073
|
-
var ft2 = (e) => e >= 4352 && e <= 4447 || e === 8986 || e === 8987 || e === 9001 || e === 9002 || e >= 9193 && e <= 9196 || e === 9200 || e === 9203 || e === 9725 || e === 9726 || e === 9748 || e === 9749 || e >= 9800 && e <= 9811 || e === 9855 || e === 9875 || e === 9889 || e === 9898 || e === 9899 || e === 9917 || e === 9918 || e === 9924 || e === 9925 || e === 9934 || e === 9940 || e === 9962 || e === 9970 || e === 9971 || e === 9973 || e === 9978 || e === 9981 || e === 9989 || e === 9994 || e === 9995 || e === 10024 || e === 10060 || e === 10062 || e >= 10067 && e <= 10069 || e === 10071 || e >= 10133 && e <= 10135 || e === 10160 || e === 10175 || e === 11035 || e === 11036 || e === 11088 || e === 11093 || e >= 11904 && e <= 11929 || e >= 11931 && e <= 12019 || e >= 12032 && e <= 12245 || e >= 12272 && e <= 12287 || e >= 12289 && e <= 12350 || e >= 12353 && e <= 12438 || e >= 12441 && e <= 12543 || e >= 12549 && e <= 12591 || e >= 12593 && e <= 12686 || e >= 12688 && e <= 12771 || e >= 12783 && e <= 12830 || e >= 12832 && e <= 12871 || e >= 12880 && e <= 19903 || e >= 19968 && e <= 42124 || e >= 42128 && e <= 42182 || e >= 43360 && e <= 43388 || e >= 44032 && e <= 55203 || e >= 63744 && e <= 64255 || e >= 65040 && e <= 65049 || e >= 65072 && e <= 65106 || e >= 65108 && e <= 65126 || e >= 65128 && e <= 65131 || e >= 94176 && e <= 94180 || e === 94192 || e === 94193 || e >= 94208 && e <= 100343 || e >= 100352 && e <= 101589 || e >= 101632 && e <= 101640 || e >= 110576 && e <= 110579 || e >= 110581 && e <= 110587 || e === 110589 || e === 110590 || e >= 110592 && e <= 110882 || e === 110898 || e >= 110928 && e <= 110930 || e === 110933 || e >= 110948 && e <= 110951 || e >= 110960 && e <= 111355 || e === 126980 || e === 127183 || e === 127374 || e >= 127377 && e <= 127386 || e >= 127488 && e <= 127490 || e >= 127504 && e <= 127547 || e >= 127552 && e <= 127560 || e === 127568 || e === 127569 || e >= 127584 && e <= 127589 || e >= 127744 && e <= 127776 || e >= 127789 && e <= 127797 || e >= 127799 && e <= 127868 || e >= 127870 && e <= 127891 || e >= 127904 && e <= 127946 || e >= 127951 && e <= 127955 || e >= 127968 && e <= 127984 || e === 127988 || e >= 127992 && e <= 128062 || e === 128064 || e >= 128066 && e <= 128252 || e >= 128255 && e <= 128317 || e >= 128331 && e <= 128334 || e >= 128336 && e <= 128359 || e === 128378 || e === 128405 || e === 128406 || e === 128420 || e >= 128507 && e <= 128591 || e >= 128640 && e <= 128709 || e === 128716 || e >= 128720 && e <= 128722 || e >= 128725 && e <= 128727 || e >= 128732 && e <= 128735 || e === 128747 || e === 128748 || e >= 128756 && e <= 128764 || e >= 128992 && e <= 129003 || e === 129008 || e >= 129292 && e <= 129338 || e >= 129340 && e <= 129349 || e >= 129351 && e <= 129535 || e >= 129648 && e <= 129660 || e >= 129664 && e <= 129672 || e >= 129680 && e <= 129725 || e >= 129727 && e <= 129733 || e >= 129742 && e <= 129755 || e >= 129760 && e <= 129768 || e >= 129776 && e <= 129784 || e >= 131072 && e <= 196605 || e >= 196608 && e <= 262141;
|
|
17074
|
-
var we = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y;
|
|
17075
|
-
var re = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y;
|
|
17076
|
-
var ie = /\t{1,1000}/y;
|
|
17077
|
-
var Ae = /[\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;
|
|
17078
|
-
var ne = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y;
|
|
17079
|
-
var Ft2 = /\p{M}+/gu;
|
|
17080
17024
|
var yt2 = { limit: 1 / 0, ellipsis: "" };
|
|
17081
|
-
var Le = (e, r = {}, s = {}) => {
|
|
17082
|
-
const i = r.limit ?? 1 / 0, a = r.ellipsis ?? "", o = r?.ellipsisWidth ?? (a ? Le(a, yt2, s).width : 0), u = s.ansiWidth ?? 0, l = s.controlWidth ?? 0, n = s.tabWidth ?? 8, c = s.ambiguousWidth ?? 1, p = s.emojiWidth ?? 2, f = s.fullWidthWidth ?? 2, g = s.regularWidth ?? 1, E = s.wideWidth ?? 2;
|
|
17083
|
-
let $ = 0, m = 0, d = e.length, F = 0, y2 = false, v = d, C = Math.max(0, i - o), A = 0, b = 0, w = 0, S2 = 0;
|
|
17084
|
-
e:
|
|
17085
|
-
for (;; ) {
|
|
17086
|
-
if (b > A || m >= d && m > $) {
|
|
17087
|
-
const T2 = e.slice(A, b) || e.slice($, m);
|
|
17088
|
-
F = 0;
|
|
17089
|
-
for (const M2 of T2.replaceAll(Ft2, "")) {
|
|
17090
|
-
const O2 = M2.codePointAt(0) || 0;
|
|
17091
|
-
if (gt2(O2) ? S2 = f : ft2(O2) ? S2 = E : c !== g && mt2(O2) ? S2 = c : S2 = g, w + S2 > C && (v = Math.min(v, Math.max(A, $) + F)), w + S2 > i) {
|
|
17092
|
-
y2 = true;
|
|
17093
|
-
break e;
|
|
17094
|
-
}
|
|
17095
|
-
F += M2.length, w += S2;
|
|
17096
|
-
}
|
|
17097
|
-
A = b = 0;
|
|
17098
|
-
}
|
|
17099
|
-
if (m >= d)
|
|
17100
|
-
break;
|
|
17101
|
-
if (ne.lastIndex = m, ne.test(e)) {
|
|
17102
|
-
if (F = ne.lastIndex - m, S2 = F * g, w + S2 > C && (v = Math.min(v, m + Math.floor((C - w) / g))), w + S2 > i) {
|
|
17103
|
-
y2 = true;
|
|
17104
|
-
break;
|
|
17105
|
-
}
|
|
17106
|
-
w += S2, A = $, b = m, m = $ = ne.lastIndex;
|
|
17107
|
-
continue;
|
|
17108
|
-
}
|
|
17109
|
-
if (we.lastIndex = m, we.test(e)) {
|
|
17110
|
-
if (w + u > C && (v = Math.min(v, m)), w + u > i) {
|
|
17111
|
-
y2 = true;
|
|
17112
|
-
break;
|
|
17113
|
-
}
|
|
17114
|
-
w += u, A = $, b = m, m = $ = we.lastIndex;
|
|
17115
|
-
continue;
|
|
17116
|
-
}
|
|
17117
|
-
if (re.lastIndex = m, re.test(e)) {
|
|
17118
|
-
if (F = re.lastIndex - m, S2 = F * l, w + S2 > C && (v = Math.min(v, m + Math.floor((C - w) / l))), w + S2 > i) {
|
|
17119
|
-
y2 = true;
|
|
17120
|
-
break;
|
|
17121
|
-
}
|
|
17122
|
-
w += S2, A = $, b = m, m = $ = re.lastIndex;
|
|
17123
|
-
continue;
|
|
17124
|
-
}
|
|
17125
|
-
if (ie.lastIndex = m, ie.test(e)) {
|
|
17126
|
-
if (F = ie.lastIndex - m, S2 = F * n, w + S2 > C && (v = Math.min(v, m + Math.floor((C - w) / n))), w + S2 > i) {
|
|
17127
|
-
y2 = true;
|
|
17128
|
-
break;
|
|
17129
|
-
}
|
|
17130
|
-
w += S2, A = $, b = m, m = $ = ie.lastIndex;
|
|
17131
|
-
continue;
|
|
17132
|
-
}
|
|
17133
|
-
if (Ae.lastIndex = m, Ae.test(e)) {
|
|
17134
|
-
if (w + p > C && (v = Math.min(v, m)), w + p > i) {
|
|
17135
|
-
y2 = true;
|
|
17136
|
-
break;
|
|
17137
|
-
}
|
|
17138
|
-
w += p, A = $, b = m, m = $ = Ae.lastIndex;
|
|
17139
|
-
continue;
|
|
17140
|
-
}
|
|
17141
|
-
m += 1;
|
|
17142
|
-
}
|
|
17143
|
-
return { width: y2 ? C : w, index: y2 ? v : d, truncated: y2, ellipsed: y2 && i >= o };
|
|
17144
|
-
};
|
|
17145
17025
|
var Et2 = { limit: 1 / 0, ellipsis: "", ellipsisWidth: 0 };
|
|
17146
|
-
var D2 = (e, r = {}) => Le(e, Et2, r).width;
|
|
17147
|
-
var ae = "\x1B";
|
|
17148
|
-
var je = "";
|
|
17149
|
-
var vt2 = 39;
|
|
17150
17026
|
var Ce = "\x07";
|
|
17151
17027
|
var ke = "[";
|
|
17152
17028
|
var wt2 = "]";
|
|
17153
|
-
var Ve = "m";
|
|
17154
17029
|
var Se = `${wt2}8;;`;
|
|
17155
17030
|
var He = new RegExp(`(?:\\${ke}(?<code>\\d+)m|\\${Se}(?<uri>.*)${Ce})`, "y");
|
|
17156
|
-
var At2 = (e) => {
|
|
17157
|
-
if (e >= 30 && e <= 37 || e >= 90 && e <= 97)
|
|
17158
|
-
return 39;
|
|
17159
|
-
if (e >= 40 && e <= 47 || e >= 100 && e <= 107)
|
|
17160
|
-
return 49;
|
|
17161
|
-
if (e === 1 || e === 2)
|
|
17162
|
-
return 22;
|
|
17163
|
-
if (e === 3)
|
|
17164
|
-
return 23;
|
|
17165
|
-
if (e === 4)
|
|
17166
|
-
return 24;
|
|
17167
|
-
if (e === 7)
|
|
17168
|
-
return 27;
|
|
17169
|
-
if (e === 8)
|
|
17170
|
-
return 28;
|
|
17171
|
-
if (e === 9)
|
|
17172
|
-
return 29;
|
|
17173
|
-
if (e === 0)
|
|
17174
|
-
return 0;
|
|
17175
|
-
};
|
|
17176
|
-
var Ue = (e) => `${ae}${ke}${e}${Ve}`;
|
|
17177
|
-
var Ke = (e) => `${ae}${Se}${e}${Ce}`;
|
|
17178
|
-
var Ct2 = (e) => e.map((r) => D2(r));
|
|
17179
|
-
var Ie = (e, r, s) => {
|
|
17180
|
-
const i = r[Symbol.iterator]();
|
|
17181
|
-
let a = false, o = false, u = e.at(-1), l = u === undefined ? 0 : D2(u), n = i.next(), c = i.next(), p = 0;
|
|
17182
|
-
for (;!n.done; ) {
|
|
17183
|
-
const f = n.value, g = D2(f);
|
|
17184
|
-
l + g <= s ? e[e.length - 1] += f : (e.push(f), l = 0), (f === ae || f === je) && (a = true, o = r.startsWith(Se, p + 1)), a ? o ? f === Ce && (a = false, o = false) : f === Ve && (a = false) : (l += g, l === s && !c.done && (e.push(""), l = 0)), n = c, c = i.next(), p += f.length;
|
|
17185
|
-
}
|
|
17186
|
-
u = e.at(-1), !l && u !== undefined && u.length > 0 && e.length > 1 && (e[e.length - 2] += e.pop());
|
|
17187
|
-
};
|
|
17188
|
-
var St2 = (e) => {
|
|
17189
|
-
const r = e.split(" ");
|
|
17190
|
-
let s = r.length;
|
|
17191
|
-
for (;s > 0 && !(D2(r[s - 1]) > 0); )
|
|
17192
|
-
s--;
|
|
17193
|
-
return s === r.length ? e : r.slice(0, s).join(" ") + r.slice(s).join("");
|
|
17194
|
-
};
|
|
17195
|
-
var It2 = (e, r, s = {}) => {
|
|
17196
|
-
if (s.trim !== false && e.trim() === "")
|
|
17197
|
-
return "";
|
|
17198
|
-
let i = "", a, o;
|
|
17199
|
-
const u = e.split(" "), l = Ct2(u);
|
|
17200
|
-
let n = [""];
|
|
17201
|
-
for (const [$, m] of u.entries()) {
|
|
17202
|
-
s.trim !== false && (n[n.length - 1] = (n.at(-1) ?? "").trimStart());
|
|
17203
|
-
let d = D2(n.at(-1) ?? "");
|
|
17204
|
-
if ($ !== 0 && (d >= r && (s.wordWrap === false || s.trim === false) && (n.push(""), d = 0), (d > 0 || s.trim === false) && (n[n.length - 1] += " ", d++)), s.hard && l[$] > r) {
|
|
17205
|
-
const F = r - d, y2 = 1 + Math.floor((l[$] - F - 1) / r);
|
|
17206
|
-
Math.floor((l[$] - 1) / r) < y2 && n.push(""), Ie(n, m, r);
|
|
17207
|
-
continue;
|
|
17208
|
-
}
|
|
17209
|
-
if (d + l[$] > r && d > 0 && l[$] > 0) {
|
|
17210
|
-
if (s.wordWrap === false && d < r) {
|
|
17211
|
-
Ie(n, m, r);
|
|
17212
|
-
continue;
|
|
17213
|
-
}
|
|
17214
|
-
n.push("");
|
|
17215
|
-
}
|
|
17216
|
-
if (d + l[$] > r && s.wordWrap === false) {
|
|
17217
|
-
Ie(n, m, r);
|
|
17218
|
-
continue;
|
|
17219
|
-
}
|
|
17220
|
-
n[n.length - 1] += m;
|
|
17221
|
-
}
|
|
17222
|
-
s.trim !== false && (n = n.map(($) => St2($)));
|
|
17223
|
-
const c = n.join(`
|
|
17224
|
-
`), p = c[Symbol.iterator]();
|
|
17225
|
-
let f = p.next(), g = p.next(), E = 0;
|
|
17226
|
-
for (;!f.done; ) {
|
|
17227
|
-
const $ = f.value, m = g.value;
|
|
17228
|
-
if (i += $, $ === ae || $ === je) {
|
|
17229
|
-
He.lastIndex = E + 1;
|
|
17230
|
-
const y2 = He.exec(c)?.groups;
|
|
17231
|
-
if (y2?.code !== undefined) {
|
|
17232
|
-
const v = Number.parseFloat(y2.code);
|
|
17233
|
-
a = v === vt2 ? undefined : v;
|
|
17234
|
-
} else
|
|
17235
|
-
y2?.uri !== undefined && (o = y2.uri.length === 0 ? undefined : y2.uri);
|
|
17236
|
-
}
|
|
17237
|
-
const d = a ? At2(a) : undefined;
|
|
17238
|
-
m === `
|
|
17239
|
-
` ? (o && (i += Ke("")), a && d && (i += Ue(d))) : $ === `
|
|
17240
|
-
` && (a && d && (i += Ue(a)), o && (i += Ke(o))), E += $.length, f = g, g = p.next();
|
|
17241
|
-
}
|
|
17242
|
-
return i;
|
|
17243
|
-
};
|
|
17244
|
-
function J(e, r, s) {
|
|
17245
|
-
return String(e).normalize().replaceAll(`\r
|
|
17246
|
-
`, `
|
|
17247
|
-
`).split(`
|
|
17248
|
-
`).map((i) => It2(i, r, s)).join(`
|
|
17249
|
-
`);
|
|
17250
|
-
}
|
|
17251
|
-
var bt2 = (e, r, s, i, a) => {
|
|
17252
|
-
let o = r, u = 0;
|
|
17253
|
-
for (let l = s;l < i; l++) {
|
|
17254
|
-
const n = e[l];
|
|
17255
|
-
if (o = o - n.length, u++, o <= a)
|
|
17256
|
-
break;
|
|
17257
|
-
}
|
|
17258
|
-
return { lineCount: o, removals: u };
|
|
17259
|
-
};
|
|
17260
|
-
var X2 = ({ cursor: e, options: r, style: s, output: i = process.stdout, maxItems: a = Number.POSITIVE_INFINITY, columnPadding: o = 0, rowPadding: u = 4 }) => {
|
|
17261
|
-
const l = rt(i) - o, n = nt(i), c = import_node_util2.styleText("dim", "..."), p = Math.max(n - u, 0), f = Math.max(Math.min(a, p), 5);
|
|
17262
|
-
let g = 0;
|
|
17263
|
-
e >= f - 3 && (g = Math.max(Math.min(e - f + 3, r.length - f), 0));
|
|
17264
|
-
let E = f < r.length && g > 0, $ = f < r.length && g + f < r.length;
|
|
17265
|
-
const m = Math.min(g + f, r.length), d = [];
|
|
17266
|
-
let F = 0;
|
|
17267
|
-
E && F++, $ && F++;
|
|
17268
|
-
const y2 = g + (E ? 1 : 0), v = m - ($ ? 1 : 0);
|
|
17269
|
-
for (let A = y2;A < v; A++) {
|
|
17270
|
-
const b = J(s(r[A], A === e), l, { hard: true, trim: false }).split(`
|
|
17271
|
-
`);
|
|
17272
|
-
d.push(b), F += b.length;
|
|
17273
|
-
}
|
|
17274
|
-
if (F > p) {
|
|
17275
|
-
let A = 0, b = 0, w = F;
|
|
17276
|
-
const S2 = e - y2, T2 = (M2, O2) => bt2(d, w, M2, O2, p);
|
|
17277
|
-
E ? ({ lineCount: w, removals: A } = T2(0, S2), w > p && ({ lineCount: w, removals: b } = T2(S2 + 1, d.length))) : ({ lineCount: w, removals: b } = T2(S2 + 1, d.length), w > p && ({ lineCount: w, removals: A } = T2(0, S2))), A > 0 && (E = true, d.splice(0, A)), b > 0 && ($ = true, d.splice(d.length - b, b));
|
|
17278
|
-
}
|
|
17279
|
-
const C = [];
|
|
17280
|
-
E && C.push(c);
|
|
17281
|
-
for (const A of d)
|
|
17282
|
-
for (const b of A)
|
|
17283
|
-
C.push(b);
|
|
17284
|
-
return $ && C.push(c), C;
|
|
17285
|
-
};
|
|
17286
17031
|
var Rt = (e) => {
|
|
17287
17032
|
const r = e.active ?? "Yes", s = e.inactive ?? "No";
|
|
17288
17033
|
return new kt({ active: r, inactive: s, signal: e.signal, input: e.input, output: e.output, initialValue: e.initialValue ?? true, render() {
|
|
@@ -17329,51 +17074,6 @@ ${import_node_util2.styleText("gray", x2)} ` : "";
|
|
|
17329
17074
|
`);
|
|
17330
17075
|
};
|
|
17331
17076
|
var ze = { light: I2("─", "-"), heavy: I2("━", "="), block: I2("█", "#") };
|
|
17332
|
-
var oe = (e, r) => e.includes(`
|
|
17333
|
-
`) ? e.split(`
|
|
17334
|
-
`).map((s) => r(s)).join(`
|
|
17335
|
-
`) : r(e);
|
|
17336
|
-
var Jt = (e) => {
|
|
17337
|
-
const r = (s, i) => {
|
|
17338
|
-
const a = s.label ?? String(s.value);
|
|
17339
|
-
switch (i) {
|
|
17340
|
-
case "disabled":
|
|
17341
|
-
return `${import_node_util2.styleText("gray", H2)} ${oe(a, (o) => import_node_util2.styleText("gray", o))}${s.hint ? ` ${import_node_util2.styleText("dim", `(${s.hint ?? "disabled"})`)}` : ""}`;
|
|
17342
|
-
case "selected":
|
|
17343
|
-
return `${oe(a, (o) => import_node_util2.styleText("dim", o))}`;
|
|
17344
|
-
case "active":
|
|
17345
|
-
return `${import_node_util2.styleText("green", z2)} ${a}${s.hint ? ` ${import_node_util2.styleText("dim", `(${s.hint})`)}` : ""}`;
|
|
17346
|
-
case "cancelled":
|
|
17347
|
-
return `${oe(a, (o) => import_node_util2.styleText(["strikethrough", "dim"], o))}`;
|
|
17348
|
-
default:
|
|
17349
|
-
return `${import_node_util2.styleText("dim", H2)} ${oe(a, (o) => import_node_util2.styleText("dim", o))}`;
|
|
17350
|
-
}
|
|
17351
|
-
};
|
|
17352
|
-
return new Tt({ options: e.options, signal: e.signal, input: e.input, output: e.output, initialValue: e.initialValue, render() {
|
|
17353
|
-
const s = e.withGuide ?? _.withGuide, i = `${W2(this.state)} `, a = `${ve(this.state)} `, o = Bt(e.output, e.message, a, i), u = `${s ? `${import_node_util2.styleText("gray", h)}
|
|
17354
|
-
` : ""}${o}
|
|
17355
|
-
`;
|
|
17356
|
-
switch (this.state) {
|
|
17357
|
-
case "submit": {
|
|
17358
|
-
const l = s ? `${import_node_util2.styleText("gray", h)} ` : "", n = Bt(e.output, r(this.options[this.cursor], "selected"), l);
|
|
17359
|
-
return `${u}${n}`;
|
|
17360
|
-
}
|
|
17361
|
-
case "cancel": {
|
|
17362
|
-
const l = s ? `${import_node_util2.styleText("gray", h)} ` : "", n = Bt(e.output, r(this.options[this.cursor], "cancelled"), l);
|
|
17363
|
-
return `${u}${n}${s ? `
|
|
17364
|
-
${import_node_util2.styleText("gray", h)}` : ""}`;
|
|
17365
|
-
}
|
|
17366
|
-
default: {
|
|
17367
|
-
const l = s ? `${import_node_util2.styleText("cyan", h)} ` : "", n = s ? import_node_util2.styleText("cyan", x2) : "", c = u.split(`
|
|
17368
|
-
`).length, p = s ? 2 : 1;
|
|
17369
|
-
return `${u}${l}${X2({ output: e.output, cursor: this.cursor, options: this.options, maxItems: e.maxItems, columnPadding: l.length, rowPadding: c + p, style: (f, g) => r(f, f.disabled ? "disabled" : g ? "active" : "inactive") }).join(`
|
|
17370
|
-
${l}`)}
|
|
17371
|
-
${n}
|
|
17372
|
-
`;
|
|
17373
|
-
}
|
|
17374
|
-
}
|
|
17375
|
-
} }).prompt();
|
|
17376
|
-
};
|
|
17377
17077
|
var Qe = `${import_node_util2.styleText("gray", h)} `;
|
|
17378
17078
|
|
|
17379
17079
|
// ui.ts
|
|
@@ -17395,9 +17095,9 @@ function usage(exitCode = 1) {
|
|
|
17395
17095
|
${BOLD}oathbound${RESET} — install, verify, and publish skills & agents
|
|
17396
17096
|
|
|
17397
17097
|
${DIM}Usage:${RESET}
|
|
17398
|
-
oathbound init
|
|
17399
|
-
oathbound pull <namespace/skill-name[@version]>
|
|
17400
|
-
oathbound install <namespace/skill-name[@version]>
|
|
17098
|
+
oathbound init [--global|--local] ${DIM}Setup wizard (default: global + local)${RESET}
|
|
17099
|
+
oathbound pull <namespace/skill-name[@version]> [--global]
|
|
17100
|
+
oathbound install <namespace/skill-name[@version]> [--global]
|
|
17401
17101
|
oathbound push [path] [--private] ${DIM}Publish a skill to the registry${RESET}
|
|
17402
17102
|
oathbound search [query] ${DIM}Search skills in the registry${RESET}
|
|
17403
17103
|
oathbound list ${DIM}List all public skills${RESET}
|
|
@@ -17557,8 +17257,9 @@ function hasOathboundHooks(settings) {
|
|
|
17557
17257
|
}
|
|
17558
17258
|
return false;
|
|
17559
17259
|
}
|
|
17560
|
-
function mergeClaudeSettings() {
|
|
17561
|
-
const
|
|
17260
|
+
function mergeClaudeSettings(targetDir) {
|
|
17261
|
+
const baseDir = targetDir ?? process.cwd();
|
|
17262
|
+
const claudeDir = import_node_path.join(baseDir, ".claude");
|
|
17562
17263
|
const settingsPath = import_node_path.join(claudeDir, "settings.json");
|
|
17563
17264
|
if (!import_node_fs.existsSync(settingsPath)) {
|
|
17564
17265
|
import_node_fs.mkdirSync(claudeDir, { recursive: true });
|
|
@@ -17681,8 +17382,8 @@ function compareSemver(a, b) {
|
|
|
17681
17382
|
}
|
|
17682
17383
|
|
|
17683
17384
|
// verify.ts
|
|
17684
|
-
var
|
|
17685
|
-
var
|
|
17385
|
+
var import_node_fs5 = require("node:fs");
|
|
17386
|
+
var import_node_path5 = require("node:path");
|
|
17686
17387
|
var import_node_os2 = require("node:os");
|
|
17687
17388
|
var import_yaml = __toESM(require_dist(), 1);
|
|
17688
17389
|
|
|
@@ -17725,9 +17426,66 @@ function hashSkillDir(skillDir) {
|
|
|
17725
17426
|
return contentHash(files);
|
|
17726
17427
|
}
|
|
17727
17428
|
|
|
17429
|
+
// project-setup.ts
|
|
17430
|
+
var import_node_child_process = require("node:child_process");
|
|
17431
|
+
var import_node_fs4 = require("node:fs");
|
|
17432
|
+
var import_node_path4 = require("node:path");
|
|
17433
|
+
function detectPackageManager() {
|
|
17434
|
+
if (import_node_fs4.existsSync(import_node_path4.join(process.cwd(), "bun.lockb")) || import_node_fs4.existsSync(import_node_path4.join(process.cwd(), "bun.lock")))
|
|
17435
|
+
return "bun";
|
|
17436
|
+
if (import_node_fs4.existsSync(import_node_path4.join(process.cwd(), "pnpm-lock.yaml")))
|
|
17437
|
+
return "pnpm";
|
|
17438
|
+
if (import_node_fs4.existsSync(import_node_path4.join(process.cwd(), "yarn.lock")))
|
|
17439
|
+
return "yarn";
|
|
17440
|
+
return "npm";
|
|
17441
|
+
}
|
|
17442
|
+
function installDevDependency() {
|
|
17443
|
+
const pkgPath = import_node_path4.join(process.cwd(), "package.json");
|
|
17444
|
+
if (!import_node_fs4.existsSync(pkgPath))
|
|
17445
|
+
return "no-package-json";
|
|
17446
|
+
try {
|
|
17447
|
+
const pkg = JSON.parse(import_node_fs4.readFileSync(pkgPath, "utf-8"));
|
|
17448
|
+
if (pkg.devDependencies?.oathbound || pkg.dependencies?.oathbound)
|
|
17449
|
+
return "skipped";
|
|
17450
|
+
} catch {}
|
|
17451
|
+
const pm = detectPackageManager();
|
|
17452
|
+
const cmds = {
|
|
17453
|
+
bun: ["bun", ["add", "--dev", "oathbound"]],
|
|
17454
|
+
pnpm: ["pnpm", ["add", "--save-dev", "oathbound"]],
|
|
17455
|
+
yarn: ["yarn", ["add", "--dev", "oathbound"]],
|
|
17456
|
+
npm: ["npm", ["install", "--save-dev", "oathbound"]]
|
|
17457
|
+
};
|
|
17458
|
+
const [bin, args] = cmds[pm];
|
|
17459
|
+
try {
|
|
17460
|
+
import_node_child_process.execFileSync(bin, args, { stdio: "pipe", cwd: process.cwd() });
|
|
17461
|
+
return "installed";
|
|
17462
|
+
} catch {
|
|
17463
|
+
return "failed";
|
|
17464
|
+
}
|
|
17465
|
+
}
|
|
17466
|
+
function addPrepareScript() {
|
|
17467
|
+
const pkgPath = import_node_path4.join(process.cwd(), "package.json");
|
|
17468
|
+
if (!import_node_fs4.existsSync(pkgPath))
|
|
17469
|
+
return "skipped";
|
|
17470
|
+
let pkg;
|
|
17471
|
+
try {
|
|
17472
|
+
pkg = JSON.parse(import_node_fs4.readFileSync(pkgPath, "utf-8"));
|
|
17473
|
+
} catch {
|
|
17474
|
+
return "skipped";
|
|
17475
|
+
}
|
|
17476
|
+
const prepare = pkg.scripts?.prepare ?? "";
|
|
17477
|
+
if (prepare.includes("oathbound setup"))
|
|
17478
|
+
return "skipped";
|
|
17479
|
+
const newPrepare = prepare ? `${prepare} && oathbound setup` : "oathbound setup";
|
|
17480
|
+
pkg.scripts = { ...pkg.scripts ?? {}, prepare: newPrepare };
|
|
17481
|
+
import_node_fs4.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + `
|
|
17482
|
+
`);
|
|
17483
|
+
return prepare ? "appended" : "added";
|
|
17484
|
+
}
|
|
17485
|
+
|
|
17728
17486
|
// verify.ts
|
|
17729
17487
|
function sessionStatePath(sessionId) {
|
|
17730
|
-
return
|
|
17488
|
+
return import_node_path5.join(import_node_os2.tmpdir(), `oathbound-${sessionId}.json`);
|
|
17731
17489
|
}
|
|
17732
17490
|
async function readStdin() {
|
|
17733
17491
|
const chunks = [];
|
|
@@ -17736,45 +17494,113 @@ async function readStdin() {
|
|
|
17736
17494
|
}
|
|
17737
17495
|
return Buffer.concat(chunks).toString("utf-8");
|
|
17738
17496
|
}
|
|
17739
|
-
function
|
|
17497
|
+
function resolveLocalSkillsDir() {
|
|
17740
17498
|
const cwd = process.cwd();
|
|
17741
17499
|
const normalized = cwd.replace(/\/+$/, "");
|
|
17742
17500
|
if (normalized.endsWith(".claude/skills"))
|
|
17743
17501
|
return cwd;
|
|
17744
17502
|
if (normalized.endsWith(".claude")) {
|
|
17745
|
-
const skills =
|
|
17746
|
-
if (
|
|
17503
|
+
const skills = import_node_path5.join(cwd, "skills");
|
|
17504
|
+
if (import_node_fs5.existsSync(skills))
|
|
17747
17505
|
return skills;
|
|
17748
17506
|
}
|
|
17749
|
-
const direct =
|
|
17750
|
-
if (
|
|
17507
|
+
const direct = import_node_path5.join(cwd, ".claude", "skills");
|
|
17508
|
+
if (import_node_fs5.existsSync(direct))
|
|
17751
17509
|
return direct;
|
|
17752
17510
|
const SKIP = new Set(["node_modules", ".git", "dist", "build", ".next"]);
|
|
17753
17511
|
function search(dir, depth) {
|
|
17754
17512
|
if (depth <= 0)
|
|
17755
17513
|
return null;
|
|
17756
17514
|
try {
|
|
17757
|
-
const entries =
|
|
17515
|
+
const entries = import_node_fs5.readdirSync(dir, { withFileTypes: true });
|
|
17758
17516
|
for (const entry of entries) {
|
|
17759
17517
|
if (!entry.isDirectory() || SKIP.has(entry.name))
|
|
17760
17518
|
continue;
|
|
17761
17519
|
if (entry.name === ".claude") {
|
|
17762
|
-
const skills =
|
|
17763
|
-
if (
|
|
17520
|
+
const skills = import_node_path5.join(dir, ".claude", "skills");
|
|
17521
|
+
if (import_node_fs5.existsSync(skills))
|
|
17764
17522
|
return skills;
|
|
17765
17523
|
}
|
|
17766
17524
|
}
|
|
17767
17525
|
for (const entry of entries) {
|
|
17768
17526
|
if (!entry.isDirectory() || SKIP.has(entry.name) || entry.name.startsWith("."))
|
|
17769
17527
|
continue;
|
|
17770
|
-
const result = search(
|
|
17528
|
+
const result = search(import_node_path5.join(dir, entry.name), depth - 1);
|
|
17771
17529
|
if (result)
|
|
17772
17530
|
return result;
|
|
17773
17531
|
}
|
|
17774
17532
|
} catch {}
|
|
17775
17533
|
return null;
|
|
17776
17534
|
}
|
|
17777
|
-
return search(cwd, 5)
|
|
17535
|
+
return search(cwd, 5);
|
|
17536
|
+
}
|
|
17537
|
+
function hasSkillSubdirs(dir) {
|
|
17538
|
+
try {
|
|
17539
|
+
const entries = import_node_fs5.readdirSync(dir, { withFileTypes: true });
|
|
17540
|
+
return entries.some((e) => e.isDirectory() && !e.name.startsWith("."));
|
|
17541
|
+
} catch {
|
|
17542
|
+
return false;
|
|
17543
|
+
}
|
|
17544
|
+
}
|
|
17545
|
+
function findSkillsDirs() {
|
|
17546
|
+
const results = [];
|
|
17547
|
+
const globalDir = import_node_path5.join(import_node_os2.homedir(), ".claude", "skills");
|
|
17548
|
+
if (import_node_fs5.existsSync(globalDir) && hasSkillSubdirs(globalDir)) {
|
|
17549
|
+
results.push({ path: globalDir, source: "global" });
|
|
17550
|
+
}
|
|
17551
|
+
const localDir = resolveLocalSkillsDir();
|
|
17552
|
+
if (localDir && hasSkillSubdirs(localDir)) {
|
|
17553
|
+
results.push({ path: localDir, source: "local" });
|
|
17554
|
+
}
|
|
17555
|
+
return results;
|
|
17556
|
+
}
|
|
17557
|
+
function propagateToProject() {
|
|
17558
|
+
try {
|
|
17559
|
+
const cwd = process.cwd();
|
|
17560
|
+
const localSkills = import_node_path5.join(cwd, ".claude", "skills");
|
|
17561
|
+
if (!import_node_fs5.existsSync(localSkills))
|
|
17562
|
+
return;
|
|
17563
|
+
if (!hasSkillSubdirs(localSkills))
|
|
17564
|
+
return;
|
|
17565
|
+
if (import_node_fs5.existsSync(import_node_path5.join(cwd, ".oathbound.jsonc")))
|
|
17566
|
+
return;
|
|
17567
|
+
const pkgPath = import_node_path5.join(cwd, "package.json");
|
|
17568
|
+
if (!import_node_fs5.existsSync(pkgPath))
|
|
17569
|
+
return;
|
|
17570
|
+
writeOathboundConfig("warn");
|
|
17571
|
+
const raw = import_node_fs5.readFileSync(pkgPath, "utf-8");
|
|
17572
|
+
const pkg = JSON.parse(raw);
|
|
17573
|
+
if (!pkg.devDependencies?.oathbound && !pkg.dependencies?.oathbound) {
|
|
17574
|
+
pkg.devDependencies = { ...pkg.devDependencies ?? {}, oathbound: "latest" };
|
|
17575
|
+
const indent = raw.match(/^(\s+)/m)?.[1]?.length ?? 2;
|
|
17576
|
+
import_node_fs5.writeFileSync(pkgPath, JSON.stringify(pkg, null, indent) + `
|
|
17577
|
+
`);
|
|
17578
|
+
}
|
|
17579
|
+
addPrepareScript();
|
|
17580
|
+
mergeClaudeSettings();
|
|
17581
|
+
process.stderr.write(`
|
|
17582
|
+
Oathbound: configured project for team verification.
|
|
17583
|
+
`);
|
|
17584
|
+
process.stderr.write(` Created .oathbound.jsonc
|
|
17585
|
+
`);
|
|
17586
|
+
process.stderr.write(` Added oathbound to devDependencies
|
|
17587
|
+
`);
|
|
17588
|
+
process.stderr.write(` Added prepare script to package.json
|
|
17589
|
+
|
|
17590
|
+
`);
|
|
17591
|
+
process.stderr.write(` Commit these changes to protect your team:
|
|
17592
|
+
`);
|
|
17593
|
+
process.stderr.write(` git add .oathbound.jsonc package.json .claude/settings.json
|
|
17594
|
+
|
|
17595
|
+
`);
|
|
17596
|
+
process.stderr.write(` Then run: npm install (or bun/pnpm install)
|
|
17597
|
+
|
|
17598
|
+
`);
|
|
17599
|
+
} catch (err) {
|
|
17600
|
+
const msg = err instanceof Error ? err.message : "Unknown error";
|
|
17601
|
+
process.stderr.write(`oathbound: auto-propagation warning: ${msg}
|
|
17602
|
+
`);
|
|
17603
|
+
}
|
|
17778
17604
|
}
|
|
17779
17605
|
function skillNameFromPath(filePath) {
|
|
17780
17606
|
const marker = ".claude/skills/";
|
|
@@ -17817,30 +17643,34 @@ ${TEAL}${BOLD}⬡ oathbound${RESET} ${YELLOW}⚠ Warning:${RESET} skill ${BOLD}"
|
|
|
17817
17643
|
`);
|
|
17818
17644
|
process.exit(0);
|
|
17819
17645
|
}
|
|
17820
|
-
function isExternalSkillAccess(toolName, toolInput,
|
|
17821
|
-
const
|
|
17646
|
+
function isExternalSkillAccess(toolName, toolInput, knownDirs, baseName) {
|
|
17647
|
+
const resolvedDirs = knownDirs.map((d) => import_node_path5.resolve(d));
|
|
17648
|
+
const isUnderKnownDir = (p) => {
|
|
17649
|
+
const rp = import_node_path5.resolve(p);
|
|
17650
|
+
return resolvedDirs.some((d) => rp.startsWith(d));
|
|
17651
|
+
};
|
|
17822
17652
|
if (toolName === "Read") {
|
|
17823
17653
|
const p = String(toolInput.file_path ?? "");
|
|
17824
|
-
if (p && !
|
|
17654
|
+
if (p && !isUnderKnownDir(p))
|
|
17825
17655
|
return true;
|
|
17826
17656
|
}
|
|
17827
17657
|
if (toolName === "Glob" || toolName === "Grep") {
|
|
17828
17658
|
const p = String(toolInput.path ?? "");
|
|
17829
|
-
if (p && !
|
|
17659
|
+
if (p && !isUnderKnownDir(p))
|
|
17830
17660
|
return true;
|
|
17831
17661
|
}
|
|
17832
17662
|
if (toolName === "Bash") {
|
|
17833
17663
|
const cmd = String(toolInput.command ?? "");
|
|
17834
|
-
if (cmd.includes("/.claude/skills/" + baseName) && !cmd.includes(
|
|
17664
|
+
if (cmd.includes("/.claude/skills/" + baseName) && !resolvedDirs.some((d) => cmd.includes(d)))
|
|
17835
17665
|
return true;
|
|
17836
17666
|
}
|
|
17837
17667
|
return false;
|
|
17838
17668
|
}
|
|
17839
17669
|
function parseSkillVersion(skillDir) {
|
|
17840
|
-
const skillMdPath =
|
|
17841
|
-
if (!
|
|
17670
|
+
const skillMdPath = import_node_path5.join(skillDir, "SKILL.md");
|
|
17671
|
+
if (!import_node_fs5.existsSync(skillMdPath))
|
|
17842
17672
|
return null;
|
|
17843
|
-
const content =
|
|
17673
|
+
const content = import_node_fs5.readFileSync(skillMdPath, "utf-8");
|
|
17844
17674
|
const match = content.match(/^---\s*\n([\s\S]*?)\n---\s*\n/);
|
|
17845
17675
|
if (!match)
|
|
17846
17676
|
return null;
|
|
@@ -17870,28 +17700,32 @@ async function verify(supabaseUrl, supabaseAnonKey) {
|
|
|
17870
17700
|
`);
|
|
17871
17701
|
process.exit(1);
|
|
17872
17702
|
}
|
|
17873
|
-
const
|
|
17874
|
-
|
|
17703
|
+
const skillsDirs = findSkillsDirs();
|
|
17704
|
+
propagateToProject();
|
|
17705
|
+
if (skillsDirs.length === 0) {
|
|
17875
17706
|
const state2 = { verified: {}, rejected: [], ok: true };
|
|
17876
|
-
|
|
17877
|
-
console.log(JSON.stringify({ hookSpecificOutput: { hookEventName: "SessionStart", additionalContext: "Oathbound: no
|
|
17707
|
+
import_node_fs5.writeFileSync(sessionStatePath(sessionId), JSON.stringify(state2));
|
|
17708
|
+
console.log(JSON.stringify({ hookSpecificOutput: { hookEventName: "SessionStart", additionalContext: "Oathbound: no skills found — nothing to verify." } }));
|
|
17878
17709
|
process.exit(0);
|
|
17879
17710
|
}
|
|
17880
|
-
const
|
|
17881
|
-
const
|
|
17882
|
-
|
|
17711
|
+
const localSkills = {};
|
|
17712
|
+
for (const { path: dir } of skillsDirs) {
|
|
17713
|
+
const entries = import_node_fs5.readdirSync(dir, { withFileTypes: true });
|
|
17714
|
+
for (const e of entries.filter((e2) => e2.isDirectory() && !e2.name.startsWith("."))) {
|
|
17715
|
+
const fullPath = import_node_path5.join(dir, e.name);
|
|
17716
|
+
localSkills[e.name] = {
|
|
17717
|
+
hash: hashSkillDir(fullPath),
|
|
17718
|
+
version: parseSkillVersion(fullPath) ?? "1.0.0",
|
|
17719
|
+
dir: fullPath
|
|
17720
|
+
};
|
|
17721
|
+
}
|
|
17722
|
+
}
|
|
17723
|
+
if (Object.keys(localSkills).length === 0) {
|
|
17883
17724
|
const state2 = { verified: {}, rejected: [], ok: true };
|
|
17884
|
-
|
|
17725
|
+
import_node_fs5.writeFileSync(sessionStatePath(sessionId), JSON.stringify(state2));
|
|
17885
17726
|
console.log(JSON.stringify({ hookSpecificOutput: { hookEventName: "SessionStart", additionalContext: "Oathbound: no skills installed — nothing to verify." } }));
|
|
17886
17727
|
process.exit(0);
|
|
17887
17728
|
}
|
|
17888
|
-
const localSkills = {};
|
|
17889
|
-
for (const dir of skillDirs) {
|
|
17890
|
-
const fullPath = import_node_path4.join(skillsDir, dir.name);
|
|
17891
|
-
const hash = hashSkillDir(fullPath);
|
|
17892
|
-
const version3 = parseSkillVersion(fullPath) ?? "1.0.0";
|
|
17893
|
-
localSkills[dir.name] = { hash, version: version3 };
|
|
17894
|
-
}
|
|
17895
17729
|
const config = readOathboundConfig();
|
|
17896
17730
|
const enforcement = config?.enforcement ?? "warn";
|
|
17897
17731
|
const supabase = createClient(supabaseUrl, supabaseAnonKey);
|
|
@@ -17952,8 +17786,12 @@ async function verify(supabaseUrl, supabaseAnonKey) {
|
|
|
17952
17786
|
}
|
|
17953
17787
|
}
|
|
17954
17788
|
const ok = rejected.length === 0;
|
|
17955
|
-
const
|
|
17956
|
-
|
|
17789
|
+
const skillDirsMap = {};
|
|
17790
|
+
for (const [name, { dir }] of Object.entries(localSkills)) {
|
|
17791
|
+
skillDirsMap[name] = dir;
|
|
17792
|
+
}
|
|
17793
|
+
const state = { verified, rejected, ok, skillDirs: skillDirsMap };
|
|
17794
|
+
import_node_fs5.writeFileSync(sessionStatePath(sessionId), JSON.stringify(state));
|
|
17957
17795
|
if (ok && warnings.length === 0) {
|
|
17958
17796
|
const names = Object.keys(verified).join(", ");
|
|
17959
17797
|
console.log(JSON.stringify({
|
|
@@ -18027,23 +17865,42 @@ async function verifyCheck() {
|
|
|
18027
17865
|
process.exit(0);
|
|
18028
17866
|
const config = readOathboundConfig();
|
|
18029
17867
|
const enforcement = config?.enforcement ?? "warn";
|
|
18030
|
-
const skillsDir = findSkillsDir();
|
|
18031
|
-
if (isExternalSkillAccess(toolName, toolInput, skillsDir, baseName)) {
|
|
18032
|
-
process.exit(0);
|
|
18033
|
-
}
|
|
18034
17868
|
const stateFile = sessionStatePath(sessionId);
|
|
18035
|
-
if (!
|
|
17869
|
+
if (!import_node_fs5.existsSync(stateFile))
|
|
18036
17870
|
process.exit(0);
|
|
18037
17871
|
let state;
|
|
18038
17872
|
try {
|
|
18039
|
-
state = JSON.parse(
|
|
17873
|
+
state = JSON.parse(import_node_fs5.readFileSync(stateFile, "utf-8"));
|
|
18040
17874
|
} catch {
|
|
18041
17875
|
process.stderr.write(`oathbound verify --check: corrupt session state file
|
|
18042
17876
|
`);
|
|
18043
17877
|
process.exit(1);
|
|
18044
17878
|
}
|
|
18045
|
-
|
|
18046
|
-
if (
|
|
17879
|
+
let skillDir = null;
|
|
17880
|
+
if (state.skillDirs?.[baseName]) {
|
|
17881
|
+
skillDir = state.skillDirs[baseName];
|
|
17882
|
+
} else {
|
|
17883
|
+
for (const { path: dir } of findSkillsDirs()) {
|
|
17884
|
+
const candidate = import_node_path5.join(dir, baseName);
|
|
17885
|
+
if (import_node_fs5.existsSync(candidate) && import_node_fs5.statSync(candidate).isDirectory()) {
|
|
17886
|
+
skillDir = candidate;
|
|
17887
|
+
}
|
|
17888
|
+
}
|
|
17889
|
+
}
|
|
17890
|
+
const knownDirs = [];
|
|
17891
|
+
if (state.skillDirs) {
|
|
17892
|
+
const parentDirs = new Set;
|
|
17893
|
+
for (const d of Object.values(state.skillDirs)) {
|
|
17894
|
+
parentDirs.add(import_node_path5.join(d, ".."));
|
|
17895
|
+
}
|
|
17896
|
+
knownDirs.push(...parentDirs);
|
|
17897
|
+
} else {
|
|
17898
|
+
knownDirs.push(...findSkillsDirs().map((e) => e.path));
|
|
17899
|
+
}
|
|
17900
|
+
if (knownDirs.length > 0 && isExternalSkillAccess(toolName, toolInput, knownDirs, baseName)) {
|
|
17901
|
+
process.exit(0);
|
|
17902
|
+
}
|
|
17903
|
+
if (!skillDir || !import_node_fs5.existsSync(skillDir) || !import_node_fs5.statSync(skillDir).isDirectory()) {
|
|
18047
17904
|
if (enforcement === "warn") {
|
|
18048
17905
|
warnSkill(baseName, "not installed locally");
|
|
18049
17906
|
} else {
|
|
@@ -18072,38 +17929,38 @@ async function verifyCheck() {
|
|
|
18072
17929
|
}
|
|
18073
17930
|
|
|
18074
17931
|
// auth.ts
|
|
18075
|
-
var
|
|
18076
|
-
var
|
|
17932
|
+
var import_node_child_process2 = require("node:child_process");
|
|
17933
|
+
var import_node_fs6 = require("node:fs");
|
|
18077
17934
|
var import_node_http = require("node:http");
|
|
18078
|
-
var
|
|
17935
|
+
var import_node_path6 = require("node:path");
|
|
18079
17936
|
var import_node_os3 = require("node:os");
|
|
18080
17937
|
var SUPABASE_URL = "https://mjnfqagwuewhgwbtrdgs.supabase.co";
|
|
18081
17938
|
var SUPABASE_ANON_KEY = "sb_publishable_T-rk0azNRqAMLLGCyadyhQ_ulk9685n";
|
|
18082
17939
|
var API_BASE = process.env.OATHBOUND_API_URL ?? "https://www.oathbound.ai";
|
|
18083
|
-
var AUTH_DIR =
|
|
18084
|
-
var AUTH_FILE =
|
|
17940
|
+
var AUTH_DIR = import_node_path6.join(import_node_os3.homedir(), ".oathbound");
|
|
17941
|
+
var AUTH_FILE = import_node_path6.join(AUTH_DIR, "auth.json");
|
|
18085
17942
|
function saveSession(session) {
|
|
18086
|
-
|
|
18087
|
-
|
|
17943
|
+
import_node_fs6.mkdirSync(AUTH_DIR, { recursive: true, mode: 448 });
|
|
17944
|
+
import_node_fs6.writeFileSync(AUTH_FILE, JSON.stringify(session, null, 2), { mode: 384 });
|
|
18088
17945
|
}
|
|
18089
17946
|
function loadSession() {
|
|
18090
|
-
if (!
|
|
17947
|
+
if (!import_node_fs6.existsSync(AUTH_FILE))
|
|
18091
17948
|
return null;
|
|
18092
17949
|
try {
|
|
18093
|
-
return JSON.parse(
|
|
17950
|
+
return JSON.parse(import_node_fs6.readFileSync(AUTH_FILE, "utf-8"));
|
|
18094
17951
|
} catch {
|
|
18095
17952
|
return null;
|
|
18096
17953
|
}
|
|
18097
17954
|
}
|
|
18098
17955
|
function clearSession() {
|
|
18099
|
-
if (
|
|
18100
|
-
|
|
17956
|
+
if (import_node_fs6.existsSync(AUTH_FILE))
|
|
17957
|
+
import_node_fs6.unlinkSync(AUTH_FILE);
|
|
18101
17958
|
}
|
|
18102
17959
|
function openBrowser(url) {
|
|
18103
17960
|
const cmd = process.platform === "darwin" ? "open" : process.platform === "win32" ? "cmd" : "xdg-open";
|
|
18104
17961
|
const args = process.platform === "win32" ? ["/c", "start", "", url] : [url];
|
|
18105
17962
|
try {
|
|
18106
|
-
|
|
17963
|
+
import_node_child_process2.spawn(cmd, args, { stdio: "ignore", detached: true }).unref();
|
|
18107
17964
|
} catch {}
|
|
18108
17965
|
}
|
|
18109
17966
|
var SUCCESS_HTML = `<!DOCTYPE html>
|
|
@@ -18237,16 +18094,16 @@ ${BRAND}`);
|
|
|
18237
18094
|
}
|
|
18238
18095
|
|
|
18239
18096
|
// push.ts
|
|
18240
|
-
var
|
|
18241
|
-
var
|
|
18097
|
+
var import_node_fs7 = require("node:fs");
|
|
18098
|
+
var import_node_path7 = require("node:path");
|
|
18242
18099
|
var import_yaml2 = __toESM(require_dist(), 1);
|
|
18243
18100
|
var API_BASE2 = process.env.OATHBOUND_API_URL ?? "https://www.oathbound.ai";
|
|
18244
18101
|
async function push(pathArg, options) {
|
|
18245
18102
|
Wt2(BRAND);
|
|
18246
18103
|
const skillDir = resolveSkillDir(pathArg);
|
|
18247
18104
|
console.log(`${DIM} directory: ${skillDir}${RESET}`);
|
|
18248
|
-
if (!
|
|
18249
|
-
fail("No SKILL.md found", `Expected at ${
|
|
18105
|
+
if (!import_node_fs7.existsSync(import_node_path7.join(skillDir, "SKILL.md"))) {
|
|
18106
|
+
fail("No SKILL.md found", `Expected at ${import_node_path7.join(skillDir, "SKILL.md")}`);
|
|
18250
18107
|
}
|
|
18251
18108
|
const rawFiles = collectFiles(skillDir);
|
|
18252
18109
|
const skillMdFile = rawFiles.find((f) => f.path === "SKILL.md");
|
|
@@ -18318,13 +18175,13 @@ async function push(pathArg, options) {
|
|
|
18318
18175
|
}
|
|
18319
18176
|
function resolveSkillDir(pathArg) {
|
|
18320
18177
|
if (pathArg) {
|
|
18321
|
-
const resolved =
|
|
18322
|
-
if (!
|
|
18178
|
+
const resolved = import_node_path7.resolve(pathArg);
|
|
18179
|
+
if (!import_node_fs7.existsSync(resolved) || !import_node_fs7.statSync(resolved).isDirectory()) {
|
|
18323
18180
|
fail("Invalid path", `${resolved} is not a directory`);
|
|
18324
18181
|
}
|
|
18325
18182
|
return resolved;
|
|
18326
18183
|
}
|
|
18327
|
-
if (
|
|
18184
|
+
if (import_node_fs7.existsSync(import_node_path7.join(process.cwd(), "SKILL.md"))) {
|
|
18328
18185
|
return process.cwd();
|
|
18329
18186
|
}
|
|
18330
18187
|
fail("No skill directory found", "Run from within a skill directory or pass a path: oathbound push ./my-skill");
|
|
@@ -18447,8 +18304,8 @@ ${BRAND} ${TEAL}${showing}${RESET}
|
|
|
18447
18304
|
}
|
|
18448
18305
|
|
|
18449
18306
|
// agent-push.ts
|
|
18450
|
-
var
|
|
18451
|
-
var
|
|
18307
|
+
var import_node_fs8 = require("node:fs");
|
|
18308
|
+
var import_node_path8 = require("node:path");
|
|
18452
18309
|
var import_yaml3 = __toESM(require_dist(), 1);
|
|
18453
18310
|
var API_BASE4 = process.env.OATHBOUND_API_URL ?? "https://www.oathbound.ai";
|
|
18454
18311
|
function parseAgentFrontmatter(content) {
|
|
@@ -18461,11 +18318,11 @@ function parseAgentFrontmatter(content) {
|
|
|
18461
18318
|
}
|
|
18462
18319
|
function resolveAgentFile(pathArg) {
|
|
18463
18320
|
if (pathArg) {
|
|
18464
|
-
const resolved =
|
|
18465
|
-
if (!
|
|
18321
|
+
const resolved = import_node_path8.resolve(pathArg);
|
|
18322
|
+
if (!import_node_fs8.existsSync(resolved)) {
|
|
18466
18323
|
fail("File not found", resolved);
|
|
18467
18324
|
}
|
|
18468
|
-
if (
|
|
18325
|
+
if (import_node_fs8.statSync(resolved).isDirectory()) {
|
|
18469
18326
|
return findAgentInDir(resolved);
|
|
18470
18327
|
}
|
|
18471
18328
|
if (!resolved.endsWith(".md")) {
|
|
@@ -18476,11 +18333,11 @@ function resolveAgentFile(pathArg) {
|
|
|
18476
18333
|
return findAgentInDir(process.cwd());
|
|
18477
18334
|
}
|
|
18478
18335
|
function findAgentInDir(dir) {
|
|
18479
|
-
const mdFiles =
|
|
18336
|
+
const mdFiles = import_node_fs8.readdirSync(dir).filter((f) => f.endsWith(".md") && !f.startsWith(".")).map((f) => import_node_path8.join(dir, f));
|
|
18480
18337
|
const agents = [];
|
|
18481
18338
|
for (const file of mdFiles) {
|
|
18482
18339
|
try {
|
|
18483
|
-
const content =
|
|
18340
|
+
const content = import_node_fs8.readFileSync(file, "utf-8");
|
|
18484
18341
|
const { meta, body } = parseAgentFrontmatter(content);
|
|
18485
18342
|
if (meta.name && meta.description && body.trim()) {
|
|
18486
18343
|
agents.push(file);
|
|
@@ -18498,7 +18355,7 @@ function findAgentInDir(dir) {
|
|
|
18498
18355
|
async function agentPush(pathArg, options) {
|
|
18499
18356
|
Wt2(BRAND);
|
|
18500
18357
|
const agentFile = resolveAgentFile(pathArg);
|
|
18501
|
-
const content =
|
|
18358
|
+
const content = import_node_fs8.readFileSync(agentFile, "utf-8");
|
|
18502
18359
|
const { meta, body } = parseAgentFrontmatter(content);
|
|
18503
18360
|
const name = String(meta.name ?? "");
|
|
18504
18361
|
const description = String(meta.description ?? "");
|
|
@@ -18687,7 +18544,7 @@ ${BRAND} ${TEAL}${showing}${RESET}
|
|
|
18687
18544
|
}
|
|
18688
18545
|
}
|
|
18689
18546
|
// cli.ts
|
|
18690
|
-
var VERSION = "0.
|
|
18547
|
+
var VERSION = "0.16.0";
|
|
18691
18548
|
var SUPABASE_URL2 = "https://mjnfqagwuewhgwbtrdgs.supabase.co";
|
|
18692
18549
|
var SUPABASE_ANON_KEY2 = "sb_publishable_T-rk0azNRqAMLLGCyadyhQ_ulk9685n";
|
|
18693
18550
|
var API_BASE6 = process.env.OATHBOUND_API_URL ?? "https://www.oathbound.ai";
|
|
@@ -18708,41 +18565,8 @@ function parseSkillArg(arg) {
|
|
|
18708
18565
|
return null;
|
|
18709
18566
|
return { namespace: arg.slice(0, slash), name, version: vStr };
|
|
18710
18567
|
}
|
|
18711
|
-
function detectPackageManager() {
|
|
18712
|
-
if (import_node_fs8.existsSync(import_node_path8.join(process.cwd(), "bun.lockb")) || import_node_fs8.existsSync(import_node_path8.join(process.cwd(), "bun.lock")))
|
|
18713
|
-
return "bun";
|
|
18714
|
-
if (import_node_fs8.existsSync(import_node_path8.join(process.cwd(), "pnpm-lock.yaml")))
|
|
18715
|
-
return "pnpm";
|
|
18716
|
-
if (import_node_fs8.existsSync(import_node_path8.join(process.cwd(), "yarn.lock")))
|
|
18717
|
-
return "yarn";
|
|
18718
|
-
return "npm";
|
|
18719
|
-
}
|
|
18720
|
-
function installDevDependency() {
|
|
18721
|
-
const pkgPath = import_node_path8.join(process.cwd(), "package.json");
|
|
18722
|
-
if (!import_node_fs8.existsSync(pkgPath))
|
|
18723
|
-
return "no-package-json";
|
|
18724
|
-
try {
|
|
18725
|
-
const pkg = JSON.parse(import_node_fs8.readFileSync(pkgPath, "utf-8"));
|
|
18726
|
-
if (pkg.devDependencies?.oathbound || pkg.dependencies?.oathbound)
|
|
18727
|
-
return "skipped";
|
|
18728
|
-
} catch {}
|
|
18729
|
-
const pm = detectPackageManager();
|
|
18730
|
-
const cmds = {
|
|
18731
|
-
bun: ["bun", ["add", "--dev", "oathbound"]],
|
|
18732
|
-
pnpm: ["pnpm", ["add", "--save-dev", "oathbound"]],
|
|
18733
|
-
yarn: ["yarn", ["add", "--dev", "oathbound"]],
|
|
18734
|
-
npm: ["npm", ["install", "--save-dev", "oathbound"]]
|
|
18735
|
-
};
|
|
18736
|
-
const [bin, args] = cmds[pm];
|
|
18737
|
-
try {
|
|
18738
|
-
import_node_child_process2.execFileSync(bin, args, { stdio: "pipe", cwd: process.cwd() });
|
|
18739
|
-
return "installed";
|
|
18740
|
-
} catch {
|
|
18741
|
-
return "failed";
|
|
18742
|
-
}
|
|
18743
|
-
}
|
|
18744
18568
|
function setup() {
|
|
18745
|
-
if (!
|
|
18569
|
+
if (!import_node_fs9.existsSync(import_node_path9.join(process.cwd(), ".oathbound.jsonc")))
|
|
18746
18570
|
return;
|
|
18747
18571
|
const result = mergeClaudeSettings();
|
|
18748
18572
|
if (result === "malformed") {
|
|
@@ -18751,40 +18575,32 @@ function setup() {
|
|
|
18751
18575
|
process.exit(1);
|
|
18752
18576
|
}
|
|
18753
18577
|
}
|
|
18754
|
-
function
|
|
18755
|
-
const
|
|
18756
|
-
|
|
18757
|
-
|
|
18758
|
-
|
|
18759
|
-
|
|
18760
|
-
pkg = JSON.parse(import_node_fs8.readFileSync(pkgPath, "utf-8"));
|
|
18761
|
-
} catch {
|
|
18762
|
-
return "skipped";
|
|
18763
|
-
}
|
|
18764
|
-
const prepare = pkg.scripts?.prepare ?? "";
|
|
18765
|
-
if (prepare.includes("oathbound setup"))
|
|
18766
|
-
return "skipped";
|
|
18767
|
-
const newPrepare = prepare ? `${prepare} && oathbound setup` : "oathbound setup";
|
|
18768
|
-
pkg.scripts = { ...pkg.scripts ?? {}, prepare: newPrepare };
|
|
18769
|
-
import_node_fs8.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + `
|
|
18578
|
+
function initGlobal() {
|
|
18579
|
+
const home = import_node_os4.homedir();
|
|
18580
|
+
const mergeResult = mergeClaudeSettings(home);
|
|
18581
|
+
switch (mergeResult) {
|
|
18582
|
+
case "created":
|
|
18583
|
+
process.stderr.write(`${GREEN} ✓ Created ~/.claude/settings.json with hooks${RESET}
|
|
18770
18584
|
`);
|
|
18771
|
-
|
|
18772
|
-
|
|
18773
|
-
|
|
18774
|
-
|
|
18775
|
-
|
|
18776
|
-
|
|
18777
|
-
|
|
18778
|
-
|
|
18779
|
-
|
|
18780
|
-
|
|
18781
|
-
|
|
18782
|
-
|
|
18783
|
-
|
|
18784
|
-
|
|
18785
|
-
|
|
18585
|
+
break;
|
|
18586
|
+
case "merged":
|
|
18587
|
+
process.stderr.write(`${GREEN} ✓ Added hooks to ~/.claude/settings.json${RESET}
|
|
18588
|
+
`);
|
|
18589
|
+
break;
|
|
18590
|
+
case "skipped":
|
|
18591
|
+
process.stderr.write(`${DIM} ~/.claude/settings.json already has oathbound hooks — skipped${RESET}
|
|
18592
|
+
`);
|
|
18593
|
+
break;
|
|
18594
|
+
case "malformed":
|
|
18595
|
+
process.stderr.write(`${RED} ✗ ~/.claude/settings.json is malformed JSON — skipped${RESET}
|
|
18596
|
+
`);
|
|
18597
|
+
process.stderr.write(`${RED} Please fix the file manually and re-run oathbound init --global${RESET}
|
|
18598
|
+
`);
|
|
18599
|
+
break;
|
|
18786
18600
|
}
|
|
18787
|
-
|
|
18601
|
+
}
|
|
18602
|
+
async function initLocal() {
|
|
18603
|
+
const level = "warn";
|
|
18788
18604
|
let installResult = installDevDependency();
|
|
18789
18605
|
if (installResult === "no-package-json") {
|
|
18790
18606
|
const shouldCreate = await Rt({
|
|
@@ -18794,8 +18610,8 @@ async function init() {
|
|
|
18794
18610
|
Nt("Please run `npx oathbound init` inside of the folder where you want to run Claude Code. Oathbound currently needs an NPM package in order to run.");
|
|
18795
18611
|
process.exit(1);
|
|
18796
18612
|
}
|
|
18797
|
-
const dirName =
|
|
18798
|
-
|
|
18613
|
+
const dirName = import_node_path9.basename(process.cwd()).toLowerCase().replace(/[^a-z0-9._-]/g, "-").replace(/^[._]+/, "").replace(/-+/g, "-") || "project";
|
|
18614
|
+
import_node_fs9.writeFileSync(import_node_path9.join(process.cwd(), "package.json"), JSON.stringify({
|
|
18799
18615
|
name: dirName,
|
|
18800
18616
|
private: true,
|
|
18801
18617
|
scripts: { prepare: "oathbound setup" }
|
|
@@ -18857,9 +18673,20 @@ async function init() {
|
|
|
18857
18673
|
`);
|
|
18858
18674
|
break;
|
|
18859
18675
|
}
|
|
18676
|
+
}
|
|
18677
|
+
async function init(options = {}) {
|
|
18678
|
+
Wt2(BRAND);
|
|
18679
|
+
if (options.global && !options.local) {
|
|
18680
|
+
initGlobal();
|
|
18681
|
+
} else if (options.local && !options.global) {
|
|
18682
|
+
await initLocal();
|
|
18683
|
+
} else {
|
|
18684
|
+
initGlobal();
|
|
18685
|
+
await initLocal();
|
|
18686
|
+
}
|
|
18860
18687
|
Gt(`\uD83C\uDF89 Oath Bound set up complete!`);
|
|
18861
18688
|
}
|
|
18862
|
-
async function pull(skillArg) {
|
|
18689
|
+
async function pull(skillArg, options = {}) {
|
|
18863
18690
|
const parsed = parseSkillArg(skillArg);
|
|
18864
18691
|
if (!parsed)
|
|
18865
18692
|
usage();
|
|
@@ -18887,7 +18714,7 @@ ${BRAND} ${TEAL}↓ Pulling ${fullName}${version3 ? `@${version3}` : ""}...${RES
|
|
|
18887
18714
|
fail("Download failed", downloadError?.message ?? "Unknown storage error");
|
|
18888
18715
|
}
|
|
18889
18716
|
const buffer = Buffer.from(await blob.arrayBuffer());
|
|
18890
|
-
const tarFile =
|
|
18717
|
+
const tarFile = import_node_path9.join(import_node_os4.tmpdir(), `oathbound-${name}-${Date.now()}.tar.gz`);
|
|
18891
18718
|
const verifySpinner = spinner("Verifying...");
|
|
18892
18719
|
const hash = import_node_crypto2.createHash("sha256").update(buffer).digest("hex");
|
|
18893
18720
|
verifySpinner.stop();
|
|
@@ -18896,21 +18723,30 @@ ${BRAND} ${TEAL}↓ Pulling ${fullName}${version3 ? `@${version3}` : ""}...${RES
|
|
|
18896
18723
|
console.log(`${RED} expected: ${skill.tar_hash}${RESET}`);
|
|
18897
18724
|
fail("Verification failed", `Downloaded file does not match expected hash for ${fullName}`);
|
|
18898
18725
|
}
|
|
18899
|
-
let skillsDir
|
|
18900
|
-
if (
|
|
18901
|
-
skillsDir =
|
|
18902
|
-
|
|
18903
|
-
|
|
18726
|
+
let skillsDir;
|
|
18727
|
+
if (options.global) {
|
|
18728
|
+
skillsDir = import_node_path9.join(import_node_os4.homedir(), ".claude", "skills");
|
|
18729
|
+
import_node_fs9.mkdirSync(skillsDir, { recursive: true });
|
|
18730
|
+
} else {
|
|
18731
|
+
const dirs = findSkillsDirs();
|
|
18732
|
+
const localEntry = dirs.find((d) => d.source === "local");
|
|
18733
|
+
if (localEntry) {
|
|
18734
|
+
skillsDir = localEntry.path;
|
|
18735
|
+
} else {
|
|
18736
|
+
skillsDir = import_node_path9.join(process.cwd(), ".claude", "skills");
|
|
18737
|
+
import_node_fs9.mkdirSync(skillsDir, { recursive: true });
|
|
18738
|
+
console.log(`${DIM} Created ${skillsDir}${RESET}`);
|
|
18739
|
+
}
|
|
18904
18740
|
}
|
|
18905
|
-
|
|
18741
|
+
import_node_fs9.writeFileSync(tarFile, buffer);
|
|
18906
18742
|
try {
|
|
18907
|
-
|
|
18743
|
+
import_node_child_process3.execFileSync("tar", ["-xf", tarFile, "-C", skillsDir], { stdio: "pipe" });
|
|
18908
18744
|
} catch (e) {
|
|
18909
|
-
|
|
18745
|
+
import_node_fs9.unlinkSync(tarFile);
|
|
18910
18746
|
const msg = e instanceof Error ? e.message : "Unknown error";
|
|
18911
18747
|
fail("Extraction failed", msg);
|
|
18912
18748
|
}
|
|
18913
|
-
|
|
18749
|
+
import_node_fs9.unlinkSync(tarFile);
|
|
18914
18750
|
try {
|
|
18915
18751
|
const trackRes = await fetch(`${API_BASE6}/api/downloads`, {
|
|
18916
18752
|
method: "POST",
|
|
@@ -18924,7 +18760,7 @@ ${BRAND} ${TEAL}↓ Pulling ${fullName}${version3 ? `@${version3}` : ""}...${RES
|
|
|
18924
18760
|
} catch {}
|
|
18925
18761
|
console.log(`${BOLD}${GREEN} ✓ Skill verified${RESET}`);
|
|
18926
18762
|
console.log(`${DIM} ${fullName} v${skill.version}${RESET}`);
|
|
18927
|
-
console.log(`${DIM} → ${
|
|
18763
|
+
console.log(`${DIM} → ${import_node_path9.join(skillsDir, name)}${RESET}`);
|
|
18928
18764
|
}
|
|
18929
18765
|
async function agentPull(agentArg) {
|
|
18930
18766
|
const parsed = parseSkillArg(agentArg);
|
|
@@ -18965,9 +18801,9 @@ ${BRAND} ${TEAL}↓ Pulling agent ${fullName}${version3 ? `@${version3}` : ""}..
|
|
|
18965
18801
|
if (name.includes("/") || name.includes("\\") || name.includes("..")) {
|
|
18966
18802
|
fail("Invalid agent name", `Name "${name}" contains path traversal characters`);
|
|
18967
18803
|
}
|
|
18968
|
-
const agentsDir =
|
|
18969
|
-
|
|
18970
|
-
const targetPath =
|
|
18804
|
+
const agentsDir = import_node_path9.join(process.cwd(), ".claude", "agents");
|
|
18805
|
+
import_node_fs9.mkdirSync(agentsDir, { recursive: true });
|
|
18806
|
+
const targetPath = import_node_path9.join(agentsDir, `${name}.md`);
|
|
18971
18807
|
if (!targetPath.startsWith(agentsDir)) {
|
|
18972
18808
|
fail("Invalid agent name", `Resolved path escapes agents directory`);
|
|
18973
18809
|
}
|
|
@@ -18995,7 +18831,7 @@ ${YELLOW}${BOLD} ⚠ This agent defines MCP servers (external connections):${RES
|
|
|
18995
18831
|
fail("Aborted", "Agent not installed");
|
|
18996
18832
|
}
|
|
18997
18833
|
}
|
|
18998
|
-
|
|
18834
|
+
import_node_fs9.writeFileSync(targetPath, content);
|
|
18999
18835
|
try {
|
|
19000
18836
|
const trackRes = await fetch(`${API_BASE6}/api/downloads`, {
|
|
19001
18837
|
method: "POST",
|
|
@@ -19050,7 +18886,11 @@ if (require.main == module) {
|
|
|
19050
18886
|
}
|
|
19051
18887
|
}
|
|
19052
18888
|
if (subcommand === "init") {
|
|
19053
|
-
|
|
18889
|
+
const initArgs = args.slice(1);
|
|
18890
|
+
await init({
|
|
18891
|
+
global: initArgs.includes("--global"),
|
|
18892
|
+
local: initArgs.includes("--local")
|
|
18893
|
+
}).catch((err) => {
|
|
19054
18894
|
const msg = err instanceof Error ? err.message : "Unknown error";
|
|
19055
18895
|
fail("Init failed", msg);
|
|
19056
18896
|
});
|
|
@@ -19101,11 +18941,13 @@ if (require.main == module) {
|
|
|
19101
18941
|
});
|
|
19102
18942
|
} else {
|
|
19103
18943
|
const PULL_ALIASES = new Set(["pull", "i", "install"]);
|
|
19104
|
-
const
|
|
18944
|
+
const pullArgs = args.slice(1);
|
|
18945
|
+
const isGlobalPull = pullArgs.includes("--global");
|
|
18946
|
+
const skillArg = pullArgs.find((a) => !a.startsWith("--"));
|
|
19105
18947
|
if (!subcommand || !PULL_ALIASES.has(subcommand) || !skillArg) {
|
|
19106
18948
|
usage();
|
|
19107
18949
|
}
|
|
19108
|
-
await pull(skillArg).catch((err) => {
|
|
18950
|
+
await pull(skillArg, { global: isGlobalPull }).catch((err) => {
|
|
19109
18951
|
const msg = err instanceof Error ? err.message : "Unknown error";
|
|
19110
18952
|
fail("Unexpected error", msg);
|
|
19111
18953
|
});
|