mrvn-cli 0.2.6 → 0.2.9
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 +89 -3
- package/dist/index.d.ts +8 -1
- package/dist/index.js +968 -254
- package/dist/index.js.map +1 -1
- package/dist/marvin-serve.js +637 -46
- package/dist/marvin-serve.js.map +1 -1
- package/dist/marvin.js +968 -254
- package/dist/marvin.js.map +1 -1
- package/package.json +1 -1
package/dist/marvin.js
CHANGED
|
@@ -852,8 +852,8 @@ function cached(getter) {
|
|
|
852
852
|
}
|
|
853
853
|
};
|
|
854
854
|
}
|
|
855
|
-
function nullish(
|
|
856
|
-
return
|
|
855
|
+
function nullish(input4) {
|
|
856
|
+
return input4 === null || input4 === void 0;
|
|
857
857
|
}
|
|
858
858
|
function cleanRegex(source) {
|
|
859
859
|
const start = source.startsWith("^") ? 1 : 0;
|
|
@@ -947,8 +947,8 @@ function randomString(length = 10) {
|
|
|
947
947
|
function esc(str) {
|
|
948
948
|
return JSON.stringify(str);
|
|
949
949
|
}
|
|
950
|
-
function slugify(
|
|
951
|
-
return
|
|
950
|
+
function slugify(input4) {
|
|
951
|
+
return input4.toLowerCase().trim().replace(/[^\w\s-]/g, "").replace(/[\s_-]+/g, "-").replace(/^-+|-+$/g, "");
|
|
952
952
|
}
|
|
953
953
|
var captureStackTrace = "captureStackTrace" in Error ? Error.captureStackTrace : (..._args) => {
|
|
954
954
|
};
|
|
@@ -1330,19 +1330,19 @@ function finalizeIssue(iss, ctx, config2) {
|
|
|
1330
1330
|
}
|
|
1331
1331
|
return full;
|
|
1332
1332
|
}
|
|
1333
|
-
function getSizableOrigin(
|
|
1334
|
-
if (
|
|
1333
|
+
function getSizableOrigin(input4) {
|
|
1334
|
+
if (input4 instanceof Set)
|
|
1335
1335
|
return "set";
|
|
1336
|
-
if (
|
|
1336
|
+
if (input4 instanceof Map)
|
|
1337
1337
|
return "map";
|
|
1338
|
-
if (
|
|
1338
|
+
if (input4 instanceof File)
|
|
1339
1339
|
return "file";
|
|
1340
1340
|
return "unknown";
|
|
1341
1341
|
}
|
|
1342
|
-
function getLengthableOrigin(
|
|
1343
|
-
if (Array.isArray(
|
|
1342
|
+
function getLengthableOrigin(input4) {
|
|
1343
|
+
if (Array.isArray(input4))
|
|
1344
1344
|
return "array";
|
|
1345
|
-
if (typeof
|
|
1345
|
+
if (typeof input4 === "string")
|
|
1346
1346
|
return "string";
|
|
1347
1347
|
return "unknown";
|
|
1348
1348
|
}
|
|
@@ -1368,12 +1368,12 @@ function parsedType(data) {
|
|
|
1368
1368
|
return t;
|
|
1369
1369
|
}
|
|
1370
1370
|
function issue(...args) {
|
|
1371
|
-
const [iss,
|
|
1371
|
+
const [iss, input4, inst] = args;
|
|
1372
1372
|
if (typeof iss === "string") {
|
|
1373
1373
|
return {
|
|
1374
1374
|
message: iss,
|
|
1375
1375
|
code: "custom",
|
|
1376
|
-
input:
|
|
1376
|
+
input: input4,
|
|
1377
1377
|
inst
|
|
1378
1378
|
};
|
|
1379
1379
|
}
|
|
@@ -1912,23 +1912,23 @@ var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat"
|
|
|
1912
1912
|
bag.pattern = integer;
|
|
1913
1913
|
});
|
|
1914
1914
|
inst._zod.check = (payload) => {
|
|
1915
|
-
const
|
|
1915
|
+
const input4 = payload.value;
|
|
1916
1916
|
if (isInt) {
|
|
1917
|
-
if (!Number.isInteger(
|
|
1917
|
+
if (!Number.isInteger(input4)) {
|
|
1918
1918
|
payload.issues.push({
|
|
1919
1919
|
expected: origin,
|
|
1920
1920
|
format: def.format,
|
|
1921
1921
|
code: "invalid_type",
|
|
1922
1922
|
continue: false,
|
|
1923
|
-
input:
|
|
1923
|
+
input: input4,
|
|
1924
1924
|
inst
|
|
1925
1925
|
});
|
|
1926
1926
|
return;
|
|
1927
1927
|
}
|
|
1928
|
-
if (!Number.isSafeInteger(
|
|
1929
|
-
if (
|
|
1928
|
+
if (!Number.isSafeInteger(input4)) {
|
|
1929
|
+
if (input4 > 0) {
|
|
1930
1930
|
payload.issues.push({
|
|
1931
|
-
input:
|
|
1931
|
+
input: input4,
|
|
1932
1932
|
code: "too_big",
|
|
1933
1933
|
maximum: Number.MAX_SAFE_INTEGER,
|
|
1934
1934
|
note: "Integers must be within the safe integer range.",
|
|
@@ -1939,7 +1939,7 @@ var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat"
|
|
|
1939
1939
|
});
|
|
1940
1940
|
} else {
|
|
1941
1941
|
payload.issues.push({
|
|
1942
|
-
input:
|
|
1942
|
+
input: input4,
|
|
1943
1943
|
code: "too_small",
|
|
1944
1944
|
minimum: Number.MIN_SAFE_INTEGER,
|
|
1945
1945
|
note: "Integers must be within the safe integer range.",
|
|
@@ -1952,10 +1952,10 @@ var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat"
|
|
|
1952
1952
|
return;
|
|
1953
1953
|
}
|
|
1954
1954
|
}
|
|
1955
|
-
if (
|
|
1955
|
+
if (input4 < minimum) {
|
|
1956
1956
|
payload.issues.push({
|
|
1957
1957
|
origin: "number",
|
|
1958
|
-
input:
|
|
1958
|
+
input: input4,
|
|
1959
1959
|
code: "too_small",
|
|
1960
1960
|
minimum,
|
|
1961
1961
|
inclusive: true,
|
|
@@ -1963,10 +1963,10 @@ var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat"
|
|
|
1963
1963
|
continue: !def.abort
|
|
1964
1964
|
});
|
|
1965
1965
|
}
|
|
1966
|
-
if (
|
|
1966
|
+
if (input4 > maximum) {
|
|
1967
1967
|
payload.issues.push({
|
|
1968
1968
|
origin: "number",
|
|
1969
|
-
input:
|
|
1969
|
+
input: input4,
|
|
1970
1970
|
code: "too_big",
|
|
1971
1971
|
maximum,
|
|
1972
1972
|
inclusive: true,
|
|
@@ -1986,11 +1986,11 @@ var $ZodCheckBigIntFormat = /* @__PURE__ */ $constructor("$ZodCheckBigIntFormat"
|
|
|
1986
1986
|
bag.maximum = maximum;
|
|
1987
1987
|
});
|
|
1988
1988
|
inst._zod.check = (payload) => {
|
|
1989
|
-
const
|
|
1990
|
-
if (
|
|
1989
|
+
const input4 = payload.value;
|
|
1990
|
+
if (input4 < minimum) {
|
|
1991
1991
|
payload.issues.push({
|
|
1992
1992
|
origin: "bigint",
|
|
1993
|
-
input:
|
|
1993
|
+
input: input4,
|
|
1994
1994
|
code: "too_small",
|
|
1995
1995
|
minimum,
|
|
1996
1996
|
inclusive: true,
|
|
@@ -1998,10 +1998,10 @@ var $ZodCheckBigIntFormat = /* @__PURE__ */ $constructor("$ZodCheckBigIntFormat"
|
|
|
1998
1998
|
continue: !def.abort
|
|
1999
1999
|
});
|
|
2000
2000
|
}
|
|
2001
|
-
if (
|
|
2001
|
+
if (input4 > maximum) {
|
|
2002
2002
|
payload.issues.push({
|
|
2003
2003
|
origin: "bigint",
|
|
2004
|
-
input:
|
|
2004
|
+
input: input4,
|
|
2005
2005
|
code: "too_big",
|
|
2006
2006
|
maximum,
|
|
2007
2007
|
inclusive: true,
|
|
@@ -2024,16 +2024,16 @@ var $ZodCheckMaxSize = /* @__PURE__ */ $constructor("$ZodCheckMaxSize", (inst, d
|
|
|
2024
2024
|
inst2._zod.bag.maximum = def.maximum;
|
|
2025
2025
|
});
|
|
2026
2026
|
inst._zod.check = (payload) => {
|
|
2027
|
-
const
|
|
2028
|
-
const size =
|
|
2027
|
+
const input4 = payload.value;
|
|
2028
|
+
const size = input4.size;
|
|
2029
2029
|
if (size <= def.maximum)
|
|
2030
2030
|
return;
|
|
2031
2031
|
payload.issues.push({
|
|
2032
|
-
origin: getSizableOrigin(
|
|
2032
|
+
origin: getSizableOrigin(input4),
|
|
2033
2033
|
code: "too_big",
|
|
2034
2034
|
maximum: def.maximum,
|
|
2035
2035
|
inclusive: true,
|
|
2036
|
-
input:
|
|
2036
|
+
input: input4,
|
|
2037
2037
|
inst,
|
|
2038
2038
|
continue: !def.abort
|
|
2039
2039
|
});
|
|
@@ -2052,16 +2052,16 @@ var $ZodCheckMinSize = /* @__PURE__ */ $constructor("$ZodCheckMinSize", (inst, d
|
|
|
2052
2052
|
inst2._zod.bag.minimum = def.minimum;
|
|
2053
2053
|
});
|
|
2054
2054
|
inst._zod.check = (payload) => {
|
|
2055
|
-
const
|
|
2056
|
-
const size =
|
|
2055
|
+
const input4 = payload.value;
|
|
2056
|
+
const size = input4.size;
|
|
2057
2057
|
if (size >= def.minimum)
|
|
2058
2058
|
return;
|
|
2059
2059
|
payload.issues.push({
|
|
2060
|
-
origin: getSizableOrigin(
|
|
2060
|
+
origin: getSizableOrigin(input4),
|
|
2061
2061
|
code: "too_small",
|
|
2062
2062
|
minimum: def.minimum,
|
|
2063
2063
|
inclusive: true,
|
|
2064
|
-
input:
|
|
2064
|
+
input: input4,
|
|
2065
2065
|
inst,
|
|
2066
2066
|
continue: !def.abort
|
|
2067
2067
|
});
|
|
@@ -2081,13 +2081,13 @@ var $ZodCheckSizeEquals = /* @__PURE__ */ $constructor("$ZodCheckSizeEquals", (i
|
|
|
2081
2081
|
bag.size = def.size;
|
|
2082
2082
|
});
|
|
2083
2083
|
inst._zod.check = (payload) => {
|
|
2084
|
-
const
|
|
2085
|
-
const size =
|
|
2084
|
+
const input4 = payload.value;
|
|
2085
|
+
const size = input4.size;
|
|
2086
2086
|
if (size === def.size)
|
|
2087
2087
|
return;
|
|
2088
2088
|
const tooBig = size > def.size;
|
|
2089
2089
|
payload.issues.push({
|
|
2090
|
-
origin: getSizableOrigin(
|
|
2090
|
+
origin: getSizableOrigin(input4),
|
|
2091
2091
|
...tooBig ? { code: "too_big", maximum: def.size } : { code: "too_small", minimum: def.size },
|
|
2092
2092
|
inclusive: true,
|
|
2093
2093
|
exact: true,
|
|
@@ -2110,17 +2110,17 @@ var $ZodCheckMaxLength = /* @__PURE__ */ $constructor("$ZodCheckMaxLength", (ins
|
|
|
2110
2110
|
inst2._zod.bag.maximum = def.maximum;
|
|
2111
2111
|
});
|
|
2112
2112
|
inst._zod.check = (payload) => {
|
|
2113
|
-
const
|
|
2114
|
-
const length =
|
|
2113
|
+
const input4 = payload.value;
|
|
2114
|
+
const length = input4.length;
|
|
2115
2115
|
if (length <= def.maximum)
|
|
2116
2116
|
return;
|
|
2117
|
-
const origin = getLengthableOrigin(
|
|
2117
|
+
const origin = getLengthableOrigin(input4);
|
|
2118
2118
|
payload.issues.push({
|
|
2119
2119
|
origin,
|
|
2120
2120
|
code: "too_big",
|
|
2121
2121
|
maximum: def.maximum,
|
|
2122
2122
|
inclusive: true,
|
|
2123
|
-
input:
|
|
2123
|
+
input: input4,
|
|
2124
2124
|
inst,
|
|
2125
2125
|
continue: !def.abort
|
|
2126
2126
|
});
|
|
@@ -2139,17 +2139,17 @@ var $ZodCheckMinLength = /* @__PURE__ */ $constructor("$ZodCheckMinLength", (ins
|
|
|
2139
2139
|
inst2._zod.bag.minimum = def.minimum;
|
|
2140
2140
|
});
|
|
2141
2141
|
inst._zod.check = (payload) => {
|
|
2142
|
-
const
|
|
2143
|
-
const length =
|
|
2142
|
+
const input4 = payload.value;
|
|
2143
|
+
const length = input4.length;
|
|
2144
2144
|
if (length >= def.minimum)
|
|
2145
2145
|
return;
|
|
2146
|
-
const origin = getLengthableOrigin(
|
|
2146
|
+
const origin = getLengthableOrigin(input4);
|
|
2147
2147
|
payload.issues.push({
|
|
2148
2148
|
origin,
|
|
2149
2149
|
code: "too_small",
|
|
2150
2150
|
minimum: def.minimum,
|
|
2151
2151
|
inclusive: true,
|
|
2152
|
-
input:
|
|
2152
|
+
input: input4,
|
|
2153
2153
|
inst,
|
|
2154
2154
|
continue: !def.abort
|
|
2155
2155
|
});
|
|
@@ -2169,11 +2169,11 @@ var $ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEquals"
|
|
|
2169
2169
|
bag.length = def.length;
|
|
2170
2170
|
});
|
|
2171
2171
|
inst._zod.check = (payload) => {
|
|
2172
|
-
const
|
|
2173
|
-
const length =
|
|
2172
|
+
const input4 = payload.value;
|
|
2173
|
+
const length = input4.length;
|
|
2174
2174
|
if (length === def.length)
|
|
2175
2175
|
return;
|
|
2176
|
-
const origin = getLengthableOrigin(
|
|
2176
|
+
const origin = getLengthableOrigin(input4);
|
|
2177
2177
|
const tooBig = length > def.length;
|
|
2178
2178
|
payload.issues.push({
|
|
2179
2179
|
origin,
|
|
@@ -2827,15 +2827,15 @@ var $ZodNumber = /* @__PURE__ */ $constructor("$ZodNumber", (inst, def) => {
|
|
|
2827
2827
|
payload.value = Number(payload.value);
|
|
2828
2828
|
} catch (_) {
|
|
2829
2829
|
}
|
|
2830
|
-
const
|
|
2831
|
-
if (typeof
|
|
2830
|
+
const input4 = payload.value;
|
|
2831
|
+
if (typeof input4 === "number" && !Number.isNaN(input4) && Number.isFinite(input4)) {
|
|
2832
2832
|
return payload;
|
|
2833
2833
|
}
|
|
2834
|
-
const received = typeof
|
|
2834
|
+
const received = typeof input4 === "number" ? Number.isNaN(input4) ? "NaN" : !Number.isFinite(input4) ? "Infinity" : void 0 : void 0;
|
|
2835
2835
|
payload.issues.push({
|
|
2836
2836
|
expected: "number",
|
|
2837
2837
|
code: "invalid_type",
|
|
2838
|
-
input:
|
|
2838
|
+
input: input4,
|
|
2839
2839
|
inst,
|
|
2840
2840
|
...received ? { received } : {}
|
|
2841
2841
|
});
|
|
@@ -2855,13 +2855,13 @@ var $ZodBoolean = /* @__PURE__ */ $constructor("$ZodBoolean", (inst, def) => {
|
|
|
2855
2855
|
payload.value = Boolean(payload.value);
|
|
2856
2856
|
} catch (_) {
|
|
2857
2857
|
}
|
|
2858
|
-
const
|
|
2859
|
-
if (typeof
|
|
2858
|
+
const input4 = payload.value;
|
|
2859
|
+
if (typeof input4 === "boolean")
|
|
2860
2860
|
return payload;
|
|
2861
2861
|
payload.issues.push({
|
|
2862
2862
|
expected: "boolean",
|
|
2863
2863
|
code: "invalid_type",
|
|
2864
|
-
input:
|
|
2864
|
+
input: input4,
|
|
2865
2865
|
inst
|
|
2866
2866
|
});
|
|
2867
2867
|
return payload;
|
|
@@ -2894,13 +2894,13 @@ var $ZodBigIntFormat = /* @__PURE__ */ $constructor("$ZodBigIntFormat", (inst, d
|
|
|
2894
2894
|
var $ZodSymbol = /* @__PURE__ */ $constructor("$ZodSymbol", (inst, def) => {
|
|
2895
2895
|
$ZodType.init(inst, def);
|
|
2896
2896
|
inst._zod.parse = (payload, _ctx) => {
|
|
2897
|
-
const
|
|
2898
|
-
if (typeof
|
|
2897
|
+
const input4 = payload.value;
|
|
2898
|
+
if (typeof input4 === "symbol")
|
|
2899
2899
|
return payload;
|
|
2900
2900
|
payload.issues.push({
|
|
2901
2901
|
expected: "symbol",
|
|
2902
2902
|
code: "invalid_type",
|
|
2903
|
-
input:
|
|
2903
|
+
input: input4,
|
|
2904
2904
|
inst
|
|
2905
2905
|
});
|
|
2906
2906
|
return payload;
|
|
@@ -2913,13 +2913,13 @@ var $ZodUndefined = /* @__PURE__ */ $constructor("$ZodUndefined", (inst, def) =>
|
|
|
2913
2913
|
inst._zod.optin = "optional";
|
|
2914
2914
|
inst._zod.optout = "optional";
|
|
2915
2915
|
inst._zod.parse = (payload, _ctx) => {
|
|
2916
|
-
const
|
|
2917
|
-
if (typeof
|
|
2916
|
+
const input4 = payload.value;
|
|
2917
|
+
if (typeof input4 === "undefined")
|
|
2918
2918
|
return payload;
|
|
2919
2919
|
payload.issues.push({
|
|
2920
2920
|
expected: "undefined",
|
|
2921
2921
|
code: "invalid_type",
|
|
2922
|
-
input:
|
|
2922
|
+
input: input4,
|
|
2923
2923
|
inst
|
|
2924
2924
|
});
|
|
2925
2925
|
return payload;
|
|
@@ -2930,13 +2930,13 @@ var $ZodNull = /* @__PURE__ */ $constructor("$ZodNull", (inst, def) => {
|
|
|
2930
2930
|
inst._zod.pattern = _null;
|
|
2931
2931
|
inst._zod.values = /* @__PURE__ */ new Set([null]);
|
|
2932
2932
|
inst._zod.parse = (payload, _ctx) => {
|
|
2933
|
-
const
|
|
2934
|
-
if (
|
|
2933
|
+
const input4 = payload.value;
|
|
2934
|
+
if (input4 === null)
|
|
2935
2935
|
return payload;
|
|
2936
2936
|
payload.issues.push({
|
|
2937
2937
|
expected: "null",
|
|
2938
2938
|
code: "invalid_type",
|
|
2939
|
-
input:
|
|
2939
|
+
input: input4,
|
|
2940
2940
|
inst
|
|
2941
2941
|
});
|
|
2942
2942
|
return payload;
|
|
@@ -2965,13 +2965,13 @@ var $ZodNever = /* @__PURE__ */ $constructor("$ZodNever", (inst, def) => {
|
|
|
2965
2965
|
var $ZodVoid = /* @__PURE__ */ $constructor("$ZodVoid", (inst, def) => {
|
|
2966
2966
|
$ZodType.init(inst, def);
|
|
2967
2967
|
inst._zod.parse = (payload, _ctx) => {
|
|
2968
|
-
const
|
|
2969
|
-
if (typeof
|
|
2968
|
+
const input4 = payload.value;
|
|
2969
|
+
if (typeof input4 === "undefined")
|
|
2970
2970
|
return payload;
|
|
2971
2971
|
payload.issues.push({
|
|
2972
2972
|
expected: "void",
|
|
2973
2973
|
code: "invalid_type",
|
|
2974
|
-
input:
|
|
2974
|
+
input: input4,
|
|
2975
2975
|
inst
|
|
2976
2976
|
});
|
|
2977
2977
|
return payload;
|
|
@@ -2986,15 +2986,15 @@ var $ZodDate = /* @__PURE__ */ $constructor("$ZodDate", (inst, def) => {
|
|
|
2986
2986
|
} catch (_err) {
|
|
2987
2987
|
}
|
|
2988
2988
|
}
|
|
2989
|
-
const
|
|
2990
|
-
const isDate =
|
|
2991
|
-
const isValidDate = isDate && !Number.isNaN(
|
|
2989
|
+
const input4 = payload.value;
|
|
2990
|
+
const isDate = input4 instanceof Date;
|
|
2991
|
+
const isValidDate = isDate && !Number.isNaN(input4.getTime());
|
|
2992
2992
|
if (isValidDate)
|
|
2993
2993
|
return payload;
|
|
2994
2994
|
payload.issues.push({
|
|
2995
2995
|
expected: "date",
|
|
2996
2996
|
code: "invalid_type",
|
|
2997
|
-
input:
|
|
2997
|
+
input: input4,
|
|
2998
2998
|
...isDate ? { received: "Invalid Date" } : {},
|
|
2999
2999
|
inst
|
|
3000
3000
|
});
|
|
@@ -3010,20 +3010,20 @@ function handleArrayResult(result, final, index) {
|
|
|
3010
3010
|
var $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
|
|
3011
3011
|
$ZodType.init(inst, def);
|
|
3012
3012
|
inst._zod.parse = (payload, ctx) => {
|
|
3013
|
-
const
|
|
3014
|
-
if (!Array.isArray(
|
|
3013
|
+
const input4 = payload.value;
|
|
3014
|
+
if (!Array.isArray(input4)) {
|
|
3015
3015
|
payload.issues.push({
|
|
3016
3016
|
expected: "array",
|
|
3017
3017
|
code: "invalid_type",
|
|
3018
|
-
input:
|
|
3018
|
+
input: input4,
|
|
3019
3019
|
inst
|
|
3020
3020
|
});
|
|
3021
3021
|
return payload;
|
|
3022
3022
|
}
|
|
3023
|
-
payload.value = Array(
|
|
3023
|
+
payload.value = Array(input4.length);
|
|
3024
3024
|
const proms = [];
|
|
3025
|
-
for (let i = 0; i <
|
|
3026
|
-
const item =
|
|
3025
|
+
for (let i = 0; i < input4.length; i++) {
|
|
3026
|
+
const item = input4[i];
|
|
3027
3027
|
const result = def.element._zod.run({
|
|
3028
3028
|
value: item,
|
|
3029
3029
|
issues: []
|
|
@@ -3040,15 +3040,15 @@ var $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
|
|
|
3040
3040
|
return payload;
|
|
3041
3041
|
};
|
|
3042
3042
|
});
|
|
3043
|
-
function handlePropertyResult(result, final, key,
|
|
3043
|
+
function handlePropertyResult(result, final, key, input4, isOptionalOut) {
|
|
3044
3044
|
if (result.issues.length) {
|
|
3045
|
-
if (isOptionalOut && !(key in
|
|
3045
|
+
if (isOptionalOut && !(key in input4)) {
|
|
3046
3046
|
return;
|
|
3047
3047
|
}
|
|
3048
3048
|
final.issues.push(...prefixIssues(key, result.issues));
|
|
3049
3049
|
}
|
|
3050
3050
|
if (result.value === void 0) {
|
|
3051
|
-
if (key in
|
|
3051
|
+
if (key in input4) {
|
|
3052
3052
|
final.value[key] = void 0;
|
|
3053
3053
|
}
|
|
3054
3054
|
} else {
|
|
@@ -3071,31 +3071,31 @@ function normalizeDef(def) {
|
|
|
3071
3071
|
optionalKeys: new Set(okeys)
|
|
3072
3072
|
};
|
|
3073
3073
|
}
|
|
3074
|
-
function handleCatchall(proms,
|
|
3074
|
+
function handleCatchall(proms, input4, payload, ctx, def, inst) {
|
|
3075
3075
|
const unrecognized = [];
|
|
3076
3076
|
const keySet = def.keySet;
|
|
3077
3077
|
const _catchall = def.catchall._zod;
|
|
3078
3078
|
const t = _catchall.def.type;
|
|
3079
3079
|
const isOptionalOut = _catchall.optout === "optional";
|
|
3080
|
-
for (const key in
|
|
3080
|
+
for (const key in input4) {
|
|
3081
3081
|
if (keySet.has(key))
|
|
3082
3082
|
continue;
|
|
3083
3083
|
if (t === "never") {
|
|
3084
3084
|
unrecognized.push(key);
|
|
3085
3085
|
continue;
|
|
3086
3086
|
}
|
|
3087
|
-
const r = _catchall.run({ value:
|
|
3087
|
+
const r = _catchall.run({ value: input4[key], issues: [] }, ctx);
|
|
3088
3088
|
if (r instanceof Promise) {
|
|
3089
|
-
proms.push(r.then((r2) => handlePropertyResult(r2, payload, key,
|
|
3089
|
+
proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input4, isOptionalOut)));
|
|
3090
3090
|
} else {
|
|
3091
|
-
handlePropertyResult(r, payload, key,
|
|
3091
|
+
handlePropertyResult(r, payload, key, input4, isOptionalOut);
|
|
3092
3092
|
}
|
|
3093
3093
|
}
|
|
3094
3094
|
if (unrecognized.length) {
|
|
3095
3095
|
payload.issues.push({
|
|
3096
3096
|
code: "unrecognized_keys",
|
|
3097
3097
|
keys: unrecognized,
|
|
3098
|
-
input:
|
|
3098
|
+
input: input4,
|
|
3099
3099
|
inst
|
|
3100
3100
|
});
|
|
3101
3101
|
}
|
|
@@ -3139,12 +3139,12 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
|
3139
3139
|
let value;
|
|
3140
3140
|
inst._zod.parse = (payload, ctx) => {
|
|
3141
3141
|
value ?? (value = _normalized.value);
|
|
3142
|
-
const
|
|
3143
|
-
if (!isObject2(
|
|
3142
|
+
const input4 = payload.value;
|
|
3143
|
+
if (!isObject2(input4)) {
|
|
3144
3144
|
payload.issues.push({
|
|
3145
3145
|
expected: "object",
|
|
3146
3146
|
code: "invalid_type",
|
|
3147
|
-
input:
|
|
3147
|
+
input: input4,
|
|
3148
3148
|
inst
|
|
3149
3149
|
});
|
|
3150
3150
|
return payload;
|
|
@@ -3155,17 +3155,17 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
|
3155
3155
|
for (const key of value.keys) {
|
|
3156
3156
|
const el = shape[key];
|
|
3157
3157
|
const isOptionalOut = el._zod.optout === "optional";
|
|
3158
|
-
const r = el._zod.run({ value:
|
|
3158
|
+
const r = el._zod.run({ value: input4[key], issues: [] }, ctx);
|
|
3159
3159
|
if (r instanceof Promise) {
|
|
3160
|
-
proms.push(r.then((r2) => handlePropertyResult(r2, payload, key,
|
|
3160
|
+
proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input4, isOptionalOut)));
|
|
3161
3161
|
} else {
|
|
3162
|
-
handlePropertyResult(r, payload, key,
|
|
3162
|
+
handlePropertyResult(r, payload, key, input4, isOptionalOut);
|
|
3163
3163
|
}
|
|
3164
3164
|
}
|
|
3165
3165
|
if (!catchall) {
|
|
3166
3166
|
return proms.length ? Promise.all(proms).then(() => payload) : payload;
|
|
3167
3167
|
}
|
|
3168
|
-
return handleCatchall(proms,
|
|
3168
|
+
return handleCatchall(proms, input4, payload, ctx, _normalized.value, inst);
|
|
3169
3169
|
};
|
|
3170
3170
|
});
|
|
3171
3171
|
var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) => {
|
|
@@ -3246,12 +3246,12 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
3246
3246
|
let value;
|
|
3247
3247
|
inst._zod.parse = (payload, ctx) => {
|
|
3248
3248
|
value ?? (value = _normalized.value);
|
|
3249
|
-
const
|
|
3250
|
-
if (!isObject2(
|
|
3249
|
+
const input4 = payload.value;
|
|
3250
|
+
if (!isObject2(input4)) {
|
|
3251
3251
|
payload.issues.push({
|
|
3252
3252
|
expected: "object",
|
|
3253
3253
|
code: "invalid_type",
|
|
3254
|
-
input:
|
|
3254
|
+
input: input4,
|
|
3255
3255
|
inst
|
|
3256
3256
|
});
|
|
3257
3257
|
return payload;
|
|
@@ -3262,7 +3262,7 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
3262
3262
|
payload = fastpass(payload, ctx);
|
|
3263
3263
|
if (!catchall)
|
|
3264
3264
|
return payload;
|
|
3265
|
-
return handleCatchall([],
|
|
3265
|
+
return handleCatchall([], input4, payload, ctx, value, inst);
|
|
3266
3266
|
}
|
|
3267
3267
|
return superParse(payload, ctx);
|
|
3268
3268
|
};
|
|
@@ -3424,17 +3424,17 @@ var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnio
|
|
|
3424
3424
|
return map2;
|
|
3425
3425
|
});
|
|
3426
3426
|
inst._zod.parse = (payload, ctx) => {
|
|
3427
|
-
const
|
|
3428
|
-
if (!isObject(
|
|
3427
|
+
const input4 = payload.value;
|
|
3428
|
+
if (!isObject(input4)) {
|
|
3429
3429
|
payload.issues.push({
|
|
3430
3430
|
code: "invalid_type",
|
|
3431
3431
|
expected: "object",
|
|
3432
|
-
input:
|
|
3432
|
+
input: input4,
|
|
3433
3433
|
inst
|
|
3434
3434
|
});
|
|
3435
3435
|
return payload;
|
|
3436
3436
|
}
|
|
3437
|
-
const opt = disc.value.get(
|
|
3437
|
+
const opt = disc.value.get(input4?.[def.discriminator]);
|
|
3438
3438
|
if (opt) {
|
|
3439
3439
|
return opt._zod.run(payload, ctx);
|
|
3440
3440
|
}
|
|
@@ -3446,7 +3446,7 @@ var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnio
|
|
|
3446
3446
|
errors: [],
|
|
3447
3447
|
note: "No matching discriminator",
|
|
3448
3448
|
discriminator: def.discriminator,
|
|
3449
|
-
input:
|
|
3449
|
+
input: input4,
|
|
3450
3450
|
path: [def.discriminator],
|
|
3451
3451
|
inst
|
|
3452
3452
|
});
|
|
@@ -3456,9 +3456,9 @@ var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnio
|
|
|
3456
3456
|
var $ZodIntersection = /* @__PURE__ */ $constructor("$ZodIntersection", (inst, def) => {
|
|
3457
3457
|
$ZodType.init(inst, def);
|
|
3458
3458
|
inst._zod.parse = (payload, ctx) => {
|
|
3459
|
-
const
|
|
3460
|
-
const left = def.left._zod.run({ value:
|
|
3461
|
-
const right = def.right._zod.run({ value:
|
|
3459
|
+
const input4 = payload.value;
|
|
3460
|
+
const left = def.left._zod.run({ value: input4, issues: [] }, ctx);
|
|
3461
|
+
const right = def.right._zod.run({ value: input4, issues: [] }, ctx);
|
|
3462
3462
|
const async = left instanceof Promise || right instanceof Promise;
|
|
3463
3463
|
if (async) {
|
|
3464
3464
|
return Promise.all([left, right]).then(([left2, right2]) => {
|
|
@@ -3555,10 +3555,10 @@ var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
|
|
|
3555
3555
|
$ZodType.init(inst, def);
|
|
3556
3556
|
const items = def.items;
|
|
3557
3557
|
inst._zod.parse = (payload, ctx) => {
|
|
3558
|
-
const
|
|
3559
|
-
if (!Array.isArray(
|
|
3558
|
+
const input4 = payload.value;
|
|
3559
|
+
if (!Array.isArray(input4)) {
|
|
3560
3560
|
payload.issues.push({
|
|
3561
|
-
input:
|
|
3561
|
+
input: input4,
|
|
3562
3562
|
inst,
|
|
3563
3563
|
expected: "tuple",
|
|
3564
3564
|
code: "invalid_type"
|
|
@@ -3570,12 +3570,12 @@ var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
|
|
|
3570
3570
|
const reversedIndex = [...items].reverse().findIndex((item) => item._zod.optin !== "optional");
|
|
3571
3571
|
const optStart = reversedIndex === -1 ? 0 : items.length - reversedIndex;
|
|
3572
3572
|
if (!def.rest) {
|
|
3573
|
-
const tooBig =
|
|
3574
|
-
const tooSmall =
|
|
3573
|
+
const tooBig = input4.length > items.length;
|
|
3574
|
+
const tooSmall = input4.length < optStart - 1;
|
|
3575
3575
|
if (tooBig || tooSmall) {
|
|
3576
3576
|
payload.issues.push({
|
|
3577
3577
|
...tooBig ? { code: "too_big", maximum: items.length, inclusive: true } : { code: "too_small", minimum: items.length },
|
|
3578
|
-
input:
|
|
3578
|
+
input: input4,
|
|
3579
3579
|
inst,
|
|
3580
3580
|
origin: "array"
|
|
3581
3581
|
});
|
|
@@ -3585,12 +3585,12 @@ var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
|
|
|
3585
3585
|
let i = -1;
|
|
3586
3586
|
for (const item of items) {
|
|
3587
3587
|
i++;
|
|
3588
|
-
if (i >=
|
|
3588
|
+
if (i >= input4.length) {
|
|
3589
3589
|
if (i >= optStart)
|
|
3590
3590
|
continue;
|
|
3591
3591
|
}
|
|
3592
3592
|
const result = item._zod.run({
|
|
3593
|
-
value:
|
|
3593
|
+
value: input4[i],
|
|
3594
3594
|
issues: []
|
|
3595
3595
|
}, ctx);
|
|
3596
3596
|
if (result instanceof Promise) {
|
|
@@ -3600,7 +3600,7 @@ var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
|
|
|
3600
3600
|
}
|
|
3601
3601
|
}
|
|
3602
3602
|
if (def.rest) {
|
|
3603
|
-
const rest =
|
|
3603
|
+
const rest = input4.slice(items.length);
|
|
3604
3604
|
for (const el of rest) {
|
|
3605
3605
|
i++;
|
|
3606
3606
|
const result = def.rest._zod.run({
|
|
@@ -3628,12 +3628,12 @@ function handleTupleResult(result, final, index) {
|
|
|
3628
3628
|
var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
3629
3629
|
$ZodType.init(inst, def);
|
|
3630
3630
|
inst._zod.parse = (payload, ctx) => {
|
|
3631
|
-
const
|
|
3632
|
-
if (!isPlainObject(
|
|
3631
|
+
const input4 = payload.value;
|
|
3632
|
+
if (!isPlainObject(input4)) {
|
|
3633
3633
|
payload.issues.push({
|
|
3634
3634
|
expected: "record",
|
|
3635
3635
|
code: "invalid_type",
|
|
3636
|
-
input:
|
|
3636
|
+
input: input4,
|
|
3637
3637
|
inst
|
|
3638
3638
|
});
|
|
3639
3639
|
return payload;
|
|
@@ -3646,7 +3646,7 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
3646
3646
|
for (const key of values) {
|
|
3647
3647
|
if (typeof key === "string" || typeof key === "number" || typeof key === "symbol") {
|
|
3648
3648
|
recordKeys.add(typeof key === "number" ? key.toString() : key);
|
|
3649
|
-
const result = def.valueType._zod.run({ value:
|
|
3649
|
+
const result = def.valueType._zod.run({ value: input4[key], issues: [] }, ctx);
|
|
3650
3650
|
if (result instanceof Promise) {
|
|
3651
3651
|
proms.push(result.then((result2) => {
|
|
3652
3652
|
if (result2.issues.length) {
|
|
@@ -3663,7 +3663,7 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
3663
3663
|
}
|
|
3664
3664
|
}
|
|
3665
3665
|
let unrecognized;
|
|
3666
|
-
for (const key in
|
|
3666
|
+
for (const key in input4) {
|
|
3667
3667
|
if (!recordKeys.has(key)) {
|
|
3668
3668
|
unrecognized = unrecognized ?? [];
|
|
3669
3669
|
unrecognized.push(key);
|
|
@@ -3672,14 +3672,14 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
3672
3672
|
if (unrecognized && unrecognized.length > 0) {
|
|
3673
3673
|
payload.issues.push({
|
|
3674
3674
|
code: "unrecognized_keys",
|
|
3675
|
-
input:
|
|
3675
|
+
input: input4,
|
|
3676
3676
|
inst,
|
|
3677
3677
|
keys: unrecognized
|
|
3678
3678
|
});
|
|
3679
3679
|
}
|
|
3680
3680
|
} else {
|
|
3681
3681
|
payload.value = {};
|
|
3682
|
-
for (const key of Reflect.ownKeys(
|
|
3682
|
+
for (const key of Reflect.ownKeys(input4)) {
|
|
3683
3683
|
if (key === "__proto__")
|
|
3684
3684
|
continue;
|
|
3685
3685
|
let keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
|
|
@@ -3698,7 +3698,7 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
3698
3698
|
}
|
|
3699
3699
|
if (keyResult.issues.length) {
|
|
3700
3700
|
if (def.mode === "loose") {
|
|
3701
|
-
payload.value[key] =
|
|
3701
|
+
payload.value[key] = input4[key];
|
|
3702
3702
|
} else {
|
|
3703
3703
|
payload.issues.push({
|
|
3704
3704
|
code: "invalid_key",
|
|
@@ -3711,7 +3711,7 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
3711
3711
|
}
|
|
3712
3712
|
continue;
|
|
3713
3713
|
}
|
|
3714
|
-
const result = def.valueType._zod.run({ value:
|
|
3714
|
+
const result = def.valueType._zod.run({ value: input4[key], issues: [] }, ctx);
|
|
3715
3715
|
if (result instanceof Promise) {
|
|
3716
3716
|
proms.push(result.then((result2) => {
|
|
3717
3717
|
if (result2.issues.length) {
|
|
@@ -3736,27 +3736,27 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
3736
3736
|
var $ZodMap = /* @__PURE__ */ $constructor("$ZodMap", (inst, def) => {
|
|
3737
3737
|
$ZodType.init(inst, def);
|
|
3738
3738
|
inst._zod.parse = (payload, ctx) => {
|
|
3739
|
-
const
|
|
3740
|
-
if (!(
|
|
3739
|
+
const input4 = payload.value;
|
|
3740
|
+
if (!(input4 instanceof Map)) {
|
|
3741
3741
|
payload.issues.push({
|
|
3742
3742
|
expected: "map",
|
|
3743
3743
|
code: "invalid_type",
|
|
3744
|
-
input:
|
|
3744
|
+
input: input4,
|
|
3745
3745
|
inst
|
|
3746
3746
|
});
|
|
3747
3747
|
return payload;
|
|
3748
3748
|
}
|
|
3749
3749
|
const proms = [];
|
|
3750
3750
|
payload.value = /* @__PURE__ */ new Map();
|
|
3751
|
-
for (const [key, value] of
|
|
3751
|
+
for (const [key, value] of input4) {
|
|
3752
3752
|
const keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
|
|
3753
3753
|
const valueResult = def.valueType._zod.run({ value, issues: [] }, ctx);
|
|
3754
3754
|
if (keyResult instanceof Promise || valueResult instanceof Promise) {
|
|
3755
3755
|
proms.push(Promise.all([keyResult, valueResult]).then(([keyResult2, valueResult2]) => {
|
|
3756
|
-
handleMapResult(keyResult2, valueResult2, payload, key,
|
|
3756
|
+
handleMapResult(keyResult2, valueResult2, payload, key, input4, inst, ctx);
|
|
3757
3757
|
}));
|
|
3758
3758
|
} else {
|
|
3759
|
-
handleMapResult(keyResult, valueResult, payload, key,
|
|
3759
|
+
handleMapResult(keyResult, valueResult, payload, key, input4, inst, ctx);
|
|
3760
3760
|
}
|
|
3761
3761
|
}
|
|
3762
3762
|
if (proms.length)
|
|
@@ -3764,7 +3764,7 @@ var $ZodMap = /* @__PURE__ */ $constructor("$ZodMap", (inst, def) => {
|
|
|
3764
3764
|
return payload;
|
|
3765
3765
|
};
|
|
3766
3766
|
});
|
|
3767
|
-
function handleMapResult(keyResult, valueResult, final, key,
|
|
3767
|
+
function handleMapResult(keyResult, valueResult, final, key, input4, inst, ctx) {
|
|
3768
3768
|
if (keyResult.issues.length) {
|
|
3769
3769
|
if (propertyKeyTypes.has(typeof key)) {
|
|
3770
3770
|
final.issues.push(...prefixIssues(key, keyResult.issues));
|
|
@@ -3772,7 +3772,7 @@ function handleMapResult(keyResult, valueResult, final, key, input3, inst, ctx)
|
|
|
3772
3772
|
final.issues.push({
|
|
3773
3773
|
code: "invalid_key",
|
|
3774
3774
|
origin: "map",
|
|
3775
|
-
input:
|
|
3775
|
+
input: input4,
|
|
3776
3776
|
inst,
|
|
3777
3777
|
issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config()))
|
|
3778
3778
|
});
|
|
@@ -3785,7 +3785,7 @@ function handleMapResult(keyResult, valueResult, final, key, input3, inst, ctx)
|
|
|
3785
3785
|
final.issues.push({
|
|
3786
3786
|
origin: "map",
|
|
3787
3787
|
code: "invalid_element",
|
|
3788
|
-
input:
|
|
3788
|
+
input: input4,
|
|
3789
3789
|
inst,
|
|
3790
3790
|
key,
|
|
3791
3791
|
issues: valueResult.issues.map((iss) => finalizeIssue(iss, ctx, config()))
|
|
@@ -3797,10 +3797,10 @@ function handleMapResult(keyResult, valueResult, final, key, input3, inst, ctx)
|
|
|
3797
3797
|
var $ZodSet = /* @__PURE__ */ $constructor("$ZodSet", (inst, def) => {
|
|
3798
3798
|
$ZodType.init(inst, def);
|
|
3799
3799
|
inst._zod.parse = (payload, ctx) => {
|
|
3800
|
-
const
|
|
3801
|
-
if (!(
|
|
3800
|
+
const input4 = payload.value;
|
|
3801
|
+
if (!(input4 instanceof Set)) {
|
|
3802
3802
|
payload.issues.push({
|
|
3803
|
-
input:
|
|
3803
|
+
input: input4,
|
|
3804
3804
|
inst,
|
|
3805
3805
|
expected: "set",
|
|
3806
3806
|
code: "invalid_type"
|
|
@@ -3809,7 +3809,7 @@ var $ZodSet = /* @__PURE__ */ $constructor("$ZodSet", (inst, def) => {
|
|
|
3809
3809
|
}
|
|
3810
3810
|
const proms = [];
|
|
3811
3811
|
payload.value = /* @__PURE__ */ new Set();
|
|
3812
|
-
for (const item of
|
|
3812
|
+
for (const item of input4) {
|
|
3813
3813
|
const result = def.valueType._zod.run({ value: item, issues: [] }, ctx);
|
|
3814
3814
|
if (result instanceof Promise) {
|
|
3815
3815
|
proms.push(result.then((result2) => handleSetResult(result2, payload)));
|
|
@@ -3834,14 +3834,14 @@ var $ZodEnum = /* @__PURE__ */ $constructor("$ZodEnum", (inst, def) => {
|
|
|
3834
3834
|
inst._zod.values = valuesSet;
|
|
3835
3835
|
inst._zod.pattern = new RegExp(`^(${values.filter((k) => propertyKeyTypes.has(typeof k)).map((o) => typeof o === "string" ? escapeRegex(o) : o.toString()).join("|")})$`);
|
|
3836
3836
|
inst._zod.parse = (payload, _ctx) => {
|
|
3837
|
-
const
|
|
3838
|
-
if (valuesSet.has(
|
|
3837
|
+
const input4 = payload.value;
|
|
3838
|
+
if (valuesSet.has(input4)) {
|
|
3839
3839
|
return payload;
|
|
3840
3840
|
}
|
|
3841
3841
|
payload.issues.push({
|
|
3842
3842
|
code: "invalid_value",
|
|
3843
3843
|
values,
|
|
3844
|
-
input:
|
|
3844
|
+
input: input4,
|
|
3845
3845
|
inst
|
|
3846
3846
|
});
|
|
3847
3847
|
return payload;
|
|
@@ -3856,14 +3856,14 @@ var $ZodLiteral = /* @__PURE__ */ $constructor("$ZodLiteral", (inst, def) => {
|
|
|
3856
3856
|
inst._zod.values = values;
|
|
3857
3857
|
inst._zod.pattern = new RegExp(`^(${def.values.map((o) => typeof o === "string" ? escapeRegex(o) : o ? escapeRegex(o.toString()) : String(o)).join("|")})$`);
|
|
3858
3858
|
inst._zod.parse = (payload, _ctx) => {
|
|
3859
|
-
const
|
|
3860
|
-
if (values.has(
|
|
3859
|
+
const input4 = payload.value;
|
|
3860
|
+
if (values.has(input4)) {
|
|
3861
3861
|
return payload;
|
|
3862
3862
|
}
|
|
3863
3863
|
payload.issues.push({
|
|
3864
3864
|
code: "invalid_value",
|
|
3865
3865
|
values: def.values,
|
|
3866
|
-
input:
|
|
3866
|
+
input: input4,
|
|
3867
3867
|
inst
|
|
3868
3868
|
});
|
|
3869
3869
|
return payload;
|
|
@@ -3872,13 +3872,13 @@ var $ZodLiteral = /* @__PURE__ */ $constructor("$ZodLiteral", (inst, def) => {
|
|
|
3872
3872
|
var $ZodFile = /* @__PURE__ */ $constructor("$ZodFile", (inst, def) => {
|
|
3873
3873
|
$ZodType.init(inst, def);
|
|
3874
3874
|
inst._zod.parse = (payload, _ctx) => {
|
|
3875
|
-
const
|
|
3876
|
-
if (
|
|
3875
|
+
const input4 = payload.value;
|
|
3876
|
+
if (input4 instanceof File)
|
|
3877
3877
|
return payload;
|
|
3878
3878
|
payload.issues.push({
|
|
3879
3879
|
expected: "file",
|
|
3880
3880
|
code: "invalid_type",
|
|
3881
|
-
input:
|
|
3881
|
+
input: input4,
|
|
3882
3882
|
inst
|
|
3883
3883
|
});
|
|
3884
3884
|
return payload;
|
|
@@ -3905,8 +3905,8 @@ var $ZodTransform = /* @__PURE__ */ $constructor("$ZodTransform", (inst, def) =>
|
|
|
3905
3905
|
return payload;
|
|
3906
3906
|
};
|
|
3907
3907
|
});
|
|
3908
|
-
function handleOptionalResult(result,
|
|
3909
|
-
if (result.issues.length &&
|
|
3908
|
+
function handleOptionalResult(result, input4) {
|
|
3909
|
+
if (result.issues.length && input4 === void 0) {
|
|
3910
3910
|
return { issues: [], value: void 0 };
|
|
3911
3911
|
}
|
|
3912
3912
|
return result;
|
|
@@ -4342,20 +4342,20 @@ var $ZodCustom = /* @__PURE__ */ $constructor("$ZodCustom", (inst, def) => {
|
|
|
4342
4342
|
return payload;
|
|
4343
4343
|
};
|
|
4344
4344
|
inst._zod.check = (payload) => {
|
|
4345
|
-
const
|
|
4346
|
-
const r = def.fn(
|
|
4345
|
+
const input4 = payload.value;
|
|
4346
|
+
const r = def.fn(input4);
|
|
4347
4347
|
if (r instanceof Promise) {
|
|
4348
|
-
return r.then((r2) => handleRefineResult(r2, payload,
|
|
4348
|
+
return r.then((r2) => handleRefineResult(r2, payload, input4, inst));
|
|
4349
4349
|
}
|
|
4350
|
-
handleRefineResult(r, payload,
|
|
4350
|
+
handleRefineResult(r, payload, input4, inst);
|
|
4351
4351
|
return;
|
|
4352
4352
|
};
|
|
4353
4353
|
});
|
|
4354
|
-
function handleRefineResult(result, payload,
|
|
4354
|
+
function handleRefineResult(result, payload, input4, inst) {
|
|
4355
4355
|
if (!result) {
|
|
4356
4356
|
const _iss = {
|
|
4357
4357
|
code: "custom",
|
|
4358
|
-
input:
|
|
4358
|
+
input: input4,
|
|
4359
4359
|
inst,
|
|
4360
4360
|
// incorporates params.error into issue reporting
|
|
4361
4361
|
path: [...inst._zod.def.path ?? []],
|
|
@@ -10665,23 +10665,23 @@ function _overwrite(tx) {
|
|
|
10665
10665
|
}
|
|
10666
10666
|
// @__NO_SIDE_EFFECTS__
|
|
10667
10667
|
function _normalize(form) {
|
|
10668
|
-
return /* @__PURE__ */ _overwrite((
|
|
10668
|
+
return /* @__PURE__ */ _overwrite((input4) => input4.normalize(form));
|
|
10669
10669
|
}
|
|
10670
10670
|
// @__NO_SIDE_EFFECTS__
|
|
10671
10671
|
function _trim() {
|
|
10672
|
-
return /* @__PURE__ */ _overwrite((
|
|
10672
|
+
return /* @__PURE__ */ _overwrite((input4) => input4.trim());
|
|
10673
10673
|
}
|
|
10674
10674
|
// @__NO_SIDE_EFFECTS__
|
|
10675
10675
|
function _toLowerCase() {
|
|
10676
|
-
return /* @__PURE__ */ _overwrite((
|
|
10676
|
+
return /* @__PURE__ */ _overwrite((input4) => input4.toLowerCase());
|
|
10677
10677
|
}
|
|
10678
10678
|
// @__NO_SIDE_EFFECTS__
|
|
10679
10679
|
function _toUpperCase() {
|
|
10680
|
-
return /* @__PURE__ */ _overwrite((
|
|
10680
|
+
return /* @__PURE__ */ _overwrite((input4) => input4.toUpperCase());
|
|
10681
10681
|
}
|
|
10682
10682
|
// @__NO_SIDE_EFFECTS__
|
|
10683
10683
|
function _slugify() {
|
|
10684
|
-
return /* @__PURE__ */ _overwrite((
|
|
10684
|
+
return /* @__PURE__ */ _overwrite((input4) => slugify(input4));
|
|
10685
10685
|
}
|
|
10686
10686
|
// @__NO_SIDE_EFFECTS__
|
|
10687
10687
|
function _array(Class2, element, params) {
|
|
@@ -10986,8 +10986,8 @@ function _stringbool(Classes, _params) {
|
|
|
10986
10986
|
type: "pipe",
|
|
10987
10987
|
in: stringSchema,
|
|
10988
10988
|
out: booleanSchema,
|
|
10989
|
-
transform: ((
|
|
10990
|
-
let data =
|
|
10989
|
+
transform: ((input4, payload) => {
|
|
10990
|
+
let data = input4;
|
|
10991
10991
|
if (params.case !== "sensitive")
|
|
10992
10992
|
data = data.toLowerCase();
|
|
10993
10993
|
if (truthySet.has(data)) {
|
|
@@ -11006,8 +11006,8 @@ function _stringbool(Classes, _params) {
|
|
|
11006
11006
|
return {};
|
|
11007
11007
|
}
|
|
11008
11008
|
}),
|
|
11009
|
-
reverseTransform: ((
|
|
11010
|
-
if (
|
|
11009
|
+
reverseTransform: ((input4, _payload) => {
|
|
11010
|
+
if (input4 === true) {
|
|
11011
11011
|
return truthyArray[0] || "true";
|
|
11012
11012
|
} else {
|
|
11013
11013
|
return falsyArray[0] || "false";
|
|
@@ -11903,9 +11903,9 @@ var allProcessors = {
|
|
|
11903
11903
|
optional: optionalProcessor,
|
|
11904
11904
|
lazy: lazyProcessor
|
|
11905
11905
|
};
|
|
11906
|
-
function toJSONSchema(
|
|
11907
|
-
if ("_idmap" in
|
|
11908
|
-
const registry2 =
|
|
11906
|
+
function toJSONSchema(input4, params) {
|
|
11907
|
+
if ("_idmap" in input4) {
|
|
11908
|
+
const registry2 = input4;
|
|
11909
11909
|
const ctx2 = initializeContext({ ...params, processors: allProcessors });
|
|
11910
11910
|
const defs = {};
|
|
11911
11911
|
for (const entry of registry2._idmap.entries()) {
|
|
@@ -11933,9 +11933,9 @@ function toJSONSchema(input3, params) {
|
|
|
11933
11933
|
return { schemas };
|
|
11934
11934
|
}
|
|
11935
11935
|
const ctx = initializeContext({ ...params, processors: allProcessors });
|
|
11936
|
-
process2(
|
|
11937
|
-
extractDefs(ctx,
|
|
11938
|
-
return finalize(ctx,
|
|
11936
|
+
process2(input4, ctx);
|
|
11937
|
+
extractDefs(ctx, input4);
|
|
11938
|
+
return finalize(ctx, input4);
|
|
11939
11939
|
}
|
|
11940
11940
|
|
|
11941
11941
|
// node_modules/zod/v4/core/json-schema-generator.js
|
|
@@ -14101,6 +14101,128 @@ function createMeetingTools(store) {
|
|
|
14101
14101
|
|
|
14102
14102
|
// src/plugins/builtin/tools/reports.ts
|
|
14103
14103
|
import { tool as tool2 } from "@anthropic-ai/claude-agent-sdk";
|
|
14104
|
+
|
|
14105
|
+
// src/reports/gar/collector.ts
|
|
14106
|
+
function collectGarMetrics(store) {
|
|
14107
|
+
const allActions = store.list({ type: "action" });
|
|
14108
|
+
const openActions = allActions.filter((d) => d.frontmatter.status === "open");
|
|
14109
|
+
const doneActions = allActions.filter((d) => d.frontmatter.status === "done");
|
|
14110
|
+
const allDocs = store.list();
|
|
14111
|
+
const blockedItems = allDocs.filter(
|
|
14112
|
+
(d) => d.frontmatter.tags?.includes("blocked")
|
|
14113
|
+
);
|
|
14114
|
+
const overdueItems = allDocs.filter(
|
|
14115
|
+
(d) => d.frontmatter.tags?.includes("overdue")
|
|
14116
|
+
);
|
|
14117
|
+
const openQuestions = store.list({ type: "question", status: "open" });
|
|
14118
|
+
const riskItems = allDocs.filter(
|
|
14119
|
+
(d) => d.frontmatter.tags?.includes("risk")
|
|
14120
|
+
);
|
|
14121
|
+
const unownedActions = openActions.filter((d) => !d.frontmatter.owner);
|
|
14122
|
+
const total = allActions.length;
|
|
14123
|
+
const done = doneActions.length;
|
|
14124
|
+
const completionPct = total > 0 ? Math.round(done / total * 100) : 100;
|
|
14125
|
+
const scheduleItems = [
|
|
14126
|
+
...blockedItems,
|
|
14127
|
+
...overdueItems
|
|
14128
|
+
].filter(
|
|
14129
|
+
(d, i, arr) => arr.findIndex((x) => x.frontmatter.id === d.frontmatter.id) === i
|
|
14130
|
+
).map((d) => ({ id: d.frontmatter.id, title: d.frontmatter.title }));
|
|
14131
|
+
const qualityItems = [
|
|
14132
|
+
...riskItems,
|
|
14133
|
+
...openQuestions
|
|
14134
|
+
].filter(
|
|
14135
|
+
(d, i, arr) => arr.findIndex((x) => x.frontmatter.id === d.frontmatter.id) === i
|
|
14136
|
+
).map((d) => ({ id: d.frontmatter.id, title: d.frontmatter.title }));
|
|
14137
|
+
const resourceItems = unownedActions.map((d) => ({
|
|
14138
|
+
id: d.frontmatter.id,
|
|
14139
|
+
title: d.frontmatter.title
|
|
14140
|
+
}));
|
|
14141
|
+
return {
|
|
14142
|
+
scope: {
|
|
14143
|
+
total,
|
|
14144
|
+
open: openActions.length,
|
|
14145
|
+
done,
|
|
14146
|
+
completionPct
|
|
14147
|
+
},
|
|
14148
|
+
schedule: {
|
|
14149
|
+
blocked: blockedItems.length,
|
|
14150
|
+
overdue: overdueItems.length,
|
|
14151
|
+
items: scheduleItems
|
|
14152
|
+
},
|
|
14153
|
+
quality: {
|
|
14154
|
+
risks: riskItems.length,
|
|
14155
|
+
openQuestions: openQuestions.length,
|
|
14156
|
+
items: qualityItems
|
|
14157
|
+
},
|
|
14158
|
+
resources: {
|
|
14159
|
+
unowned: unownedActions.length,
|
|
14160
|
+
items: resourceItems
|
|
14161
|
+
}
|
|
14162
|
+
};
|
|
14163
|
+
}
|
|
14164
|
+
|
|
14165
|
+
// src/reports/gar/evaluator.ts
|
|
14166
|
+
function worstStatus(statuses) {
|
|
14167
|
+
if (statuses.includes("red")) return "red";
|
|
14168
|
+
if (statuses.includes("amber")) return "amber";
|
|
14169
|
+
return "green";
|
|
14170
|
+
}
|
|
14171
|
+
function evaluateGar(projectName, metrics) {
|
|
14172
|
+
const areas = [];
|
|
14173
|
+
const scopePct = metrics.scope.completionPct;
|
|
14174
|
+
const scopeStatus = scopePct >= 70 ? "green" : scopePct >= 40 ? "amber" : "red";
|
|
14175
|
+
areas.push({
|
|
14176
|
+
name: "Scope",
|
|
14177
|
+
status: scopeStatus,
|
|
14178
|
+
summary: `${scopePct}% complete (${metrics.scope.done}/${metrics.scope.total})`,
|
|
14179
|
+
items: []
|
|
14180
|
+
});
|
|
14181
|
+
const scheduleCount = metrics.schedule.blocked + metrics.schedule.overdue;
|
|
14182
|
+
const scheduleStatus = scheduleCount === 0 ? "green" : scheduleCount <= 2 ? "amber" : "red";
|
|
14183
|
+
const scheduleParts = [];
|
|
14184
|
+
if (metrics.schedule.blocked > 0)
|
|
14185
|
+
scheduleParts.push(`${metrics.schedule.blocked} blocked`);
|
|
14186
|
+
if (metrics.schedule.overdue > 0)
|
|
14187
|
+
scheduleParts.push(`${metrics.schedule.overdue} overdue`);
|
|
14188
|
+
areas.push({
|
|
14189
|
+
name: "Schedule",
|
|
14190
|
+
status: scheduleStatus,
|
|
14191
|
+
summary: scheduleParts.length > 0 ? scheduleParts.join(", ") : "on track",
|
|
14192
|
+
items: metrics.schedule.items
|
|
14193
|
+
});
|
|
14194
|
+
const qualityCount = metrics.quality.risks + metrics.quality.openQuestions;
|
|
14195
|
+
const qualityStatus = qualityCount === 0 ? "green" : qualityCount <= 2 ? "amber" : "red";
|
|
14196
|
+
const qualityParts = [];
|
|
14197
|
+
if (metrics.quality.risks > 0)
|
|
14198
|
+
qualityParts.push(`${metrics.quality.risks} risk(s)`);
|
|
14199
|
+
if (metrics.quality.openQuestions > 0)
|
|
14200
|
+
qualityParts.push(`${metrics.quality.openQuestions} open question(s)`);
|
|
14201
|
+
areas.push({
|
|
14202
|
+
name: "Quality",
|
|
14203
|
+
status: qualityStatus,
|
|
14204
|
+
summary: qualityParts.length > 0 ? qualityParts.join(", ") : "no issues",
|
|
14205
|
+
items: metrics.quality.items
|
|
14206
|
+
});
|
|
14207
|
+
const resourceCount = metrics.resources.unowned;
|
|
14208
|
+
const resourceStatus = resourceCount === 0 ? "green" : resourceCount <= 2 ? "amber" : "red";
|
|
14209
|
+
areas.push({
|
|
14210
|
+
name: "Resources",
|
|
14211
|
+
status: resourceStatus,
|
|
14212
|
+
summary: resourceCount > 0 ? `${resourceCount} unowned action(s)` : "all assigned",
|
|
14213
|
+
items: metrics.resources.items
|
|
14214
|
+
});
|
|
14215
|
+
const overall = worstStatus(areas.map((a) => a.status));
|
|
14216
|
+
return {
|
|
14217
|
+
projectName,
|
|
14218
|
+
generatedAt: (/* @__PURE__ */ new Date()).toISOString().slice(0, 10),
|
|
14219
|
+
overall,
|
|
14220
|
+
areas,
|
|
14221
|
+
metrics
|
|
14222
|
+
};
|
|
14223
|
+
}
|
|
14224
|
+
|
|
14225
|
+
// src/plugins/builtin/tools/reports.ts
|
|
14104
14226
|
function createReportTools(store) {
|
|
14105
14227
|
return [
|
|
14106
14228
|
tool2(
|
|
@@ -14189,41 +14311,10 @@ function createReportTools(store) {
|
|
|
14189
14311
|
"Generate a Green-Amber-Red report with metrics across scope, schedule, quality, and resources",
|
|
14190
14312
|
{},
|
|
14191
14313
|
async () => {
|
|
14192
|
-
const
|
|
14193
|
-
const
|
|
14194
|
-
const doneActions = allActions.filter((d) => d.frontmatter.status === "done");
|
|
14195
|
-
const allDocs = store.list();
|
|
14196
|
-
const blockedItems = allDocs.filter(
|
|
14197
|
-
(d) => d.frontmatter.tags?.includes("blocked")
|
|
14198
|
-
);
|
|
14199
|
-
const overdueItems = allDocs.filter(
|
|
14200
|
-
(d) => d.frontmatter.tags?.includes("overdue")
|
|
14201
|
-
);
|
|
14202
|
-
const openQuestions = store.list({ type: "question", status: "open" });
|
|
14203
|
-
const riskItems = allDocs.filter(
|
|
14204
|
-
(d) => d.frontmatter.tags?.includes("risk")
|
|
14205
|
-
);
|
|
14206
|
-
const unownedActions = openActions.filter((d) => !d.frontmatter.owner);
|
|
14207
|
-
const areas = {
|
|
14208
|
-
scope: {
|
|
14209
|
-
total: allActions.length,
|
|
14210
|
-
open: openActions.length,
|
|
14211
|
-
done: doneActions.length
|
|
14212
|
-
},
|
|
14213
|
-
schedule: {
|
|
14214
|
-
blocked: blockedItems.length,
|
|
14215
|
-
overdue: overdueItems.length
|
|
14216
|
-
},
|
|
14217
|
-
quality: {
|
|
14218
|
-
openQuestions: openQuestions.length,
|
|
14219
|
-
risks: riskItems.length
|
|
14220
|
-
},
|
|
14221
|
-
resources: {
|
|
14222
|
-
unowned: unownedActions.length
|
|
14223
|
-
}
|
|
14224
|
-
};
|
|
14314
|
+
const metrics = collectGarMetrics(store);
|
|
14315
|
+
const report = evaluateGar("project", metrics);
|
|
14225
14316
|
return {
|
|
14226
|
-
content: [{ type: "text", text: JSON.stringify(
|
|
14317
|
+
content: [{ type: "text", text: JSON.stringify(report, null, 2) }]
|
|
14227
14318
|
};
|
|
14228
14319
|
},
|
|
14229
14320
|
{ annotations: { readOnly: true } }
|
|
@@ -16504,14 +16595,14 @@ function getPersona(idOrShortName) {
|
|
|
16504
16595
|
function listPersonas() {
|
|
16505
16596
|
return [...BUILTIN_PERSONAS];
|
|
16506
16597
|
}
|
|
16507
|
-
function resolvePersonaId(
|
|
16508
|
-
const persona = getPersona(
|
|
16598
|
+
function resolvePersonaId(input4) {
|
|
16599
|
+
const persona = getPersona(input4);
|
|
16509
16600
|
if (!persona) {
|
|
16510
16601
|
const available = BUILTIN_PERSONAS.map(
|
|
16511
16602
|
(p) => `${p.shortName} (${p.name})`
|
|
16512
16603
|
).join(", ");
|
|
16513
16604
|
throw new Error(
|
|
16514
|
-
`Unknown persona "${
|
|
16605
|
+
`Unknown persona "${input4}". Available: ${available}`
|
|
16515
16606
|
);
|
|
16516
16607
|
}
|
|
16517
16608
|
return persona.id;
|
|
@@ -16759,13 +16850,10 @@ var DocumentStore = class {
|
|
|
16759
16850
|
if (!prefix) {
|
|
16760
16851
|
throw new Error(`Unknown document type: ${type}`);
|
|
16761
16852
|
}
|
|
16762
|
-
const
|
|
16763
|
-
const dir = path5.join(this.docsDir, dirName);
|
|
16764
|
-
if (!fs5.existsSync(dir)) return `${prefix}-001`;
|
|
16765
|
-
const files = fs5.readdirSync(dir).filter((f) => f.endsWith(".md"));
|
|
16853
|
+
const pattern = new RegExp(`^${prefix}-(\\d+)$`);
|
|
16766
16854
|
let maxNum = 0;
|
|
16767
|
-
for (const
|
|
16768
|
-
const match =
|
|
16855
|
+
for (const id of this.index.keys()) {
|
|
16856
|
+
const match = id.match(pattern);
|
|
16769
16857
|
if (match) {
|
|
16770
16858
|
maxNum = Math.max(maxNum, parseInt(match[1], 10));
|
|
16771
16859
|
}
|
|
@@ -17615,9 +17703,492 @@ Be thorough but concise. Focus on actionable insights.`,
|
|
|
17615
17703
|
]
|
|
17616
17704
|
};
|
|
17617
17705
|
|
|
17706
|
+
// src/skills/builtin/jira/tools.ts
|
|
17707
|
+
import { tool as tool19 } from "@anthropic-ai/claude-agent-sdk";
|
|
17708
|
+
|
|
17709
|
+
// src/skills/builtin/jira/client.ts
|
|
17710
|
+
var JiraClient = class {
|
|
17711
|
+
baseUrl;
|
|
17712
|
+
authHeader;
|
|
17713
|
+
constructor(config2) {
|
|
17714
|
+
this.baseUrl = `https://${config2.host}/rest/api/2`;
|
|
17715
|
+
this.authHeader = "Basic " + Buffer.from(`${config2.email}:${config2.apiToken}`).toString("base64");
|
|
17716
|
+
}
|
|
17717
|
+
async request(path18, method = "GET", body) {
|
|
17718
|
+
const url2 = `${this.baseUrl}${path18}`;
|
|
17719
|
+
const headers = {
|
|
17720
|
+
Authorization: this.authHeader,
|
|
17721
|
+
"Content-Type": "application/json",
|
|
17722
|
+
Accept: "application/json"
|
|
17723
|
+
};
|
|
17724
|
+
const response = await fetch(url2, {
|
|
17725
|
+
method,
|
|
17726
|
+
headers,
|
|
17727
|
+
body: body ? JSON.stringify(body) : void 0
|
|
17728
|
+
});
|
|
17729
|
+
if (!response.ok) {
|
|
17730
|
+
const text = await response.text().catch(() => "");
|
|
17731
|
+
throw new Error(
|
|
17732
|
+
`Jira API error ${response.status} ${method} ${path18}: ${text}`
|
|
17733
|
+
);
|
|
17734
|
+
}
|
|
17735
|
+
if (response.status === 204) return void 0;
|
|
17736
|
+
return response.json();
|
|
17737
|
+
}
|
|
17738
|
+
async searchIssues(jql, maxResults = 50) {
|
|
17739
|
+
const params = new URLSearchParams({
|
|
17740
|
+
jql,
|
|
17741
|
+
maxResults: String(maxResults)
|
|
17742
|
+
});
|
|
17743
|
+
return this.request(`/search?${params}`);
|
|
17744
|
+
}
|
|
17745
|
+
async getIssue(key) {
|
|
17746
|
+
return this.request(`/issue/${encodeURIComponent(key)}`);
|
|
17747
|
+
}
|
|
17748
|
+
async createIssue(fields) {
|
|
17749
|
+
return this.request("/issue", "POST", { fields });
|
|
17750
|
+
}
|
|
17751
|
+
async updateIssue(key, fields) {
|
|
17752
|
+
await this.request(
|
|
17753
|
+
`/issue/${encodeURIComponent(key)}`,
|
|
17754
|
+
"PUT",
|
|
17755
|
+
{ fields }
|
|
17756
|
+
);
|
|
17757
|
+
}
|
|
17758
|
+
async addComment(key, body) {
|
|
17759
|
+
await this.request(
|
|
17760
|
+
`/issue/${encodeURIComponent(key)}/comment`,
|
|
17761
|
+
"POST",
|
|
17762
|
+
{ body }
|
|
17763
|
+
);
|
|
17764
|
+
}
|
|
17765
|
+
};
|
|
17766
|
+
function createJiraClient(jiraUserConfig) {
|
|
17767
|
+
const host = jiraUserConfig?.host ?? process.env.JIRA_HOST;
|
|
17768
|
+
const email3 = jiraUserConfig?.email ?? process.env.JIRA_EMAIL;
|
|
17769
|
+
const apiToken = jiraUserConfig?.apiToken ?? process.env.JIRA_API_TOKEN;
|
|
17770
|
+
if (!host || !email3 || !apiToken) return null;
|
|
17771
|
+
return { client: new JiraClient({ host, email: email3, apiToken }), host };
|
|
17772
|
+
}
|
|
17773
|
+
|
|
17774
|
+
// src/skills/builtin/jira/tools.ts
|
|
17775
|
+
var JIRA_TYPE = "jira-issue";
|
|
17776
|
+
function jiraNotConfiguredError() {
|
|
17777
|
+
return {
|
|
17778
|
+
content: [
|
|
17779
|
+
{
|
|
17780
|
+
type: "text",
|
|
17781
|
+
text: 'Jira is not configured. Run "marvin config jira" or set JIRA_HOST, JIRA_EMAIL, and JIRA_API_TOKEN environment variables.'
|
|
17782
|
+
}
|
|
17783
|
+
],
|
|
17784
|
+
isError: true
|
|
17785
|
+
};
|
|
17786
|
+
}
|
|
17787
|
+
function mapJiraStatus(jiraStatus) {
|
|
17788
|
+
const lower = jiraStatus.toLowerCase();
|
|
17789
|
+
if (lower === "done" || lower === "closed" || lower === "resolved") return "done";
|
|
17790
|
+
if (lower === "in progress" || lower === "in review") return "in-progress";
|
|
17791
|
+
return "open";
|
|
17792
|
+
}
|
|
17793
|
+
function jiraIssueToFrontmatter(issue2, host, linkedArtifacts) {
|
|
17794
|
+
return {
|
|
17795
|
+
title: issue2.fields.summary,
|
|
17796
|
+
status: mapJiraStatus(issue2.fields.status.name),
|
|
17797
|
+
jiraKey: issue2.key,
|
|
17798
|
+
jiraUrl: `https://${host}/browse/${issue2.key}`,
|
|
17799
|
+
issueType: issue2.fields.issuetype.name,
|
|
17800
|
+
priority: issue2.fields.priority?.name ?? "None",
|
|
17801
|
+
assignee: issue2.fields.assignee?.displayName ?? "",
|
|
17802
|
+
labels: issue2.fields.labels ?? [],
|
|
17803
|
+
linkedArtifacts: linkedArtifacts ?? [],
|
|
17804
|
+
tags: [`jira:${issue2.key}`],
|
|
17805
|
+
lastSyncedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
17806
|
+
};
|
|
17807
|
+
}
|
|
17808
|
+
function findByJiraKey(store, jiraKey) {
|
|
17809
|
+
const docs = store.list({ type: JIRA_TYPE });
|
|
17810
|
+
return docs.find((d) => d.frontmatter.jiraKey === jiraKey);
|
|
17811
|
+
}
|
|
17812
|
+
function createJiraTools(store) {
|
|
17813
|
+
const jiraUserConfig = loadUserConfig().jira;
|
|
17814
|
+
return [
|
|
17815
|
+
// --- Local read tools ---
|
|
17816
|
+
tool19(
|
|
17817
|
+
"list_jira_issues",
|
|
17818
|
+
"List locally synced Jira issues (JI-xxx documents), optionally filtered by status or Jira key",
|
|
17819
|
+
{
|
|
17820
|
+
status: external_exports.enum(["open", "in-progress", "done"]).optional().describe("Filter by local status"),
|
|
17821
|
+
jiraKey: external_exports.string().optional().describe("Filter by Jira issue key (e.g. 'PROJ-123')")
|
|
17822
|
+
},
|
|
17823
|
+
async (args) => {
|
|
17824
|
+
let docs = store.list({ type: JIRA_TYPE, status: args.status });
|
|
17825
|
+
if (args.jiraKey) {
|
|
17826
|
+
docs = docs.filter((d) => d.frontmatter.jiraKey === args.jiraKey);
|
|
17827
|
+
}
|
|
17828
|
+
const summary = docs.map((d) => ({
|
|
17829
|
+
id: d.frontmatter.id,
|
|
17830
|
+
title: d.frontmatter.title,
|
|
17831
|
+
status: d.frontmatter.status,
|
|
17832
|
+
jiraKey: d.frontmatter.jiraKey,
|
|
17833
|
+
issueType: d.frontmatter.issueType,
|
|
17834
|
+
priority: d.frontmatter.priority,
|
|
17835
|
+
assignee: d.frontmatter.assignee,
|
|
17836
|
+
linkedArtifacts: d.frontmatter.linkedArtifacts
|
|
17837
|
+
}));
|
|
17838
|
+
return {
|
|
17839
|
+
content: [{ type: "text", text: JSON.stringify(summary, null, 2) }]
|
|
17840
|
+
};
|
|
17841
|
+
},
|
|
17842
|
+
{ annotations: { readOnly: true } }
|
|
17843
|
+
),
|
|
17844
|
+
tool19(
|
|
17845
|
+
"get_jira_issue",
|
|
17846
|
+
"Get the full content of a locally synced Jira issue by local ID (JI-xxx) or Jira key (PROJ-123)",
|
|
17847
|
+
{
|
|
17848
|
+
id: external_exports.string().describe("Local ID (e.g. 'JI-001') or Jira key (e.g. 'PROJ-123')")
|
|
17849
|
+
},
|
|
17850
|
+
async (args) => {
|
|
17851
|
+
let doc = store.get(args.id);
|
|
17852
|
+
if (!doc) {
|
|
17853
|
+
doc = findByJiraKey(store, args.id);
|
|
17854
|
+
}
|
|
17855
|
+
if (!doc) {
|
|
17856
|
+
return {
|
|
17857
|
+
content: [{ type: "text", text: `Jira issue ${args.id} not found locally` }],
|
|
17858
|
+
isError: true
|
|
17859
|
+
};
|
|
17860
|
+
}
|
|
17861
|
+
return {
|
|
17862
|
+
content: [
|
|
17863
|
+
{
|
|
17864
|
+
type: "text",
|
|
17865
|
+
text: JSON.stringify(
|
|
17866
|
+
{ ...doc.frontmatter, content: doc.content },
|
|
17867
|
+
null,
|
|
17868
|
+
2
|
|
17869
|
+
)
|
|
17870
|
+
}
|
|
17871
|
+
]
|
|
17872
|
+
};
|
|
17873
|
+
},
|
|
17874
|
+
{ annotations: { readOnly: true } }
|
|
17875
|
+
),
|
|
17876
|
+
// --- Jira → Local tools ---
|
|
17877
|
+
tool19(
|
|
17878
|
+
"pull_jira_issue",
|
|
17879
|
+
"Fetch a single Jira issue by key and create/update a local JI-xxx document",
|
|
17880
|
+
{
|
|
17881
|
+
key: external_exports.string().describe("Jira issue key (e.g. 'PROJ-123')")
|
|
17882
|
+
},
|
|
17883
|
+
async (args) => {
|
|
17884
|
+
const jira = createJiraClient(jiraUserConfig);
|
|
17885
|
+
if (!jira) return jiraNotConfiguredError();
|
|
17886
|
+
const issue2 = await jira.client.getIssue(args.key);
|
|
17887
|
+
const existing = findByJiraKey(store, args.key);
|
|
17888
|
+
if (existing) {
|
|
17889
|
+
const fm2 = jiraIssueToFrontmatter(
|
|
17890
|
+
issue2,
|
|
17891
|
+
jira.host,
|
|
17892
|
+
existing.frontmatter.linkedArtifacts
|
|
17893
|
+
);
|
|
17894
|
+
const doc2 = store.update(
|
|
17895
|
+
existing.frontmatter.id,
|
|
17896
|
+
fm2,
|
|
17897
|
+
issue2.fields.description ?? ""
|
|
17898
|
+
);
|
|
17899
|
+
return {
|
|
17900
|
+
content: [
|
|
17901
|
+
{
|
|
17902
|
+
type: "text",
|
|
17903
|
+
text: `Updated ${doc2.frontmatter.id} from Jira ${args.key}`
|
|
17904
|
+
}
|
|
17905
|
+
]
|
|
17906
|
+
};
|
|
17907
|
+
}
|
|
17908
|
+
const fm = jiraIssueToFrontmatter(issue2, jira.host);
|
|
17909
|
+
const doc = store.create(
|
|
17910
|
+
JIRA_TYPE,
|
|
17911
|
+
fm,
|
|
17912
|
+
issue2.fields.description ?? ""
|
|
17913
|
+
);
|
|
17914
|
+
return {
|
|
17915
|
+
content: [
|
|
17916
|
+
{
|
|
17917
|
+
type: "text",
|
|
17918
|
+
text: `Created ${doc.frontmatter.id} from Jira ${args.key}`
|
|
17919
|
+
}
|
|
17920
|
+
]
|
|
17921
|
+
};
|
|
17922
|
+
}
|
|
17923
|
+
),
|
|
17924
|
+
tool19(
|
|
17925
|
+
"pull_jira_issues_jql",
|
|
17926
|
+
"Bulk fetch Jira issues via JQL query and create/update local JI-xxx documents",
|
|
17927
|
+
{
|
|
17928
|
+
jql: external_exports.string().describe(`JQL query (e.g. 'project = PROJ AND status = "In Progress"')`),
|
|
17929
|
+
maxResults: external_exports.number().optional().describe("Max issues to fetch (default 50)")
|
|
17930
|
+
},
|
|
17931
|
+
async (args) => {
|
|
17932
|
+
const jira = createJiraClient(jiraUserConfig);
|
|
17933
|
+
if (!jira) return jiraNotConfiguredError();
|
|
17934
|
+
const result = await jira.client.searchIssues(args.jql, args.maxResults);
|
|
17935
|
+
const created = [];
|
|
17936
|
+
const updated = [];
|
|
17937
|
+
for (const issue2 of result.issues) {
|
|
17938
|
+
const existing = findByJiraKey(store, issue2.key);
|
|
17939
|
+
if (existing) {
|
|
17940
|
+
const fm = jiraIssueToFrontmatter(
|
|
17941
|
+
issue2,
|
|
17942
|
+
jira.host,
|
|
17943
|
+
existing.frontmatter.linkedArtifacts
|
|
17944
|
+
);
|
|
17945
|
+
store.update(
|
|
17946
|
+
existing.frontmatter.id,
|
|
17947
|
+
fm,
|
|
17948
|
+
issue2.fields.description ?? ""
|
|
17949
|
+
);
|
|
17950
|
+
updated.push(`${existing.frontmatter.id} (${issue2.key})`);
|
|
17951
|
+
} else {
|
|
17952
|
+
const fm = jiraIssueToFrontmatter(issue2, jira.host);
|
|
17953
|
+
const doc = store.create(
|
|
17954
|
+
JIRA_TYPE,
|
|
17955
|
+
fm,
|
|
17956
|
+
issue2.fields.description ?? ""
|
|
17957
|
+
);
|
|
17958
|
+
created.push(`${doc.frontmatter.id} (${issue2.key})`);
|
|
17959
|
+
}
|
|
17960
|
+
}
|
|
17961
|
+
const parts = [
|
|
17962
|
+
`Fetched ${result.issues.length} of ${result.total} matching issues.`
|
|
17963
|
+
];
|
|
17964
|
+
if (created.length > 0) parts.push(`Created: ${created.join(", ")}`);
|
|
17965
|
+
if (updated.length > 0) parts.push(`Updated: ${updated.join(", ")}`);
|
|
17966
|
+
return {
|
|
17967
|
+
content: [{ type: "text", text: parts.join("\n") }]
|
|
17968
|
+
};
|
|
17969
|
+
}
|
|
17970
|
+
),
|
|
17971
|
+
// --- Local → Jira tools ---
|
|
17972
|
+
tool19(
|
|
17973
|
+
"push_artifact_to_jira",
|
|
17974
|
+
"Create a Jira issue from any Marvin artifact (D/A/Q/F/E) and create a tracking JI-xxx document",
|
|
17975
|
+
{
|
|
17976
|
+
artifactId: external_exports.string().describe("Marvin artifact ID (e.g. 'D-001', 'F-003', 'E-002')"),
|
|
17977
|
+
projectKey: external_exports.string().describe("Jira project key (e.g. 'PROJ')"),
|
|
17978
|
+
issueType: external_exports.enum(["Story", "Task", "Bug", "Epic"]).optional().describe("Jira issue type (default: 'Task')")
|
|
17979
|
+
},
|
|
17980
|
+
async (args) => {
|
|
17981
|
+
const jira = createJiraClient(jiraUserConfig);
|
|
17982
|
+
if (!jira) return jiraNotConfiguredError();
|
|
17983
|
+
const artifact = store.get(args.artifactId);
|
|
17984
|
+
if (!artifact) {
|
|
17985
|
+
return {
|
|
17986
|
+
content: [
|
|
17987
|
+
{ type: "text", text: `Artifact ${args.artifactId} not found` }
|
|
17988
|
+
],
|
|
17989
|
+
isError: true
|
|
17990
|
+
};
|
|
17991
|
+
}
|
|
17992
|
+
const description = [
|
|
17993
|
+
artifact.content,
|
|
17994
|
+
"",
|
|
17995
|
+
`---`,
|
|
17996
|
+
`Marvin artifact: ${artifact.frontmatter.id} (${artifact.frontmatter.type})`,
|
|
17997
|
+
`Status: ${artifact.frontmatter.status}`
|
|
17998
|
+
].join("\n");
|
|
17999
|
+
const jiraResult = await jira.client.createIssue({
|
|
18000
|
+
project: { key: args.projectKey },
|
|
18001
|
+
summary: artifact.frontmatter.title,
|
|
18002
|
+
description,
|
|
18003
|
+
issuetype: { name: args.issueType ?? "Task" }
|
|
18004
|
+
});
|
|
18005
|
+
const jiDoc = store.create(
|
|
18006
|
+
JIRA_TYPE,
|
|
18007
|
+
{
|
|
18008
|
+
title: artifact.frontmatter.title,
|
|
18009
|
+
status: "open",
|
|
18010
|
+
jiraKey: jiraResult.key,
|
|
18011
|
+
jiraUrl: `https://${jira.host}/browse/${jiraResult.key}`,
|
|
18012
|
+
issueType: args.issueType ?? "Task",
|
|
18013
|
+
priority: "Medium",
|
|
18014
|
+
assignee: "",
|
|
18015
|
+
labels: [],
|
|
18016
|
+
linkedArtifacts: [args.artifactId],
|
|
18017
|
+
tags: [`jira:${jiraResult.key}`],
|
|
18018
|
+
lastSyncedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
18019
|
+
},
|
|
18020
|
+
""
|
|
18021
|
+
);
|
|
18022
|
+
return {
|
|
18023
|
+
content: [
|
|
18024
|
+
{
|
|
18025
|
+
type: "text",
|
|
18026
|
+
text: `Created Jira ${jiraResult.key} from ${args.artifactId}. Tracking locally as ${jiDoc.frontmatter.id}.`
|
|
18027
|
+
}
|
|
18028
|
+
]
|
|
18029
|
+
};
|
|
18030
|
+
}
|
|
18031
|
+
),
|
|
18032
|
+
// --- Bidirectional sync ---
|
|
18033
|
+
tool19(
|
|
18034
|
+
"sync_jira_issue",
|
|
18035
|
+
"Bidirectional sync: push local title/description to Jira, pull latest status/assignee/labels back",
|
|
18036
|
+
{
|
|
18037
|
+
id: external_exports.string().describe("Local JI-xxx ID")
|
|
18038
|
+
},
|
|
18039
|
+
async (args) => {
|
|
18040
|
+
const jira = createJiraClient(jiraUserConfig);
|
|
18041
|
+
if (!jira) return jiraNotConfiguredError();
|
|
18042
|
+
const doc = store.get(args.id);
|
|
18043
|
+
if (!doc || doc.frontmatter.type !== JIRA_TYPE) {
|
|
18044
|
+
return {
|
|
18045
|
+
content: [
|
|
18046
|
+
{ type: "text", text: `Jira issue ${args.id} not found locally` }
|
|
18047
|
+
],
|
|
18048
|
+
isError: true
|
|
18049
|
+
};
|
|
18050
|
+
}
|
|
18051
|
+
const jiraKey = doc.frontmatter.jiraKey;
|
|
18052
|
+
await jira.client.updateIssue(jiraKey, {
|
|
18053
|
+
summary: doc.frontmatter.title,
|
|
18054
|
+
description: doc.content || void 0
|
|
18055
|
+
});
|
|
18056
|
+
const issue2 = await jira.client.getIssue(jiraKey);
|
|
18057
|
+
const fm = jiraIssueToFrontmatter(
|
|
18058
|
+
issue2,
|
|
18059
|
+
jira.host,
|
|
18060
|
+
doc.frontmatter.linkedArtifacts
|
|
18061
|
+
);
|
|
18062
|
+
store.update(args.id, fm, issue2.fields.description ?? "");
|
|
18063
|
+
return {
|
|
18064
|
+
content: [
|
|
18065
|
+
{
|
|
18066
|
+
type: "text",
|
|
18067
|
+
text: `Synced ${args.id} \u2194 ${jiraKey}. Status: ${fm.status}, Assignee: ${fm.assignee || "unassigned"}`
|
|
18068
|
+
}
|
|
18069
|
+
]
|
|
18070
|
+
};
|
|
18071
|
+
}
|
|
18072
|
+
),
|
|
18073
|
+
// --- Local link tool ---
|
|
18074
|
+
tool19(
|
|
18075
|
+
"link_artifact_to_jira",
|
|
18076
|
+
"Add a Marvin artifact ID to a JI-xxx document's linkedArtifacts field",
|
|
18077
|
+
{
|
|
18078
|
+
jiraIssueId: external_exports.string().describe("Local JI-xxx ID"),
|
|
18079
|
+
artifactId: external_exports.string().describe("Marvin artifact ID to link (e.g. 'D-001', 'F-003')")
|
|
18080
|
+
},
|
|
18081
|
+
async (args) => {
|
|
18082
|
+
const doc = store.get(args.jiraIssueId);
|
|
18083
|
+
if (!doc || doc.frontmatter.type !== JIRA_TYPE) {
|
|
18084
|
+
return {
|
|
18085
|
+
content: [
|
|
18086
|
+
{
|
|
18087
|
+
type: "text",
|
|
18088
|
+
text: `Jira issue ${args.jiraIssueId} not found locally`
|
|
18089
|
+
}
|
|
18090
|
+
],
|
|
18091
|
+
isError: true
|
|
18092
|
+
};
|
|
18093
|
+
}
|
|
18094
|
+
const artifact = store.get(args.artifactId);
|
|
18095
|
+
if (!artifact) {
|
|
18096
|
+
return {
|
|
18097
|
+
content: [
|
|
18098
|
+
{ type: "text", text: `Artifact ${args.artifactId} not found` }
|
|
18099
|
+
],
|
|
18100
|
+
isError: true
|
|
18101
|
+
};
|
|
18102
|
+
}
|
|
18103
|
+
const linked = doc.frontmatter.linkedArtifacts ?? [];
|
|
18104
|
+
if (linked.includes(args.artifactId)) {
|
|
18105
|
+
return {
|
|
18106
|
+
content: [
|
|
18107
|
+
{
|
|
18108
|
+
type: "text",
|
|
18109
|
+
text: `${args.artifactId} is already linked to ${args.jiraIssueId}`
|
|
18110
|
+
}
|
|
18111
|
+
]
|
|
18112
|
+
};
|
|
18113
|
+
}
|
|
18114
|
+
store.update(args.jiraIssueId, {
|
|
18115
|
+
linkedArtifacts: [...linked, args.artifactId]
|
|
18116
|
+
});
|
|
18117
|
+
return {
|
|
18118
|
+
content: [
|
|
18119
|
+
{
|
|
18120
|
+
type: "text",
|
|
18121
|
+
text: `Linked ${args.artifactId} to ${args.jiraIssueId}`
|
|
18122
|
+
}
|
|
18123
|
+
]
|
|
18124
|
+
};
|
|
18125
|
+
}
|
|
18126
|
+
)
|
|
18127
|
+
];
|
|
18128
|
+
}
|
|
18129
|
+
|
|
18130
|
+
// src/skills/builtin/jira/index.ts
|
|
18131
|
+
var jiraSkill = {
|
|
18132
|
+
id: "jira",
|
|
18133
|
+
name: "Jira Integration",
|
|
18134
|
+
description: "Bidirectional sync between Marvin artifacts and Jira issues",
|
|
18135
|
+
version: "1.0.0",
|
|
18136
|
+
format: "builtin-ts",
|
|
18137
|
+
// No default persona affinity — opt-in via config.yaml skills section
|
|
18138
|
+
documentTypeRegistrations: [
|
|
18139
|
+
{ type: "jira-issue", dirName: "jira-issues", idPrefix: "JI" }
|
|
18140
|
+
],
|
|
18141
|
+
tools: (store) => createJiraTools(store),
|
|
18142
|
+
promptFragments: {
|
|
18143
|
+
"product-owner": `You have the **Jira Integration** skill. You can pull issues from Jira and push Marvin artifacts to Jira.
|
|
18144
|
+
|
|
18145
|
+
**Available tools:**
|
|
18146
|
+
- \`list_jira_issues\` / \`get_jira_issue\` \u2014 browse locally synced Jira issues
|
|
18147
|
+
- \`pull_jira_issue\` / \`pull_jira_issues_jql\` \u2014 import issues from Jira by key or JQL query
|
|
18148
|
+
- \`push_artifact_to_jira\` \u2014 create a Jira issue from a Marvin artifact (decision, feature, etc.)
|
|
18149
|
+
- \`sync_jira_issue\` \u2014 bidirectional sync of a local JI-xxx with Jira
|
|
18150
|
+
- \`link_artifact_to_jira\` \u2014 link a Marvin artifact to an existing JI-xxx
|
|
18151
|
+
|
|
18152
|
+
**As Product Owner, use Jira integration to:**
|
|
18153
|
+
- Pull stakeholder-reported issues for triage and prioritization
|
|
18154
|
+
- Push approved features as Stories for development tracking
|
|
18155
|
+
- Link decisions to Jira issues for audit trail and traceability
|
|
18156
|
+
- Use JQL queries to review backlog status (e.g. \`project = PROJ AND status = "To Do"\`)`,
|
|
18157
|
+
"tech-lead": `You have the **Jira Integration** skill. You can pull issues from Jira and push Marvin artifacts to Jira.
|
|
18158
|
+
|
|
18159
|
+
**Available tools:**
|
|
18160
|
+
- \`list_jira_issues\` / \`get_jira_issue\` \u2014 browse locally synced Jira issues
|
|
18161
|
+
- \`pull_jira_issue\` / \`pull_jira_issues_jql\` \u2014 import issues from Jira by key or JQL query
|
|
18162
|
+
- \`push_artifact_to_jira\` \u2014 create a Jira issue from a Marvin artifact (decision, action, epic, etc.)
|
|
18163
|
+
- \`sync_jira_issue\` \u2014 bidirectional sync of a local JI-xxx with Jira
|
|
18164
|
+
- \`link_artifact_to_jira\` \u2014 link a Marvin artifact to an existing JI-xxx
|
|
18165
|
+
|
|
18166
|
+
**As Tech Lead, use Jira integration to:**
|
|
18167
|
+
- Pull technical issues and bugs for sprint planning and estimation
|
|
18168
|
+
- Push epics and technical decisions to Jira for cross-team visibility
|
|
18169
|
+
- Bidirectional sync to keep local governance and Jira in alignment
|
|
18170
|
+
- Use JQL queries to track technical debt (e.g. \`labels = "tech-debt" AND status != "Done"\`)`,
|
|
18171
|
+
"delivery-manager": `You have the **Jira Integration** skill. You can pull issues from Jira and push Marvin artifacts to Jira.
|
|
18172
|
+
|
|
18173
|
+
**Available tools:**
|
|
18174
|
+
- \`list_jira_issues\` / \`get_jira_issue\` \u2014 browse locally synced Jira issues
|
|
18175
|
+
- \`pull_jira_issue\` / \`pull_jira_issues_jql\` \u2014 import issues from Jira by key or JQL query
|
|
18176
|
+
- \`push_artifact_to_jira\` \u2014 create a Jira issue from a Marvin artifact (decision, action, etc.)
|
|
18177
|
+
- \`sync_jira_issue\` \u2014 bidirectional sync of a local JI-xxx with Jira
|
|
18178
|
+
- \`link_artifact_to_jira\` \u2014 link a Marvin artifact to an existing JI-xxx
|
|
18179
|
+
|
|
18180
|
+
**As Delivery Manager, use Jira integration to:**
|
|
18181
|
+
- Pull sprint issues for tracking progress and blockers
|
|
18182
|
+
- Push actions and decisions to Jira for stakeholder visibility
|
|
18183
|
+
- Use JQL queries for reporting (e.g. \`sprint in openSprints() AND assignee = currentUser()\`)
|
|
18184
|
+
- Sync status between Marvin governance items and Jira issues`
|
|
18185
|
+
}
|
|
18186
|
+
};
|
|
18187
|
+
|
|
17618
18188
|
// src/skills/registry.ts
|
|
17619
18189
|
var BUILTIN_SKILLS = {
|
|
17620
|
-
"governance-review": governanceReviewSkill
|
|
18190
|
+
"governance-review": governanceReviewSkill,
|
|
18191
|
+
"jira": jiraSkill
|
|
17621
18192
|
};
|
|
17622
18193
|
var GOVERNANCE_TOOL_NAMES = [
|
|
17623
18194
|
"mcp__marvin-governance__list_decisions",
|
|
@@ -17766,6 +18337,16 @@ function resolveSkillsForPersona(personaId, skillsConfig, allSkills) {
|
|
|
17766
18337
|
}
|
|
17767
18338
|
return result;
|
|
17768
18339
|
}
|
|
18340
|
+
function collectSkillRegistrations(skillIds, allSkills) {
|
|
18341
|
+
const registrations = [];
|
|
18342
|
+
for (const id of skillIds) {
|
|
18343
|
+
const skill = allSkills.get(id);
|
|
18344
|
+
if (skill?.documentTypeRegistrations) {
|
|
18345
|
+
registrations.push(...skill.documentTypeRegistrations);
|
|
18346
|
+
}
|
|
18347
|
+
}
|
|
18348
|
+
return registrations;
|
|
18349
|
+
}
|
|
17769
18350
|
function getSkillTools(skillIds, allSkills, store) {
|
|
17770
18351
|
const tools = [];
|
|
17771
18352
|
for (const id of skillIds) {
|
|
@@ -17877,16 +18458,17 @@ ${wildcardPrompt}
|
|
|
17877
18458
|
async function startSession(options) {
|
|
17878
18459
|
const { persona, config: config2, marvinDir, projectRoot } = options;
|
|
17879
18460
|
const plugin = resolvePlugin(config2.project.methodology);
|
|
17880
|
-
const
|
|
17881
|
-
const
|
|
18461
|
+
const pluginRegistrations = plugin?.documentTypeRegistrations ?? [];
|
|
18462
|
+
const allSkills = loadAllSkills(marvinDir);
|
|
18463
|
+
const skillIds = resolveSkillsForPersona(persona.id, config2.project.skills, allSkills);
|
|
18464
|
+
const skillRegistrations = collectSkillRegistrations(skillIds, allSkills);
|
|
18465
|
+
const store = new DocumentStore(marvinDir, [...pluginRegistrations, ...skillRegistrations]);
|
|
17882
18466
|
const sessionStore = new SessionStore(marvinDir);
|
|
17883
18467
|
const sourcesDir = path9.join(marvinDir, "sources");
|
|
17884
18468
|
const hasSourcesDir = fs9.existsSync(sourcesDir);
|
|
17885
18469
|
const manifest = hasSourcesDir ? new SourceManifestManager(marvinDir) : void 0;
|
|
17886
18470
|
const pluginTools = plugin ? getPluginTools(plugin, store, marvinDir) : [];
|
|
17887
18471
|
const pluginPromptFragment = plugin ? getPluginPromptFragment(plugin, persona.id) : void 0;
|
|
17888
|
-
const allSkills = loadAllSkills(marvinDir);
|
|
17889
|
-
const skillIds = resolveSkillsForPersona(persona.id, config2.project.skills, allSkills);
|
|
17890
18472
|
const codeSkillTools = getSkillTools(skillIds, allSkills, store);
|
|
17891
18473
|
const skillAgents = getSkillAgentDefinitions(skillIds, allSkills);
|
|
17892
18474
|
const skillPromptFragment = getSkillPromptFragment(skillIds, allSkills, persona.id);
|
|
@@ -17933,10 +18515,10 @@ Marvin \u2014 ${persona.name}
|
|
|
17933
18515
|
});
|
|
17934
18516
|
try {
|
|
17935
18517
|
while (true) {
|
|
17936
|
-
const
|
|
18518
|
+
const input4 = await new Promise((resolve5) => {
|
|
17937
18519
|
rl.question(chalk2.green("\nYou: "), resolve5);
|
|
17938
18520
|
});
|
|
17939
|
-
const trimmed =
|
|
18521
|
+
const trimmed = input4.trim();
|
|
17940
18522
|
if (trimmed === "exit" || trimmed === "quit") {
|
|
17941
18523
|
break;
|
|
17942
18524
|
}
|
|
@@ -18243,23 +18825,29 @@ Project: ${project.config.name}
|
|
|
18243
18825
|
|
|
18244
18826
|
// src/cli/commands/config.ts
|
|
18245
18827
|
import chalk6 from "chalk";
|
|
18246
|
-
import { password } from "@inquirer/prompts";
|
|
18828
|
+
import { input as input2, password } from "@inquirer/prompts";
|
|
18247
18829
|
async function configCommand(key, value) {
|
|
18248
18830
|
if (key === "api-key") {
|
|
18249
18831
|
return setApiKey();
|
|
18250
18832
|
}
|
|
18833
|
+
if (key === "jira") {
|
|
18834
|
+
return setJira();
|
|
18835
|
+
}
|
|
18251
18836
|
if (!key) {
|
|
18252
18837
|
const config2 = loadUserConfig();
|
|
18253
18838
|
console.log(chalk6.bold("\nUser Configuration:\n"));
|
|
18254
18839
|
console.log(
|
|
18255
|
-
` API Key:
|
|
18840
|
+
` API Key: ${config2.apiKey ? chalk6.green("configured") : chalk6.red("not set")}`
|
|
18256
18841
|
);
|
|
18257
18842
|
console.log(
|
|
18258
|
-
` Default Model:
|
|
18843
|
+
` Default Model: ${config2.defaultModel ?? chalk6.dim("(default: claude-sonnet-4-5-20250929)")}`
|
|
18259
18844
|
);
|
|
18260
18845
|
console.log(
|
|
18261
18846
|
` Default Persona: ${config2.defaultPersona ?? chalk6.dim("(default: product-owner)")}`
|
|
18262
18847
|
);
|
|
18848
|
+
console.log(
|
|
18849
|
+
` Jira: ${config2.jira?.host ? chalk6.green(`configured (${config2.jira.host})`) : chalk6.red("not set")}`
|
|
18850
|
+
);
|
|
18263
18851
|
console.log();
|
|
18264
18852
|
return;
|
|
18265
18853
|
}
|
|
@@ -18292,6 +18880,37 @@ async function configCommand(key, value) {
|
|
|
18292
18880
|
}
|
|
18293
18881
|
}
|
|
18294
18882
|
}
|
|
18883
|
+
async function setJira() {
|
|
18884
|
+
const host = await input2({
|
|
18885
|
+
message: "Jira host (e.g. mycompany.atlassian.net):"
|
|
18886
|
+
});
|
|
18887
|
+
if (!host.trim()) {
|
|
18888
|
+
console.log(chalk6.red("No host provided."));
|
|
18889
|
+
return;
|
|
18890
|
+
}
|
|
18891
|
+
const email3 = await input2({
|
|
18892
|
+
message: "Jira email:"
|
|
18893
|
+
});
|
|
18894
|
+
if (!email3.trim()) {
|
|
18895
|
+
console.log(chalk6.red("No email provided."));
|
|
18896
|
+
return;
|
|
18897
|
+
}
|
|
18898
|
+
const apiToken = await password({
|
|
18899
|
+
message: "Jira API token:"
|
|
18900
|
+
});
|
|
18901
|
+
if (!apiToken.trim()) {
|
|
18902
|
+
console.log(chalk6.red("No API token provided."));
|
|
18903
|
+
return;
|
|
18904
|
+
}
|
|
18905
|
+
const config2 = loadUserConfig();
|
|
18906
|
+
config2.jira = {
|
|
18907
|
+
host: host.trim(),
|
|
18908
|
+
email: email3.trim(),
|
|
18909
|
+
apiToken: apiToken.trim()
|
|
18910
|
+
};
|
|
18911
|
+
saveUserConfig(config2);
|
|
18912
|
+
console.log(chalk6.green("Jira credentials saved."));
|
|
18913
|
+
}
|
|
18295
18914
|
async function setApiKey() {
|
|
18296
18915
|
const apiKey = await password({
|
|
18297
18916
|
message: "Enter your Anthropic API key:"
|
|
@@ -18605,7 +19224,7 @@ ${pending} file${pending === 1 ? "" : "s"} ready to process. Run "marvin ingest
|
|
|
18605
19224
|
// src/cli/commands/sync.ts
|
|
18606
19225
|
import chalk9 from "chalk";
|
|
18607
19226
|
import ora3 from "ora";
|
|
18608
|
-
import { input as
|
|
19227
|
+
import { input as input3 } from "@inquirer/prompts";
|
|
18609
19228
|
|
|
18610
19229
|
// src/git/repository.ts
|
|
18611
19230
|
import * as path12 from "path";
|
|
@@ -18812,7 +19431,7 @@ async function syncInitCommand(opts) {
|
|
|
18812
19431
|
const git = new MarvinGit(project.marvinDir);
|
|
18813
19432
|
let remote = opts.remote;
|
|
18814
19433
|
if (!remote) {
|
|
18815
|
-
remote = await
|
|
19434
|
+
remote = await input3({
|
|
18816
19435
|
message: "Remote repository URL (leave blank to skip):"
|
|
18817
19436
|
}) || void 0;
|
|
18818
19437
|
}
|
|
@@ -18976,7 +19595,7 @@ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
|
18976
19595
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
18977
19596
|
|
|
18978
19597
|
// src/skills/action-tools.ts
|
|
18979
|
-
import { tool as
|
|
19598
|
+
import { tool as tool20 } from "@anthropic-ai/claude-agent-sdk";
|
|
18980
19599
|
|
|
18981
19600
|
// src/skills/action-runner.ts
|
|
18982
19601
|
import { query as query4 } from "@anthropic-ai/claude-agent-sdk";
|
|
@@ -19042,7 +19661,7 @@ function createSkillActionTools(skills, context) {
|
|
|
19042
19661
|
if (!skill.actions) continue;
|
|
19043
19662
|
for (const action of skill.actions) {
|
|
19044
19663
|
tools.push(
|
|
19045
|
-
|
|
19664
|
+
tool20(
|
|
19046
19665
|
`${skill.id}__${action.id}`,
|
|
19047
19666
|
action.description,
|
|
19048
19667
|
{
|
|
@@ -19134,10 +19753,10 @@ ${lines.join("\n\n")}`;
|
|
|
19134
19753
|
}
|
|
19135
19754
|
|
|
19136
19755
|
// src/mcp/persona-tools.ts
|
|
19137
|
-
import { tool as
|
|
19756
|
+
import { tool as tool21 } from "@anthropic-ai/claude-agent-sdk";
|
|
19138
19757
|
function createPersonaTools(ctx, marvinDir) {
|
|
19139
19758
|
return [
|
|
19140
|
-
|
|
19759
|
+
tool21(
|
|
19141
19760
|
"set_persona",
|
|
19142
19761
|
"Set the active persona for this session. Returns full guidance for the selected persona including behavioral rules, allowed document types, and scope. Call this before working to ensure persona-appropriate behavior.",
|
|
19143
19762
|
{
|
|
@@ -19167,7 +19786,7 @@ ${summaries}`
|
|
|
19167
19786
|
};
|
|
19168
19787
|
}
|
|
19169
19788
|
),
|
|
19170
|
-
|
|
19789
|
+
tool21(
|
|
19171
19790
|
"get_persona_guidance",
|
|
19172
19791
|
"Get guidance for a persona without changing the active persona. If no persona is specified, lists all available personas with summaries.",
|
|
19173
19792
|
{
|
|
@@ -19398,20 +20017,23 @@ async function skillsInstallCommand(skillId, options) {
|
|
|
19398
20017
|
console.log(chalk10.red("Please specify a persona with --as <persona>."));
|
|
19399
20018
|
return;
|
|
19400
20019
|
}
|
|
20020
|
+
const targets = persona === "all" ? listPersonas().map((p) => p.id) : [persona];
|
|
19401
20021
|
const config2 = loadProjectConfig(project.marvinDir);
|
|
19402
20022
|
if (!config2.skills) {
|
|
19403
20023
|
config2.skills = {};
|
|
19404
20024
|
}
|
|
19405
|
-
|
|
19406
|
-
config2.skills[
|
|
19407
|
-
|
|
19408
|
-
|
|
19409
|
-
|
|
19410
|
-
|
|
20025
|
+
for (const target of targets) {
|
|
20026
|
+
if (!config2.skills[target]) {
|
|
20027
|
+
config2.skills[target] = [];
|
|
20028
|
+
}
|
|
20029
|
+
if (config2.skills[target].includes(skillId)) {
|
|
20030
|
+
console.log(chalk10.yellow(`Skill "${skillId}" is already assigned to ${target}.`));
|
|
20031
|
+
continue;
|
|
20032
|
+
}
|
|
20033
|
+
config2.skills[target].push(skillId);
|
|
20034
|
+
console.log(chalk10.green(`Assigned skill "${skillId}" to ${target}.`));
|
|
19411
20035
|
}
|
|
19412
|
-
config2.skills[persona].push(skillId);
|
|
19413
20036
|
saveProjectConfig(project.marvinDir, config2);
|
|
19414
|
-
console.log(chalk10.green(`Assigned skill "${skillId}" to ${persona}.`));
|
|
19415
20037
|
}
|
|
19416
20038
|
async function skillsRemoveCommand(skillId, options) {
|
|
19417
20039
|
const project = loadProject();
|
|
@@ -19420,25 +20042,28 @@ async function skillsRemoveCommand(skillId, options) {
|
|
|
19420
20042
|
console.log(chalk10.red("Please specify a persona with --as <persona>."));
|
|
19421
20043
|
return;
|
|
19422
20044
|
}
|
|
20045
|
+
const targets = persona === "all" ? listPersonas().map((p) => p.id) : [persona];
|
|
19423
20046
|
const config2 = loadProjectConfig(project.marvinDir);
|
|
19424
|
-
|
|
19425
|
-
|
|
19426
|
-
|
|
19427
|
-
|
|
19428
|
-
|
|
19429
|
-
|
|
19430
|
-
|
|
19431
|
-
|
|
19432
|
-
|
|
19433
|
-
|
|
19434
|
-
|
|
19435
|
-
|
|
20047
|
+
for (const target of targets) {
|
|
20048
|
+
if (!config2.skills?.[target]) {
|
|
20049
|
+
console.log(chalk10.yellow(`No skills configured for ${target}.`));
|
|
20050
|
+
continue;
|
|
20051
|
+
}
|
|
20052
|
+
const idx = config2.skills[target].indexOf(skillId);
|
|
20053
|
+
if (idx === -1) {
|
|
20054
|
+
console.log(chalk10.yellow(`Skill "${skillId}" is not assigned to ${target}.`));
|
|
20055
|
+
continue;
|
|
20056
|
+
}
|
|
20057
|
+
config2.skills[target].splice(idx, 1);
|
|
20058
|
+
if (config2.skills[target].length === 0) {
|
|
20059
|
+
delete config2.skills[target];
|
|
20060
|
+
}
|
|
20061
|
+
console.log(chalk10.green(`Removed skill "${skillId}" from ${target}.`));
|
|
19436
20062
|
}
|
|
19437
|
-
if (Object.keys(config2.skills).length === 0) {
|
|
20063
|
+
if (config2.skills && Object.keys(config2.skills).length === 0) {
|
|
19438
20064
|
delete config2.skills;
|
|
19439
20065
|
}
|
|
19440
20066
|
saveProjectConfig(project.marvinDir, config2);
|
|
19441
|
-
console.log(chalk10.green(`Removed skill "${skillId}" from ${persona}.`));
|
|
19442
20067
|
}
|
|
19443
20068
|
async function skillsCreateCommand(name) {
|
|
19444
20069
|
const project = loadProject();
|
|
@@ -20685,12 +21310,94 @@ Contribution: ${options.type}`));
|
|
|
20685
21310
|
});
|
|
20686
21311
|
}
|
|
20687
21312
|
|
|
21313
|
+
// src/reports/gar/render-ascii.ts
|
|
21314
|
+
import chalk16 from "chalk";
|
|
21315
|
+
var STATUS_DOT = {
|
|
21316
|
+
green: chalk16.green("\u25CF"),
|
|
21317
|
+
amber: chalk16.yellow("\u25CF"),
|
|
21318
|
+
red: chalk16.red("\u25CF")
|
|
21319
|
+
};
|
|
21320
|
+
var STATUS_LABEL = {
|
|
21321
|
+
green: chalk16.green.bold("GREEN"),
|
|
21322
|
+
amber: chalk16.yellow.bold("AMBER"),
|
|
21323
|
+
red: chalk16.red.bold("RED")
|
|
21324
|
+
};
|
|
21325
|
+
var SEPARATOR = chalk16.dim("\u2500".repeat(60));
|
|
21326
|
+
function renderAscii(report) {
|
|
21327
|
+
const lines = [];
|
|
21328
|
+
lines.push("");
|
|
21329
|
+
lines.push(chalk16.bold(` GAR Report \xB7 ${report.projectName}`));
|
|
21330
|
+
lines.push(chalk16.dim(` ${report.generatedAt}`));
|
|
21331
|
+
lines.push("");
|
|
21332
|
+
lines.push(` Overall: ${STATUS_LABEL[report.overall]}`);
|
|
21333
|
+
lines.push("");
|
|
21334
|
+
lines.push(` ${SEPARATOR}`);
|
|
21335
|
+
for (const area of report.areas) {
|
|
21336
|
+
lines.push(` ${STATUS_DOT[area.status]} ${chalk16.bold(area.name.padEnd(12))} ${area.summary}`);
|
|
21337
|
+
for (const item of area.items) {
|
|
21338
|
+
lines.push(` ${chalk16.dim("\u2514")} ${item.id} ${item.title}`);
|
|
21339
|
+
}
|
|
21340
|
+
}
|
|
21341
|
+
lines.push(` ${SEPARATOR}`);
|
|
21342
|
+
lines.push("");
|
|
21343
|
+
return lines.join("\n");
|
|
21344
|
+
}
|
|
21345
|
+
|
|
21346
|
+
// src/reports/gar/render-confluence.ts
|
|
21347
|
+
var EMOJI = {
|
|
21348
|
+
green: ":green_circle:",
|
|
21349
|
+
amber: ":yellow_circle:",
|
|
21350
|
+
red: ":red_circle:"
|
|
21351
|
+
};
|
|
21352
|
+
function renderConfluence(report) {
|
|
21353
|
+
const lines = [];
|
|
21354
|
+
lines.push(`# GAR Report \u2014 ${report.projectName}`);
|
|
21355
|
+
lines.push("");
|
|
21356
|
+
lines.push(`**Date:** ${report.generatedAt}`);
|
|
21357
|
+
lines.push(`**Overall:** ${EMOJI[report.overall]} ${report.overall.toUpperCase()}`);
|
|
21358
|
+
lines.push("");
|
|
21359
|
+
lines.push("| Area | Status | Summary |");
|
|
21360
|
+
lines.push("|------|--------|---------|");
|
|
21361
|
+
for (const area of report.areas) {
|
|
21362
|
+
lines.push(
|
|
21363
|
+
`| ${area.name} | ${EMOJI[area.status]} ${area.status.toUpperCase()} | ${area.summary} |`
|
|
21364
|
+
);
|
|
21365
|
+
}
|
|
21366
|
+
lines.push("");
|
|
21367
|
+
for (const area of report.areas) {
|
|
21368
|
+
if (area.items.length === 0) continue;
|
|
21369
|
+
lines.push(`## ${area.name}`);
|
|
21370
|
+
lines.push("");
|
|
21371
|
+
for (const item of area.items) {
|
|
21372
|
+
lines.push(`- **${item.id}** ${item.title}`);
|
|
21373
|
+
}
|
|
21374
|
+
lines.push("");
|
|
21375
|
+
}
|
|
21376
|
+
return lines.join("\n");
|
|
21377
|
+
}
|
|
21378
|
+
|
|
21379
|
+
// src/cli/commands/report.ts
|
|
21380
|
+
async function garReportCommand(options) {
|
|
21381
|
+
const project = loadProject();
|
|
21382
|
+
const plugin = resolvePlugin(project.config.methodology);
|
|
21383
|
+
const registrations = plugin?.documentTypeRegistrations ?? [];
|
|
21384
|
+
const store = new DocumentStore(project.marvinDir, registrations);
|
|
21385
|
+
const metrics = collectGarMetrics(store);
|
|
21386
|
+
const report = evaluateGar(project.config.name, metrics);
|
|
21387
|
+
const format = options.format ?? "ascii";
|
|
21388
|
+
if (format === "confluence") {
|
|
21389
|
+
console.log(renderConfluence(report));
|
|
21390
|
+
} else {
|
|
21391
|
+
console.log(renderAscii(report));
|
|
21392
|
+
}
|
|
21393
|
+
}
|
|
21394
|
+
|
|
20688
21395
|
// src/cli/program.ts
|
|
20689
21396
|
function createProgram() {
|
|
20690
21397
|
const program2 = new Command();
|
|
20691
21398
|
program2.name("marvin").description(
|
|
20692
21399
|
"AI-powered product development assistant with Product Owner, Delivery Manager, and Technical Lead personas"
|
|
20693
|
-
).version("0.2.
|
|
21400
|
+
).version("0.2.9");
|
|
20694
21401
|
program2.command("init").description("Initialize a new Marvin project in the current directory").action(async () => {
|
|
20695
21402
|
await initCommand();
|
|
20696
21403
|
});
|
|
@@ -20760,6 +21467,13 @@ function createProgram() {
|
|
|
20760
21467
|
skillsCmd.command("migrate").description("Migrate YAML skill files to SKILL.md directory format").action(async () => {
|
|
20761
21468
|
await skillsMigrateCommand();
|
|
20762
21469
|
});
|
|
21470
|
+
const reportCmd = program2.command("report").description("Generate project reports");
|
|
21471
|
+
reportCmd.command("gar").description("Generate a Green/Amber/Red status report").option(
|
|
21472
|
+
"--format <format>",
|
|
21473
|
+
"Output format: ascii or confluence (default: ascii)"
|
|
21474
|
+
).action(async (options) => {
|
|
21475
|
+
await garReportCommand(options);
|
|
21476
|
+
});
|
|
20763
21477
|
return program2;
|
|
20764
21478
|
}
|
|
20765
21479
|
|