@qlover/fe-release 2.3.5 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (6) hide show
  1. package/dist/cli.cjs +2666 -1005
  2. package/dist/cli.js +2673 -1007
  3. package/dist/index.cjs +3072 -1403
  4. package/dist/index.d.ts +2354 -161
  5. package/dist/index.js +3078 -1404
  6. package/package.json +5 -4
package/dist/cli.js CHANGED
@@ -2877,116 +2877,65 @@ var require_set = __commonJS({
2877
2877
  }
2878
2878
  });
2879
2879
 
2880
- // ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_stackClear.js
2881
- var require_stackClear = __commonJS({
2882
- "../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_stackClear.js"(exports, module) {
2883
- "use strict";
2884
- var ListCache = require_ListCache();
2885
- function stackClear() {
2886
- this.__data__ = new ListCache();
2887
- this.size = 0;
2888
- }
2889
- module.exports = stackClear;
2890
- }
2891
- });
2892
-
2893
- // ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_stackDelete.js
2894
- var require_stackDelete = __commonJS({
2895
- "../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_stackDelete.js"(exports, module) {
2896
- "use strict";
2897
- function stackDelete(key) {
2898
- var data = this.__data__, result = data["delete"](key);
2899
- this.size = data.size;
2900
- return result;
2901
- }
2902
- module.exports = stackDelete;
2903
- }
2904
- });
2905
-
2906
- // ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_stackGet.js
2907
- var require_stackGet = __commonJS({
2908
- "../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_stackGet.js"(exports, module) {
2909
- "use strict";
2910
- function stackGet(key) {
2911
- return this.__data__.get(key);
2912
- }
2913
- module.exports = stackGet;
2914
- }
2915
- });
2916
-
2917
- // ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_stackHas.js
2918
- var require_stackHas = __commonJS({
2919
- "../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_stackHas.js"(exports, module) {
2880
+ // ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseGet.js
2881
+ var require_baseGet = __commonJS({
2882
+ "../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseGet.js"(exports, module) {
2920
2883
  "use strict";
2921
- function stackHas(key) {
2922
- return this.__data__.has(key);
2884
+ var castPath = require_castPath();
2885
+ var toKey = require_toKey();
2886
+ function baseGet(object, path) {
2887
+ path = castPath(path, object);
2888
+ var index = 0, length = path.length;
2889
+ while (object != null && index < length) {
2890
+ object = object[toKey(path[index++])];
2891
+ }
2892
+ return index && index == length ? object : void 0;
2923
2893
  }
2924
- module.exports = stackHas;
2894
+ module.exports = baseGet;
2925
2895
  }
2926
2896
  });
2927
2897
 
2928
- // ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_stackSet.js
2929
- var require_stackSet = __commonJS({
2930
- "../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_stackSet.js"(exports, module) {
2898
+ // ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/get.js
2899
+ var require_get = __commonJS({
2900
+ "../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/get.js"(exports, module) {
2931
2901
  "use strict";
2932
- var ListCache = require_ListCache();
2933
- var Map2 = require_Map();
2934
- var MapCache = require_MapCache();
2935
- var LARGE_ARRAY_SIZE = 200;
2936
- function stackSet(key, value) {
2937
- var data = this.__data__;
2938
- if (data instanceof ListCache) {
2939
- var pairs = data.__data__;
2940
- if (!Map2 || pairs.length < LARGE_ARRAY_SIZE - 1) {
2941
- pairs.push([key, value]);
2942
- this.size = ++data.size;
2943
- return this;
2944
- }
2945
- data = this.__data__ = new MapCache(pairs);
2946
- }
2947
- data.set(key, value);
2948
- this.size = data.size;
2949
- return this;
2902
+ var baseGet = require_baseGet();
2903
+ function get2(object, path, defaultValue) {
2904
+ var result = object == null ? void 0 : baseGet(object, path);
2905
+ return result === void 0 ? defaultValue : result;
2950
2906
  }
2951
- module.exports = stackSet;
2907
+ module.exports = get2;
2952
2908
  }
2953
2909
  });
2954
2910
 
2955
- // ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_Stack.js
2956
- var require_Stack = __commonJS({
2957
- "../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_Stack.js"(exports, module) {
2911
+ // ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isString.js
2912
+ var require_isString = __commonJS({
2913
+ "../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isString.js"(exports, module) {
2958
2914
  "use strict";
2959
- var ListCache = require_ListCache();
2960
- var stackClear = require_stackClear();
2961
- var stackDelete = require_stackDelete();
2962
- var stackGet = require_stackGet();
2963
- var stackHas = require_stackHas();
2964
- var stackSet = require_stackSet();
2965
- function Stack(entries) {
2966
- var data = this.__data__ = new ListCache(entries);
2967
- this.size = data.size;
2915
+ var baseGetTag = require_baseGetTag();
2916
+ var isArray = require_isArray();
2917
+ var isObjectLike = require_isObjectLike();
2918
+ var stringTag = "[object String]";
2919
+ function isString2(value) {
2920
+ return typeof value == "string" || !isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag;
2968
2921
  }
2969
- Stack.prototype.clear = stackClear;
2970
- Stack.prototype["delete"] = stackDelete;
2971
- Stack.prototype.get = stackGet;
2972
- Stack.prototype.has = stackHas;
2973
- Stack.prototype.set = stackSet;
2974
- module.exports = Stack;
2922
+ module.exports = isString2;
2975
2923
  }
2976
2924
  });
2977
2925
 
2978
- // ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_assignMergeValue.js
2979
- var require_assignMergeValue = __commonJS({
2980
- "../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_assignMergeValue.js"(exports, module) {
2926
+ // ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_arrayAggregator.js
2927
+ var require_arrayAggregator = __commonJS({
2928
+ "../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_arrayAggregator.js"(exports, module) {
2981
2929
  "use strict";
2982
- var baseAssignValue = require_baseAssignValue();
2983
- var eq = require_eq2();
2984
- function assignMergeValue(object, key, value) {
2985
- if (value !== void 0 && !eq(object[key], value) || value === void 0 && !(key in object)) {
2986
- baseAssignValue(object, key, value);
2930
+ function arrayAggregator(array, setter, iteratee, accumulator) {
2931
+ var index = -1, length = array == null ? 0 : array.length;
2932
+ while (++index < length) {
2933
+ var value = array[index];
2934
+ setter(accumulator, value, iteratee(value), array);
2987
2935
  }
2936
+ return accumulator;
2988
2937
  }
2989
- module.exports = assignMergeValue;
2938
+ module.exports = arrayAggregator;
2990
2939
  }
2991
2940
  });
2992
2941
 
@@ -3020,154 +2969,18 @@ var require_baseFor = __commonJS({
3020
2969
  }
3021
2970
  });
3022
2971
 
3023
- // ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_cloneBuffer.js
3024
- var require_cloneBuffer = __commonJS({
3025
- "../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_cloneBuffer.js"(exports, module) {
2972
+ // ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseTimes.js
2973
+ var require_baseTimes = __commonJS({
2974
+ "../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseTimes.js"(exports, module) {
3026
2975
  "use strict";
3027
- var root = require_root();
3028
- var freeExports = typeof exports == "object" && exports && !exports.nodeType && exports;
3029
- var freeModule = freeExports && typeof module == "object" && module && !module.nodeType && module;
3030
- var moduleExports = freeModule && freeModule.exports === freeExports;
3031
- var Buffer2 = moduleExports ? root.Buffer : void 0;
3032
- var allocUnsafe = Buffer2 ? Buffer2.allocUnsafe : void 0;
3033
- function cloneBuffer(buffer, isDeep) {
3034
- if (isDeep) {
3035
- return buffer.slice();
2976
+ function baseTimes(n, iteratee) {
2977
+ var index = -1, result = Array(n);
2978
+ while (++index < n) {
2979
+ result[index] = iteratee(index);
3036
2980
  }
3037
- var length = buffer.length, result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
3038
- buffer.copy(result);
3039
2981
  return result;
3040
2982
  }
3041
- module.exports = cloneBuffer;
3042
- }
3043
- });
3044
-
3045
- // ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_Uint8Array.js
3046
- var require_Uint8Array = __commonJS({
3047
- "../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_Uint8Array.js"(exports, module) {
3048
- "use strict";
3049
- var root = require_root();
3050
- var Uint8Array2 = root.Uint8Array;
3051
- module.exports = Uint8Array2;
3052
- }
3053
- });
3054
-
3055
- // ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_cloneArrayBuffer.js
3056
- var require_cloneArrayBuffer = __commonJS({
3057
- "../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_cloneArrayBuffer.js"(exports, module) {
3058
- "use strict";
3059
- var Uint8Array2 = require_Uint8Array();
3060
- function cloneArrayBuffer(arrayBuffer) {
3061
- var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
3062
- new Uint8Array2(result).set(new Uint8Array2(arrayBuffer));
3063
- return result;
3064
- }
3065
- module.exports = cloneArrayBuffer;
3066
- }
3067
- });
3068
-
3069
- // ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_cloneTypedArray.js
3070
- var require_cloneTypedArray = __commonJS({
3071
- "../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_cloneTypedArray.js"(exports, module) {
3072
- "use strict";
3073
- var cloneArrayBuffer = require_cloneArrayBuffer();
3074
- function cloneTypedArray(typedArray, isDeep) {
3075
- var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
3076
- return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
3077
- }
3078
- module.exports = cloneTypedArray;
3079
- }
3080
- });
3081
-
3082
- // ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_copyArray.js
3083
- var require_copyArray = __commonJS({
3084
- "../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_copyArray.js"(exports, module) {
3085
- "use strict";
3086
- function copyArray(source, array) {
3087
- var index = -1, length = source.length;
3088
- array || (array = Array(length));
3089
- while (++index < length) {
3090
- array[index] = source[index];
3091
- }
3092
- return array;
3093
- }
3094
- module.exports = copyArray;
3095
- }
3096
- });
3097
-
3098
- // ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseCreate.js
3099
- var require_baseCreate = __commonJS({
3100
- "../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseCreate.js"(exports, module) {
3101
- "use strict";
3102
- var isObject = require_isObject();
3103
- var objectCreate = Object.create;
3104
- var baseCreate = /* @__PURE__ */ function() {
3105
- function object() {
3106
- }
3107
- return function(proto) {
3108
- if (!isObject(proto)) {
3109
- return {};
3110
- }
3111
- if (objectCreate) {
3112
- return objectCreate(proto);
3113
- }
3114
- object.prototype = proto;
3115
- var result = new object();
3116
- object.prototype = void 0;
3117
- return result;
3118
- };
3119
- }();
3120
- module.exports = baseCreate;
3121
- }
3122
- });
3123
-
3124
- // ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_overArg.js
3125
- var require_overArg = __commonJS({
3126
- "../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_overArg.js"(exports, module) {
3127
- "use strict";
3128
- function overArg(func, transform) {
3129
- return function(arg) {
3130
- return func(transform(arg));
3131
- };
3132
- }
3133
- module.exports = overArg;
3134
- }
3135
- });
3136
-
3137
- // ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_getPrototype.js
3138
- var require_getPrototype = __commonJS({
3139
- "../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_getPrototype.js"(exports, module) {
3140
- "use strict";
3141
- var overArg = require_overArg();
3142
- var getPrototype = overArg(Object.getPrototypeOf, Object);
3143
- module.exports = getPrototype;
3144
- }
3145
- });
3146
-
3147
- // ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_isPrototype.js
3148
- var require_isPrototype = __commonJS({
3149
- "../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_isPrototype.js"(exports, module) {
3150
- "use strict";
3151
- var objectProto = Object.prototype;
3152
- function isPrototype(value) {
3153
- var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto;
3154
- return value === proto;
3155
- }
3156
- module.exports = isPrototype;
3157
- }
3158
- });
3159
-
3160
- // ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_initCloneObject.js
3161
- var require_initCloneObject = __commonJS({
3162
- "../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_initCloneObject.js"(exports, module) {
3163
- "use strict";
3164
- var baseCreate = require_baseCreate();
3165
- var getPrototype = require_getPrototype();
3166
- var isPrototype = require_isPrototype();
3167
- function initCloneObject(object) {
3168
- return typeof object.constructor == "function" && !isPrototype(object) ? baseCreate(getPrototype(object)) : {};
3169
- }
3170
- module.exports = initCloneObject;
2983
+ module.exports = baseTimes;
3171
2984
  }
3172
2985
  });
3173
2986
 
@@ -3203,44 +3016,6 @@ var require_isArguments = __commonJS({
3203
3016
  }
3204
3017
  });
3205
3018
 
3206
- // ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isLength.js
3207
- var require_isLength = __commonJS({
3208
- "../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isLength.js"(exports, module) {
3209
- "use strict";
3210
- var MAX_SAFE_INTEGER = 9007199254740991;
3211
- function isLength(value) {
3212
- return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
3213
- }
3214
- module.exports = isLength;
3215
- }
3216
- });
3217
-
3218
- // ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isArrayLike.js
3219
- var require_isArrayLike = __commonJS({
3220
- "../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isArrayLike.js"(exports, module) {
3221
- "use strict";
3222
- var isFunction = require_isFunction();
3223
- var isLength = require_isLength();
3224
- function isArrayLike(value) {
3225
- return value != null && isLength(value.length) && !isFunction(value);
3226
- }
3227
- module.exports = isArrayLike;
3228
- }
3229
- });
3230
-
3231
- // ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isArrayLikeObject.js
3232
- var require_isArrayLikeObject = __commonJS({
3233
- "../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isArrayLikeObject.js"(exports, module) {
3234
- "use strict";
3235
- var isArrayLike = require_isArrayLike();
3236
- var isObjectLike = require_isObjectLike();
3237
- function isArrayLikeObject(value) {
3238
- return isObjectLike(value) && isArrayLike(value);
3239
- }
3240
- module.exports = isArrayLikeObject;
3241
- }
3242
- });
3243
-
3244
3019
  // ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/stubFalse.js
3245
3020
  var require_stubFalse = __commonJS({
3246
3021
  "../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/stubFalse.js"(exports, module) {
@@ -3268,31 +3043,15 @@ var require_isBuffer = __commonJS({
3268
3043
  }
3269
3044
  });
3270
3045
 
3271
- // ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isPlainObject.js
3272
- var require_isPlainObject = __commonJS({
3273
- "../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isPlainObject.js"(exports, module) {
3046
+ // ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isLength.js
3047
+ var require_isLength = __commonJS({
3048
+ "../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isLength.js"(exports, module) {
3274
3049
  "use strict";
3275
- var baseGetTag = require_baseGetTag();
3276
- var getPrototype = require_getPrototype();
3277
- var isObjectLike = require_isObjectLike();
3278
- var objectTag = "[object Object]";
3279
- var funcProto = Function.prototype;
3280
- var objectProto = Object.prototype;
3281
- var funcToString = funcProto.toString;
3282
- var hasOwnProperty = objectProto.hasOwnProperty;
3283
- var objectCtorString = funcToString.call(Object);
3284
- function isPlainObject(value) {
3285
- if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
3286
- return false;
3287
- }
3288
- var proto = getPrototype(value);
3289
- if (proto === null) {
3290
- return true;
3291
- }
3292
- var Ctor = hasOwnProperty.call(proto, "constructor") && proto.constructor;
3293
- return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString;
3050
+ var MAX_SAFE_INTEGER = 9007199254740991;
3051
+ function isLength(value) {
3052
+ return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
3294
3053
  }
3295
- module.exports = isPlainObject;
3054
+ module.exports = isLength;
3296
3055
  }
3297
3056
  });
3298
3057
 
@@ -3386,66 +3145,6 @@ var require_isTypedArray = __commonJS({
3386
3145
  }
3387
3146
  });
3388
3147
 
3389
- // ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_safeGet.js
3390
- var require_safeGet = __commonJS({
3391
- "../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_safeGet.js"(exports, module) {
3392
- "use strict";
3393
- function safeGet(object, key) {
3394
- if (key === "constructor" && typeof object[key] === "function") {
3395
- return;
3396
- }
3397
- if (key == "__proto__") {
3398
- return;
3399
- }
3400
- return object[key];
3401
- }
3402
- module.exports = safeGet;
3403
- }
3404
- });
3405
-
3406
- // ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_copyObject.js
3407
- var require_copyObject = __commonJS({
3408
- "../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_copyObject.js"(exports, module) {
3409
- "use strict";
3410
- var assignValue = require_assignValue();
3411
- var baseAssignValue = require_baseAssignValue();
3412
- function copyObject(source, props, object, customizer) {
3413
- var isNew = !object;
3414
- object || (object = {});
3415
- var index = -1, length = props.length;
3416
- while (++index < length) {
3417
- var key = props[index];
3418
- var newValue = customizer ? customizer(object[key], source[key], key, object, source) : void 0;
3419
- if (newValue === void 0) {
3420
- newValue = source[key];
3421
- }
3422
- if (isNew) {
3423
- baseAssignValue(object, key, newValue);
3424
- } else {
3425
- assignValue(object, key, newValue);
3426
- }
3427
- }
3428
- return object;
3429
- }
3430
- module.exports = copyObject;
3431
- }
3432
- });
3433
-
3434
- // ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseTimes.js
3435
- var require_baseTimes = __commonJS({
3436
- "../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseTimes.js"(exports, module) {
3437
- "use strict";
3438
- function baseTimes(n, iteratee) {
3439
- var index = -1, result = Array(n);
3440
- while (++index < n) {
3441
- result[index] = iteratee(index);
3442
- }
3443
- return result;
3444
- }
3445
- module.exports = baseTimes;
3446
- }
3447
- });
3448
-
3449
3148
  // ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_arrayLikeKeys.js
3450
3149
  var require_arrayLikeKeys = __commonJS({
3451
3150
  "../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_arrayLikeKeys.js"(exports, module) {
@@ -3462,449 +3161,42 @@ var require_arrayLikeKeys = __commonJS({
3462
3161
  var isArr = isArray(value), isArg = !isArr && isArguments(value), isBuff = !isArr && !isArg && isBuffer(value), isType = !isArr && !isArg && !isBuff && isTypedArray(value), skipIndexes = isArr || isArg || isBuff || isType, result = skipIndexes ? baseTimes(value.length, String) : [], length = result.length;
3463
3162
  for (var key in value) {
3464
3163
  if ((inherited || hasOwnProperty.call(value, key)) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode.
3465
- (key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
3466
- isBuff && (key == "offset" || key == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
3467
- isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties.
3468
- isIndex(key, length)))) {
3469
- result.push(key);
3470
- }
3471
- }
3472
- return result;
3473
- }
3474
- module.exports = arrayLikeKeys;
3475
- }
3476
- });
3477
-
3478
- // ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_nativeKeysIn.js
3479
- var require_nativeKeysIn = __commonJS({
3480
- "../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_nativeKeysIn.js"(exports, module) {
3481
- "use strict";
3482
- function nativeKeysIn(object) {
3483
- var result = [];
3484
- if (object != null) {
3485
- for (var key in Object(object)) {
3486
- result.push(key);
3487
- }
3488
- }
3489
- return result;
3490
- }
3491
- module.exports = nativeKeysIn;
3492
- }
3493
- });
3494
-
3495
- // ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseKeysIn.js
3496
- var require_baseKeysIn = __commonJS({
3497
- "../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseKeysIn.js"(exports, module) {
3498
- "use strict";
3499
- var isObject = require_isObject();
3500
- var isPrototype = require_isPrototype();
3501
- var nativeKeysIn = require_nativeKeysIn();
3502
- var objectProto = Object.prototype;
3503
- var hasOwnProperty = objectProto.hasOwnProperty;
3504
- function baseKeysIn(object) {
3505
- if (!isObject(object)) {
3506
- return nativeKeysIn(object);
3507
- }
3508
- var isProto = isPrototype(object), result = [];
3509
- for (var key in object) {
3510
- if (!(key == "constructor" && (isProto || !hasOwnProperty.call(object, key)))) {
3511
- result.push(key);
3512
- }
3513
- }
3514
- return result;
3515
- }
3516
- module.exports = baseKeysIn;
3517
- }
3518
- });
3519
-
3520
- // ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/keysIn.js
3521
- var require_keysIn = __commonJS({
3522
- "../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/keysIn.js"(exports, module) {
3523
- "use strict";
3524
- var arrayLikeKeys = require_arrayLikeKeys();
3525
- var baseKeysIn = require_baseKeysIn();
3526
- var isArrayLike = require_isArrayLike();
3527
- function keysIn(object) {
3528
- return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
3529
- }
3530
- module.exports = keysIn;
3531
- }
3532
- });
3533
-
3534
- // ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/toPlainObject.js
3535
- var require_toPlainObject = __commonJS({
3536
- "../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/toPlainObject.js"(exports, module) {
3537
- "use strict";
3538
- var copyObject = require_copyObject();
3539
- var keysIn = require_keysIn();
3540
- function toPlainObject(value) {
3541
- return copyObject(value, keysIn(value));
3542
- }
3543
- module.exports = toPlainObject;
3544
- }
3545
- });
3546
-
3547
- // ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseMergeDeep.js
3548
- var require_baseMergeDeep = __commonJS({
3549
- "../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseMergeDeep.js"(exports, module) {
3550
- "use strict";
3551
- var assignMergeValue = require_assignMergeValue();
3552
- var cloneBuffer = require_cloneBuffer();
3553
- var cloneTypedArray = require_cloneTypedArray();
3554
- var copyArray = require_copyArray();
3555
- var initCloneObject = require_initCloneObject();
3556
- var isArguments = require_isArguments();
3557
- var isArray = require_isArray();
3558
- var isArrayLikeObject = require_isArrayLikeObject();
3559
- var isBuffer = require_isBuffer();
3560
- var isFunction = require_isFunction();
3561
- var isObject = require_isObject();
3562
- var isPlainObject = require_isPlainObject();
3563
- var isTypedArray = require_isTypedArray();
3564
- var safeGet = require_safeGet();
3565
- var toPlainObject = require_toPlainObject();
3566
- function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
3567
- var objValue = safeGet(object, key), srcValue = safeGet(source, key), stacked = stack.get(srcValue);
3568
- if (stacked) {
3569
- assignMergeValue(object, key, stacked);
3570
- return;
3571
- }
3572
- var newValue = customizer ? customizer(objValue, srcValue, key + "", object, source, stack) : void 0;
3573
- var isCommon = newValue === void 0;
3574
- if (isCommon) {
3575
- var isArr = isArray(srcValue), isBuff = !isArr && isBuffer(srcValue), isTyped = !isArr && !isBuff && isTypedArray(srcValue);
3576
- newValue = srcValue;
3577
- if (isArr || isBuff || isTyped) {
3578
- if (isArray(objValue)) {
3579
- newValue = objValue;
3580
- } else if (isArrayLikeObject(objValue)) {
3581
- newValue = copyArray(objValue);
3582
- } else if (isBuff) {
3583
- isCommon = false;
3584
- newValue = cloneBuffer(srcValue, true);
3585
- } else if (isTyped) {
3586
- isCommon = false;
3587
- newValue = cloneTypedArray(srcValue, true);
3588
- } else {
3589
- newValue = [];
3590
- }
3591
- } else if (isPlainObject(srcValue) || isArguments(srcValue)) {
3592
- newValue = objValue;
3593
- if (isArguments(objValue)) {
3594
- newValue = toPlainObject(objValue);
3595
- } else if (!isObject(objValue) || isFunction(objValue)) {
3596
- newValue = initCloneObject(srcValue);
3597
- }
3598
- } else {
3599
- isCommon = false;
3600
- }
3601
- }
3602
- if (isCommon) {
3603
- stack.set(srcValue, newValue);
3604
- mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
3605
- stack["delete"](srcValue);
3606
- }
3607
- assignMergeValue(object, key, newValue);
3608
- }
3609
- module.exports = baseMergeDeep;
3610
- }
3611
- });
3612
-
3613
- // ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseMerge.js
3614
- var require_baseMerge = __commonJS({
3615
- "../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseMerge.js"(exports, module) {
3616
- "use strict";
3617
- var Stack = require_Stack();
3618
- var assignMergeValue = require_assignMergeValue();
3619
- var baseFor = require_baseFor();
3620
- var baseMergeDeep = require_baseMergeDeep();
3621
- var isObject = require_isObject();
3622
- var keysIn = require_keysIn();
3623
- var safeGet = require_safeGet();
3624
- function baseMerge(object, source, srcIndex, customizer, stack) {
3625
- if (object === source) {
3626
- return;
3627
- }
3628
- baseFor(source, function(srcValue, key) {
3629
- stack || (stack = new Stack());
3630
- if (isObject(srcValue)) {
3631
- baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
3632
- } else {
3633
- var newValue = customizer ? customizer(safeGet(object, key), srcValue, key + "", object, source, stack) : void 0;
3634
- if (newValue === void 0) {
3635
- newValue = srcValue;
3636
- }
3637
- assignMergeValue(object, key, newValue);
3638
- }
3639
- }, keysIn);
3640
- }
3641
- module.exports = baseMerge;
3642
- }
3643
- });
3644
-
3645
- // ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/identity.js
3646
- var require_identity = __commonJS({
3647
- "../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/identity.js"(exports, module) {
3648
- "use strict";
3649
- function identity(value) {
3650
- return value;
3651
- }
3652
- module.exports = identity;
3653
- }
3654
- });
3655
-
3656
- // ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_apply.js
3657
- var require_apply = __commonJS({
3658
- "../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_apply.js"(exports, module) {
3659
- "use strict";
3660
- function apply(func, thisArg, args) {
3661
- switch (args.length) {
3662
- case 0:
3663
- return func.call(thisArg);
3664
- case 1:
3665
- return func.call(thisArg, args[0]);
3666
- case 2:
3667
- return func.call(thisArg, args[0], args[1]);
3668
- case 3:
3669
- return func.call(thisArg, args[0], args[1], args[2]);
3670
- }
3671
- return func.apply(thisArg, args);
3672
- }
3673
- module.exports = apply;
3674
- }
3675
- });
3676
-
3677
- // ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_overRest.js
3678
- var require_overRest = __commonJS({
3679
- "../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_overRest.js"(exports, module) {
3680
- "use strict";
3681
- var apply = require_apply();
3682
- var nativeMax = Math.max;
3683
- function overRest(func, start, transform) {
3684
- start = nativeMax(start === void 0 ? func.length - 1 : start, 0);
3685
- return function() {
3686
- var args = arguments, index = -1, length = nativeMax(args.length - start, 0), array = Array(length);
3687
- while (++index < length) {
3688
- array[index] = args[start + index];
3689
- }
3690
- index = -1;
3691
- var otherArgs = Array(start + 1);
3692
- while (++index < start) {
3693
- otherArgs[index] = args[index];
3694
- }
3695
- otherArgs[start] = transform(array);
3696
- return apply(func, this, otherArgs);
3697
- };
3698
- }
3699
- module.exports = overRest;
3700
- }
3701
- });
3702
-
3703
- // ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/constant.js
3704
- var require_constant = __commonJS({
3705
- "../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/constant.js"(exports, module) {
3706
- "use strict";
3707
- function constant(value) {
3708
- return function() {
3709
- return value;
3710
- };
3711
- }
3712
- module.exports = constant;
3713
- }
3714
- });
3715
-
3716
- // ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseSetToString.js
3717
- var require_baseSetToString = __commonJS({
3718
- "../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseSetToString.js"(exports, module) {
3719
- "use strict";
3720
- var constant = require_constant();
3721
- var defineProperty = require_defineProperty();
3722
- var identity = require_identity();
3723
- var baseSetToString = !defineProperty ? identity : function(func, string) {
3724
- return defineProperty(func, "toString", {
3725
- "configurable": true,
3726
- "enumerable": false,
3727
- "value": constant(string),
3728
- "writable": true
3729
- });
3730
- };
3731
- module.exports = baseSetToString;
3732
- }
3733
- });
3734
-
3735
- // ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_shortOut.js
3736
- var require_shortOut = __commonJS({
3737
- "../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_shortOut.js"(exports, module) {
3738
- "use strict";
3739
- var HOT_COUNT = 800;
3740
- var HOT_SPAN = 16;
3741
- var nativeNow = Date.now;
3742
- function shortOut(func) {
3743
- var count = 0, lastCalled = 0;
3744
- return function() {
3745
- var stamp = nativeNow(), remaining = HOT_SPAN - (stamp - lastCalled);
3746
- lastCalled = stamp;
3747
- if (remaining > 0) {
3748
- if (++count >= HOT_COUNT) {
3749
- return arguments[0];
3750
- }
3751
- } else {
3752
- count = 0;
3753
- }
3754
- return func.apply(void 0, arguments);
3755
- };
3756
- }
3757
- module.exports = shortOut;
3758
- }
3759
- });
3760
-
3761
- // ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_setToString.js
3762
- var require_setToString = __commonJS({
3763
- "../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_setToString.js"(exports, module) {
3764
- "use strict";
3765
- var baseSetToString = require_baseSetToString();
3766
- var shortOut = require_shortOut();
3767
- var setToString = shortOut(baseSetToString);
3768
- module.exports = setToString;
3769
- }
3770
- });
3771
-
3772
- // ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseRest.js
3773
- var require_baseRest = __commonJS({
3774
- "../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseRest.js"(exports, module) {
3775
- "use strict";
3776
- var identity = require_identity();
3777
- var overRest = require_overRest();
3778
- var setToString = require_setToString();
3779
- function baseRest(func, start) {
3780
- return setToString(overRest(func, start, identity), func + "");
3781
- }
3782
- module.exports = baseRest;
3783
- }
3784
- });
3785
-
3786
- // ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_isIterateeCall.js
3787
- var require_isIterateeCall = __commonJS({
3788
- "../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_isIterateeCall.js"(exports, module) {
3789
- "use strict";
3790
- var eq = require_eq2();
3791
- var isArrayLike = require_isArrayLike();
3792
- var isIndex = require_isIndex();
3793
- var isObject = require_isObject();
3794
- function isIterateeCall(value, index, object) {
3795
- if (!isObject(object)) {
3796
- return false;
3797
- }
3798
- var type = typeof index;
3799
- if (type == "number" ? isArrayLike(object) && isIndex(index, object.length) : type == "string" && index in object) {
3800
- return eq(object[index], value);
3801
- }
3802
- return false;
3803
- }
3804
- module.exports = isIterateeCall;
3805
- }
3806
- });
3807
-
3808
- // ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_createAssigner.js
3809
- var require_createAssigner = __commonJS({
3810
- "../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_createAssigner.js"(exports, module) {
3811
- "use strict";
3812
- var baseRest = require_baseRest();
3813
- var isIterateeCall = require_isIterateeCall();
3814
- function createAssigner(assigner) {
3815
- return baseRest(function(object, sources) {
3816
- var index = -1, length = sources.length, customizer = length > 1 ? sources[length - 1] : void 0, guard = length > 2 ? sources[2] : void 0;
3817
- customizer = assigner.length > 3 && typeof customizer == "function" ? (length--, customizer) : void 0;
3818
- if (guard && isIterateeCall(sources[0], sources[1], guard)) {
3819
- customizer = length < 3 ? void 0 : customizer;
3820
- length = 1;
3821
- }
3822
- object = Object(object);
3823
- while (++index < length) {
3824
- var source = sources[index];
3825
- if (source) {
3826
- assigner(object, source, index, customizer);
3827
- }
3828
- }
3829
- return object;
3830
- });
3831
- }
3832
- module.exports = createAssigner;
3833
- }
3834
- });
3835
-
3836
- // ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/merge.js
3837
- var require_merge = __commonJS({
3838
- "../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/merge.js"(exports, module) {
3839
- "use strict";
3840
- var baseMerge = require_baseMerge();
3841
- var createAssigner = require_createAssigner();
3842
- var merge3 = createAssigner(function(object, source, srcIndex) {
3843
- baseMerge(object, source, srcIndex);
3844
- });
3845
- module.exports = merge3;
3846
- }
3847
- });
3848
-
3849
- // ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseGet.js
3850
- var require_baseGet = __commonJS({
3851
- "../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseGet.js"(exports, module) {
3852
- "use strict";
3853
- var castPath = require_castPath();
3854
- var toKey = require_toKey();
3855
- function baseGet(object, path) {
3856
- path = castPath(path, object);
3857
- var index = 0, length = path.length;
3858
- while (object != null && index < length) {
3859
- object = object[toKey(path[index++])];
3164
+ (key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
3165
+ isBuff && (key == "offset" || key == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
3166
+ isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties.
3167
+ isIndex(key, length)))) {
3168
+ result.push(key);
3169
+ }
3860
3170
  }
3861
- return index && index == length ? object : void 0;
3862
- }
3863
- module.exports = baseGet;
3864
- }
3865
- });
3866
-
3867
- // ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/get.js
3868
- var require_get = __commonJS({
3869
- "../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/get.js"(exports, module) {
3870
- "use strict";
3871
- var baseGet = require_baseGet();
3872
- function get3(object, path, defaultValue) {
3873
- var result = object == null ? void 0 : baseGet(object, path);
3874
- return result === void 0 ? defaultValue : result;
3171
+ return result;
3875
3172
  }
3876
- module.exports = get3;
3173
+ module.exports = arrayLikeKeys;
3877
3174
  }
3878
3175
  });
3879
3176
 
3880
- // ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isString.js
3881
- var require_isString = __commonJS({
3882
- "../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isString.js"(exports, module) {
3177
+ // ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_isPrototype.js
3178
+ var require_isPrototype = __commonJS({
3179
+ "../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_isPrototype.js"(exports, module) {
3883
3180
  "use strict";
3884
- var baseGetTag = require_baseGetTag();
3885
- var isArray = require_isArray();
3886
- var isObjectLike = require_isObjectLike();
3887
- var stringTag = "[object String]";
3888
- function isString2(value) {
3889
- return typeof value == "string" || !isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag;
3181
+ var objectProto = Object.prototype;
3182
+ function isPrototype(value) {
3183
+ var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto;
3184
+ return value === proto;
3890
3185
  }
3891
- module.exports = isString2;
3186
+ module.exports = isPrototype;
3892
3187
  }
3893
3188
  });
3894
3189
 
3895
- // ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_arrayAggregator.js
3896
- var require_arrayAggregator = __commonJS({
3897
- "../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_arrayAggregator.js"(exports, module) {
3190
+ // ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_overArg.js
3191
+ var require_overArg = __commonJS({
3192
+ "../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_overArg.js"(exports, module) {
3898
3193
  "use strict";
3899
- function arrayAggregator(array, setter, iteratee, accumulator) {
3900
- var index = -1, length = array == null ? 0 : array.length;
3901
- while (++index < length) {
3902
- var value = array[index];
3903
- setter(accumulator, value, iteratee(value), array);
3904
- }
3905
- return accumulator;
3194
+ function overArg(func, transform) {
3195
+ return function(arg) {
3196
+ return func(transform(arg));
3197
+ };
3906
3198
  }
3907
- module.exports = arrayAggregator;
3199
+ module.exports = overArg;
3908
3200
  }
3909
3201
  });
3910
3202
 
@@ -3942,6 +3234,19 @@ var require_baseKeys = __commonJS({
3942
3234
  }
3943
3235
  });
3944
3236
 
3237
+ // ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isArrayLike.js
3238
+ var require_isArrayLike = __commonJS({
3239
+ "../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isArrayLike.js"(exports, module) {
3240
+ "use strict";
3241
+ var isFunction = require_isFunction();
3242
+ var isLength = require_isLength();
3243
+ function isArrayLike(value) {
3244
+ return value != null && isLength(value.length) && !isFunction(value);
3245
+ }
3246
+ module.exports = isArrayLike;
3247
+ }
3248
+ });
3249
+
3945
3250
  // ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/keys.js
3946
3251
  var require_keys = __commonJS({
3947
3252
  "../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/keys.js"(exports, module) {
@@ -4021,6 +3326,104 @@ var require_baseAggregator = __commonJS({
4021
3326
  }
4022
3327
  });
4023
3328
 
3329
+ // ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_stackClear.js
3330
+ var require_stackClear = __commonJS({
3331
+ "../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_stackClear.js"(exports, module) {
3332
+ "use strict";
3333
+ var ListCache = require_ListCache();
3334
+ function stackClear() {
3335
+ this.__data__ = new ListCache();
3336
+ this.size = 0;
3337
+ }
3338
+ module.exports = stackClear;
3339
+ }
3340
+ });
3341
+
3342
+ // ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_stackDelete.js
3343
+ var require_stackDelete = __commonJS({
3344
+ "../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_stackDelete.js"(exports, module) {
3345
+ "use strict";
3346
+ function stackDelete(key) {
3347
+ var data = this.__data__, result = data["delete"](key);
3348
+ this.size = data.size;
3349
+ return result;
3350
+ }
3351
+ module.exports = stackDelete;
3352
+ }
3353
+ });
3354
+
3355
+ // ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_stackGet.js
3356
+ var require_stackGet = __commonJS({
3357
+ "../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_stackGet.js"(exports, module) {
3358
+ "use strict";
3359
+ function stackGet(key) {
3360
+ return this.__data__.get(key);
3361
+ }
3362
+ module.exports = stackGet;
3363
+ }
3364
+ });
3365
+
3366
+ // ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_stackHas.js
3367
+ var require_stackHas = __commonJS({
3368
+ "../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_stackHas.js"(exports, module) {
3369
+ "use strict";
3370
+ function stackHas(key) {
3371
+ return this.__data__.has(key);
3372
+ }
3373
+ module.exports = stackHas;
3374
+ }
3375
+ });
3376
+
3377
+ // ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_stackSet.js
3378
+ var require_stackSet = __commonJS({
3379
+ "../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_stackSet.js"(exports, module) {
3380
+ "use strict";
3381
+ var ListCache = require_ListCache();
3382
+ var Map2 = require_Map();
3383
+ var MapCache = require_MapCache();
3384
+ var LARGE_ARRAY_SIZE = 200;
3385
+ function stackSet(key, value) {
3386
+ var data = this.__data__;
3387
+ if (data instanceof ListCache) {
3388
+ var pairs = data.__data__;
3389
+ if (!Map2 || pairs.length < LARGE_ARRAY_SIZE - 1) {
3390
+ pairs.push([key, value]);
3391
+ this.size = ++data.size;
3392
+ return this;
3393
+ }
3394
+ data = this.__data__ = new MapCache(pairs);
3395
+ }
3396
+ data.set(key, value);
3397
+ this.size = data.size;
3398
+ return this;
3399
+ }
3400
+ module.exports = stackSet;
3401
+ }
3402
+ });
3403
+
3404
+ // ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_Stack.js
3405
+ var require_Stack = __commonJS({
3406
+ "../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_Stack.js"(exports, module) {
3407
+ "use strict";
3408
+ var ListCache = require_ListCache();
3409
+ var stackClear = require_stackClear();
3410
+ var stackDelete = require_stackDelete();
3411
+ var stackGet = require_stackGet();
3412
+ var stackHas = require_stackHas();
3413
+ var stackSet = require_stackSet();
3414
+ function Stack(entries) {
3415
+ var data = this.__data__ = new ListCache(entries);
3416
+ this.size = data.size;
3417
+ }
3418
+ Stack.prototype.clear = stackClear;
3419
+ Stack.prototype["delete"] = stackDelete;
3420
+ Stack.prototype.get = stackGet;
3421
+ Stack.prototype.has = stackHas;
3422
+ Stack.prototype.set = stackSet;
3423
+ module.exports = Stack;
3424
+ }
3425
+ });
3426
+
4024
3427
  // ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_setCacheAdd.js
4025
3428
  var require_setCacheAdd = __commonJS({
4026
3429
  "../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_setCacheAdd.js"(exports, module) {
@@ -4149,6 +3552,16 @@ var require_equalArrays = __commonJS({
4149
3552
  }
4150
3553
  });
4151
3554
 
3555
+ // ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_Uint8Array.js
3556
+ var require_Uint8Array = __commonJS({
3557
+ "../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_Uint8Array.js"(exports, module) {
3558
+ "use strict";
3559
+ var root = require_root();
3560
+ var Uint8Array2 = root.Uint8Array;
3561
+ module.exports = Uint8Array2;
3562
+ }
3563
+ });
3564
+
4152
3565
  // ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_mapToArray.js
4153
3566
  var require_mapToArray = __commonJS({
4154
3567
  "../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_mapToArray.js"(exports, module) {
@@ -4733,7 +4146,7 @@ var require_baseMatchesProperty = __commonJS({
4733
4146
  "../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseMatchesProperty.js"(exports, module) {
4734
4147
  "use strict";
4735
4148
  var baseIsEqual = require_baseIsEqual();
4736
- var get3 = require_get();
4149
+ var get2 = require_get();
4737
4150
  var hasIn = require_hasIn();
4738
4151
  var isKey = require_isKey();
4739
4152
  var isStrictComparable = require_isStrictComparable();
@@ -4746,7 +4159,7 @@ var require_baseMatchesProperty = __commonJS({
4746
4159
  return matchesStrictComparable(toKey(path), srcValue);
4747
4160
  }
4748
4161
  return function(object) {
4749
- var objValue = get3(object, path);
4162
+ var objValue = get2(object, path);
4750
4163
  return objValue === void 0 && objValue === srcValue ? hasIn(object, path) : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
4751
4164
  };
4752
4165
  }
@@ -4754,6 +4167,17 @@ var require_baseMatchesProperty = __commonJS({
4754
4167
  }
4755
4168
  });
4756
4169
 
4170
+ // ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/identity.js
4171
+ var require_identity = __commonJS({
4172
+ "../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/identity.js"(exports, module) {
4173
+ "use strict";
4174
+ function identity(value) {
4175
+ return value;
4176
+ }
4177
+ module.exports = identity;
4178
+ }
4179
+ });
4180
+
4757
4181
  // ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseProperty.js
4758
4182
  var require_baseProperty = __commonJS({
4759
4183
  "../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseProperty.js"(exports, module) {
@@ -4863,7 +4287,7 @@ import { Command } from "commander";
4863
4287
 
4864
4288
  // package.json
4865
4289
  var description = "A tool for releasing front-end projects, supporting multiple release modes and configurations, simplifying the release process and improving efficiency.";
4866
- var version = "2.3.5";
4290
+ var version = "3.1.0";
4867
4291
 
4868
4292
  // src/cli.ts
4869
4293
  var import_semver = __toESM(require_semver2(), 1);
@@ -4890,10 +4314,7 @@ function tuple(plugin, ...args) {
4890
4314
  import { AsyncExecutor } from "@qlover/fe-corekit";
4891
4315
 
4892
4316
  // src/implments/ReleaseContext.ts
4893
- var import_merge = __toESM(require_merge(), 1);
4894
4317
  var import_get = __toESM(require_get(), 1);
4895
- import { FeScriptContext } from "@qlover/scripts-context";
4896
- import { Env } from "@qlover/env-loader";
4897
4318
 
4898
4319
  // src/defaults.ts
4899
4320
  var DEFAULT_SOURCE_BRANCH = "master";
@@ -4907,68 +4328,169 @@ var WORKSPACE_VERSION_SEPARATOR = "@";
4907
4328
  var BATCH_PR_BODY = "\n## ${name} ${version}\n${changelog}\n";
4908
4329
 
4909
4330
  // src/implments/ReleaseContext.ts
4910
- var DEFAULT_ENV_ORDER = [".env.local", ".env"];
4911
- var ReleaseContext = class extends FeScriptContext {
4912
- _env;
4331
+ import {
4332
+ ScriptContext
4333
+ } from "@qlover/scripts-context";
4334
+ var ReleaseContext = class extends ScriptContext {
4913
4335
  /**
4914
- * Shared Config
4336
+ * Creates a new ReleaseContext instance
4337
+ *
4338
+ * Initializes the context with provided options and sets up
4339
+ * default values for required configuration:
4340
+ * - rootPath: Defaults to current working directory
4341
+ * - sourceBranch: Uses environment variables or default
4342
+ * - releaseEnv: Uses environment variables or 'development'
4343
+ *
4344
+ * Environment Variable Priority:
4345
+ * - sourceBranch: FE_RELEASE_BRANCH > FE_RELEASE_SOURCE_BRANCH > DEFAULT_SOURCE_BRANCH
4346
+ * - releaseEnv: FE_RELEASE_ENV > NODE_ENV > 'development'
4347
+ *
4348
+ * @param name - Unique identifier for this release context
4349
+ * @param options - Configuration options
4350
+ *
4351
+ * @example
4352
+ * ```typescript
4353
+ * const context = new ReleaseContext('web-app', {
4354
+ * rootPath: '/projects/web-app',
4355
+ * sourceBranch: 'main',
4356
+ * releaseEnv: 'production'
4357
+ * });
4358
+ * ```
4915
4359
  */
4916
- shared;
4917
- constructor(context) {
4918
- super(context);
4919
- this._env = Env.searchEnv({
4920
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
4921
- logger: this.logger,
4922
- preloadList: this.feConfig.envOrder || DEFAULT_ENV_ORDER
4923
- });
4924
- this.shared = Object.assign(
4925
- {},
4926
- this.feConfig.release,
4927
- this.getDefaultShreadOptions(context.shared)
4928
- );
4929
- }
4930
- getDefaultShreadOptions(props) {
4931
- return {
4932
- rootPath: process.cwd(),
4933
- // use currentBranch by default
4934
- sourceBranch: this._env.get("FE_RELEASE_BRANCH") || this._env.get("FE_RELEASE_SOURCE_BRANCH") || DEFAULT_SOURCE_BRANCH,
4935
- releaseEnv: this._env.get("FE_RELEASE_ENV") || this._env.get("NODE_ENV") || "development",
4936
- ...props
4937
- };
4360
+ constructor(name, options) {
4361
+ super(name, options);
4362
+ if (!this.options.rootPath) {
4363
+ this.setOptions({ rootPath: process.cwd() });
4364
+ }
4365
+ if (!this.options.sourceBranch) {
4366
+ this.setOptions({
4367
+ sourceBranch: this.env.get("FE_RELEASE_BRANCH") || this.env.get("FE_RELEASE_SOURCE_BRANCH") || DEFAULT_SOURCE_BRANCH
4368
+ });
4369
+ }
4370
+ if (!this.options.releaseEnv) {
4371
+ this.setOptions({
4372
+ releaseEnv: this.env.get("FE_RELEASE_ENV") || this.env.get("NODE_ENV") || "development"
4373
+ });
4374
+ }
4938
4375
  }
4376
+ /**
4377
+ * Gets the root path of the project
4378
+ *
4379
+ * @returns Absolute path to project root
4380
+ *
4381
+ * @example
4382
+ * ```typescript
4383
+ * const root = context.rootPath;
4384
+ * // '/path/to/project'
4385
+ * ```
4386
+ */
4939
4387
  get rootPath() {
4940
- return this.shared.rootPath;
4388
+ return this.getOptions("rootPath");
4941
4389
  }
4390
+ /**
4391
+ * Gets the source branch for the release
4392
+ *
4393
+ * @returns Branch name to use as source
4394
+ *
4395
+ * @example
4396
+ * ```typescript
4397
+ * const branch = context.sourceBranch;
4398
+ * // 'main' or custom branch name
4399
+ * ```
4400
+ */
4942
4401
  get sourceBranch() {
4943
- return this.shared.sourceBranch;
4402
+ return this.getOptions("sourceBranch");
4944
4403
  }
4404
+ /**
4405
+ * Gets the release environment
4406
+ *
4407
+ * @returns Environment name (e.g., 'development', 'production')
4408
+ *
4409
+ * @example
4410
+ * ```typescript
4411
+ * const env = context.releaseEnv;
4412
+ * // 'development' or custom environment
4413
+ * ```
4414
+ */
4945
4415
  get releaseEnv() {
4946
- return this.shared.releaseEnv;
4947
- }
4948
- get env() {
4949
- return this._env;
4416
+ return this.getOptions("releaseEnv");
4950
4417
  }
4418
+ /**
4419
+ * Gets all configured workspaces
4420
+ *
4421
+ * @returns Array of workspace configurations or undefined
4422
+ *
4423
+ * @example
4424
+ * ```typescript
4425
+ * const allWorkspaces = context.workspaces;
4426
+ * // [{ name: 'pkg-a', version: '1.0.0', ... }]
4427
+ * ```
4428
+ */
4951
4429
  get workspaces() {
4952
- return this.getConfig("workspaces.workspaces");
4430
+ return this.getOptions("workspaces.workspaces");
4953
4431
  }
4432
+ /**
4433
+ * Gets the current active workspace
4434
+ *
4435
+ * @returns Current workspace configuration or undefined
4436
+ *
4437
+ * @example
4438
+ * ```typescript
4439
+ * const current = context.workspace;
4440
+ * // { name: 'pkg-a', version: '1.0.0', ... }
4441
+ * ```
4442
+ */
4954
4443
  get workspace() {
4955
- return this.getConfig("workspaces.workspace");
4444
+ return this.getOptions("workspaces.workspace");
4956
4445
  }
4446
+ /**
4447
+ * Sets the workspace configurations
4448
+ *
4449
+ * Updates the workspace list while preserving other workspace settings
4450
+ *
4451
+ * @param workspaces - Array of workspace configurations
4452
+ *
4453
+ * @example
4454
+ * ```typescript
4455
+ * context.setWorkspaces([{
4456
+ * name: 'pkg-a',
4457
+ * version: '1.0.0',
4458
+ * path: 'packages/a'
4459
+ * }]);
4460
+ * ```
4461
+ */
4957
4462
  setWorkspaces(workspaces) {
4958
4463
  this.options.workspaces = {
4959
4464
  ...this.options.workspaces,
4960
4465
  workspaces
4961
4466
  };
4962
4467
  }
4963
- setConfig(config) {
4964
- this.options = (0, import_merge.default)(this.options, config);
4965
- }
4966
- getConfig(key, defaultValue) {
4967
- return (0, import_get.default)(this.options, key, defaultValue);
4968
- }
4969
- setShared(shared) {
4970
- this.shared = (0, import_merge.default)(this.shared, shared);
4971
- }
4468
+ /**
4469
+ * Gets package.json data for the current workspace
4470
+ *
4471
+ * Provides type-safe access to package.json fields with optional
4472
+ * path and default value support.
4473
+ *
4474
+ * @param key - Optional dot-notation path to specific field
4475
+ * @param defaultValue - Default value if field not found
4476
+ * @returns Package data of type T
4477
+ * @throws Error if package.json not found
4478
+ *
4479
+ * @example Basic usage
4480
+ * ```typescript
4481
+ * // Get entire package.json
4482
+ * const pkg = context.getPkg();
4483
+ *
4484
+ * // Get specific field
4485
+ * const version = context.getPkg<string>('version');
4486
+ *
4487
+ * // Get nested field with default
4488
+ * const script = context.getPkg<string>(
4489
+ * 'scripts.build',
4490
+ * 'echo "No build script"'
4491
+ * );
4492
+ * ```
4493
+ */
4972
4494
  getPkg(key, defaultValue) {
4973
4495
  const packageJson = this.workspace?.packageJson;
4974
4496
  if (!packageJson) {
@@ -4979,9 +4501,31 @@ var ReleaseContext = class extends FeScriptContext {
4979
4501
  }
4980
4502
  return (0, import_get.default)(packageJson, key, defaultValue);
4981
4503
  }
4504
+ /**
4505
+ * Generates template context for string interpolation
4506
+ *
4507
+ * Combines context options, workspace data, and specific paths
4508
+ * for use in template processing. Includes deprecated fields
4509
+ * for backward compatibility.
4510
+ *
4511
+ * @returns Combined template context
4512
+ *
4513
+ * @example
4514
+ * ```typescript
4515
+ * const context = releaseContext.getTemplateContext();
4516
+ * // {
4517
+ * // publishPath: 'packages/my-pkg',
4518
+ * // env: 'production', // deprecated
4519
+ * // branch: 'main', // deprecated
4520
+ * // releaseEnv: 'production', // use this instead
4521
+ * // sourceBranch: 'main', // use this instead
4522
+ * // ...other options
4523
+ * // }
4524
+ * ```
4525
+ */
4982
4526
  getTemplateContext() {
4983
4527
  return {
4984
- ...this.shared,
4528
+ ...this.getOptions(),
4985
4529
  ...this.workspace,
4986
4530
  publishPath: this.workspace?.path || "",
4987
4531
  // deprecated
@@ -4989,6 +4533,28 @@ var ReleaseContext = class extends FeScriptContext {
4989
4533
  branch: this.sourceBranch
4990
4534
  };
4991
4535
  }
4536
+ /**
4537
+ * Executes changeset CLI commands
4538
+ *
4539
+ * Automatically detects and uses appropriate package manager
4540
+ * (pnpm or npx) to run changeset commands.
4541
+ *
4542
+ * @param name - Changeset command name
4543
+ * @param args - Optional command arguments
4544
+ * @returns Command output
4545
+ *
4546
+ * @example Version bump
4547
+ * ```typescript
4548
+ * // Bump version with snapshot
4549
+ * await context.runChangesetsCli('version', ['--snapshot', 'alpha']);
4550
+ *
4551
+ * // Create new changeset
4552
+ * await context.runChangesetsCli('add');
4553
+ *
4554
+ * // Status check
4555
+ * await context.runChangesetsCli('status');
4556
+ * ```
4557
+ */
4992
4558
  async runChangesetsCli(name, args) {
4993
4559
  let packageManager = "pnpm";
4994
4560
  try {
@@ -5006,6 +4572,7 @@ var ReleaseContext = class extends FeScriptContext {
5006
4572
  };
5007
4573
 
5008
4574
  // src/implments/ReleaseParams.ts
4575
+ import { Shell } from "@qlover/scripts-context";
5009
4576
  var DEFAULT_RELEASE_CONFIG = {
5010
4577
  maxWorkspace: MAX_WORKSPACE,
5011
4578
  multiWorkspaceSeparator: MULTI_WORKSPACE_SEPARATOR,
@@ -5014,22 +4581,85 @@ var DEFAULT_RELEASE_CONFIG = {
5014
4581
  batchTagName: "batch-${length}-packages-${timestamp}"
5015
4582
  };
5016
4583
  var ReleaseParams = class {
5017
- constructor(shell, logger, config = {}) {
5018
- this.shell = shell;
4584
+ /**
4585
+ * Creates a new ReleaseParams instance
4586
+ *
4587
+ * Initializes with logger for debug output and optional configuration
4588
+ * overrides. Uses default configuration values for any unspecified options.
4589
+ *
4590
+ * @param logger - Logger instance for debug output
4591
+ * @param config - Optional configuration overrides
4592
+ *
4593
+ * @example
4594
+ * ```typescript
4595
+ * // Basic initialization
4596
+ * const params = new ReleaseParams(logger);
4597
+ *
4598
+ * // With custom configuration
4599
+ * const params = new ReleaseParams(logger, {
4600
+ * maxWorkspace: 5,
4601
+ * multiWorkspaceSeparator: '-',
4602
+ * workspaceVersionSeparator: '#'
4603
+ * });
4604
+ * ```
4605
+ */
4606
+ constructor(logger, config = {}) {
5019
4607
  this.logger = logger;
5020
4608
  this.config = {
5021
4609
  ...DEFAULT_RELEASE_CONFIG,
5022
4610
  ...config
5023
4611
  };
5024
4612
  }
4613
+ /**
4614
+ * Current configuration
4615
+ * @private
4616
+ */
5025
4617
  config;
4618
+ /**
4619
+ * Generates a release branch name for a single package
4620
+ *
4621
+ * Uses the branch name template from shared configuration or
4622
+ * falls back to the default template 'release-${tagName}'.
4623
+ * Supports variable interpolation in the template.
4624
+ *
4625
+ * Template Variables:
4626
+ * - ${pkgName}: Package name
4627
+ * - ${releaseName}: Release name (same as pkgName)
4628
+ * - ${tagName}: Release tag
4629
+ * - All shared config properties
4630
+ *
4631
+ * @param releaseName - Name of the package being released
4632
+ * @param tagName - Version tag for the release
4633
+ * @param shared - Shared configuration with branch template
4634
+ * @returns Formatted branch name
4635
+ * @throws Error if branch name template is not a string
4636
+ *
4637
+ * @example
4638
+ * ```typescript
4639
+ * // With default template
4640
+ * const branch = params.getReleaseBranchName(
4641
+ * 'my-pkg',
4642
+ * 'v1.0.0',
4643
+ * {}
4644
+ * );
4645
+ * // 'release-v1.0.0'
4646
+ *
4647
+ * // With custom template
4648
+ * const branch = params.getReleaseBranchName(
4649
+ * 'my-pkg',
4650
+ * 'v1.0.0',
4651
+ * { branchName: '${pkgName}-release-${tagName}' }
4652
+ * );
4653
+ * // 'my-pkg-release-v1.0.0'
4654
+ * ```
4655
+ */
5026
4656
  getReleaseBranchName(releaseName, tagName, shared) {
5027
4657
  const branchNameTpl = shared.branchName || "release-${tagName}";
5028
4658
  if (typeof branchNameTpl !== "string") {
5029
4659
  throw new Error("Branch name template is not a string");
5030
4660
  }
5031
4661
  this.logger.debug("Release Branch template is:", branchNameTpl);
5032
- return this.shell.format(branchNameTpl, {
4662
+ return Shell.format(branchNameTpl, {
5033
4663
  pkgName: releaseName,
5034
4664
  releaseName,
5035
4665
  tagName,
@@ -5037,13 +4667,56 @@ var ReleaseParams = class {
5037
4667
  ...shared
5038
4668
  });
5039
4669
  }
4670
+ /**
4671
+ * Generates a release branch name for multiple packages
4672
+ *
4673
+ * Uses the batch branch name template from configuration.
4674
+ * Supports variable interpolation with additional batch-specific
4675
+ * variables.
4676
+ *
4677
+ * Template Variables:
4678
+ * - ${pkgName}: Package name
4679
+ * - ${releaseName}: Combined release name
4680
+ * - ${tagName}: Combined tag name
4681
+ * - ${length}: Number of packages
4682
+ * - ${timestamp}: Current timestamp
4683
+ * - All shared config properties
4684
+ *
4685
+ * @param releaseName - Combined name of packages
4686
+ * @param tagName - Combined version tag
4687
+ * @param shared - Shared configuration
4688
+ * @param length - Number of packages in batch
4689
+ * @returns Formatted batch branch name
4690
+ * @throws Error if branch name template is not a string
4691
+ *
4692
+ * @example
4693
+ * ```typescript
4694
+ * // With default template
4695
+ * const branch = params.getBatchReleaseBranchName(
4696
+ * 'pkg-a@1.0.0_pkg-b@2.0.0',
4697
+ * 'batch-2-packages-1234567890',
4698
+ * {},
4699
+ * 2
4700
+ * );
4701
+ * // 'batch-pkg-a@1.0.0_pkg-b@2.0.0-2-packages-1234567890'
4702
+ *
4703
+ * // With custom template
4704
+ * const branch = params.getBatchReleaseBranchName(
4705
+ * 'pkg-a@1.0.0_pkg-b@2.0.0',
4706
+ * 'v1.0.0',
4707
+ * {},
4708
+ * 2,
4709
+ * );
4710
+ * // Custom formatted branch name
4711
+ * ```
4712
+ */
5040
4713
  getBatchReleaseBranchName(releaseName, tagName, shared, length) {
5041
4714
  const branchNameTpl = this.config.batchBranchName;
5042
4715
  if (typeof branchNameTpl !== "string") {
5043
4716
  throw new Error("Branch name template is not a string");
5044
4717
  }
5045
4718
  this.logger.debug("Release Batch Branch template is:", branchNameTpl);
5046
- return this.shell.format(branchNameTpl, {
4719
+ return Shell.format(branchNameTpl, {
5047
4720
  pkgName: releaseName,
5048
4721
  releaseName,
5049
4722
  tagName,
@@ -5053,6 +4726,45 @@ var ReleaseParams = class {
5053
4726
  timestamp: Date.now()
5054
4727
  });
5055
4728
  }
4729
+ /**
4730
+ * Generates a release name from workspace configurations
4731
+ *
4732
+ * For single packages, returns the package name.
4733
+ * For multiple packages, combines names and versions up to
4734
+ * the configured maximum number of workspaces.
4735
+ *
4736
+ * Format:
4737
+ * - Single: packageName
4738
+ * - Multiple: pkg1@1.0.0_pkg2@2.0.0_pkg3@3.0.0
4739
+ *
4740
+ * @param composeWorkspaces - Array of workspace configurations
4741
+ * @returns Formatted release name
4742
+ *
4743
+ * @example
4744
+ * ```typescript
4745
+ * // Single package
4746
+ * const name = params.getReleaseName([
4747
+ * { name: 'pkg-a', version: '1.0.0' }
4748
+ * ]);
4749
+ * // 'pkg-a'
4750
+ *
4751
+ * // Multiple packages
4752
+ * const name = params.getReleaseName([
4753
+ * { name: 'pkg-a', version: '1.0.0' },
4754
+ * { name: 'pkg-b', version: '2.0.0' }
4755
+ * ]);
4756
+ * // 'pkg-a@1.0.0_pkg-b@2.0.0'
4757
+ *
4758
+ * // With max limit
4759
+ * const name = params.getReleaseName([
4760
+ * { name: 'pkg-a', version: '1.0.0' },
4761
+ * { name: 'pkg-b', version: '2.0.0' },
4762
+ * { name: 'pkg-c', version: '3.0.0' },
4763
+ * { name: 'pkg-d', version: '4.0.0' }
4764
+ * ]);
4765
+ * // Only first 3: 'pkg-a@1.0.0_pkg-b@2.0.0_pkg-c@3.0.0'
4766
+ * ```
4767
+ */
5056
4768
  getReleaseName(composeWorkspaces) {
5057
4769
  if (composeWorkspaces.length === 1) {
5058
4770
  return composeWorkspaces[0].name;
@@ -5062,16 +4774,84 @@ var ReleaseParams = class {
5062
4774
  ({ name, version: version2 }) => `${name}${workspaceVersionSeparator}${version2}`
5063
4775
  ).join(multiWorkspaceSeparator);
5064
4776
  }
4777
+ /**
4778
+ * Generates a tag name for the release
4779
+ *
4780
+ * For single packages, uses the package version.
4781
+ * For multiple packages, generates a batch tag name using
4782
+ * the configured template.
4783
+ *
4784
+ * Format:
4785
+ * - Single: version
4786
+ * - Multiple: batch-${length}-packages-${timestamp}
4787
+ *
4788
+ * @param composeWorkspaces - Array of workspace configurations
4789
+ * @returns Formatted tag name
4790
+ *
4791
+ * @example
4792
+ * ```typescript
4793
+ * // Single package
4794
+ * const tag = params.getReleaseTagName([
4795
+ * { name: 'pkg-a', version: '1.0.0' }
4796
+ * ]);
4797
+ * // '1.0.0'
4798
+ *
4799
+ * // Multiple packages
4800
+ * const tag = params.getReleaseTagName([
4801
+ * { name: 'pkg-a', version: '1.0.0' },
4802
+ * { name: 'pkg-b', version: '2.0.0' }
4803
+ * ]);
4804
+ * // 'batch-2-packages-1234567890'
4805
+ * ```
4806
+ */
5065
4807
  getReleaseTagName(composeWorkspaces) {
5066
4808
  if (composeWorkspaces.length === 1) {
5067
4809
  return composeWorkspaces[0].version;
5068
4810
  }
5069
4811
  const { batchTagName } = this.config;
5070
- return this.shell.format(batchTagName, {
4812
+ return Shell.format(batchTagName, {
5071
4813
  length: composeWorkspaces.length,
5072
4814
  timestamp: Date.now()
5073
4815
  });
5074
4816
  }
4817
+ /**
4818
+ * Generates branch and tag parameters for the release
4819
+ *
4820
+ * Combines the generation of branch name and tag name into
4821
+ * a single operation. Handles both single and multi-package
4822
+ * releases appropriately.
4823
+ *
4824
+ * @param composeWorkspaces - Array of workspace configurations
4825
+ * @param shared - Shared configuration
4826
+ * @returns Object containing tag name and branch name
4827
+ *
4828
+ * @example Single package
4829
+ * ```typescript
4830
+ * const params = releaseParams.getReleaseBranchParams(
4831
+ * [{ name: 'pkg-a', version: '1.0.0' }],
4832
+ * { branchName: 'release-${tagName}' }
4833
+ * );
4834
+ * // {
4835
+ * // tagName: '1.0.0',
4836
+ * // releaseBranch: 'release-1.0.0'
4837
+ * // }
4838
+ * ```
4839
+ *
4840
+ * @example Multiple packages
4841
+ * ```typescript
4842
+ * const params = releaseParams.getReleaseBranchParams(
4843
+ * [
4844
+ * { name: 'pkg-a', version: '1.0.0' },
4845
+ * { name: 'pkg-b', version: '2.0.0' }
4846
+ * ],
4847
+ * {}
4848
+ * );
4849
+ * // {
4850
+ * // tagName: 'batch-2-packages-1234567890',
4851
+ * // releaseBranch: 'batch-pkg-a@1.0.0_pkg-b@2.0.0-2-packages-1234567890'
4852
+ * // }
4853
+ * ```
4854
+ */
5075
4855
  getReleaseBranchParams(composeWorkspaces, shared) {
5076
4856
  const releaseTagName = this.getReleaseTagName(composeWorkspaces);
5077
4857
  const releaseName = this.getReleaseName(composeWorkspaces);
@@ -5086,24 +4866,125 @@ var ReleaseParams = class {
5086
4866
  releaseBranch: releaseBranchName
5087
4867
  };
5088
4868
  }
4869
+ /**
4870
+ * Generates a title for the release pull request
4871
+ *
4872
+ * Uses the configured PR title template or falls back to the default.
4873
+ * Supports variable interpolation with release parameters and context.
4874
+ *
4875
+ * Template Variables:
4876
+ * - ${tagName}: Release tag name
4877
+ * - ${pkgName}: Package/branch name
4878
+ * - All template context properties
4879
+ *
4880
+ * @param releaseBranchParams - Release branch parameters
4881
+ * @param context - Template context for variable interpolation
4882
+ * @returns Formatted PR title
4883
+ *
4884
+ * @example
4885
+ * ```typescript
4886
+ * // With default template
4887
+ * const title = params.getPRTitle(
4888
+ * {
4889
+ * tagName: '1.0.0',
4890
+ * releaseBranch: 'release-1.0.0'
4891
+ * },
4892
+ * {
4893
+ * env: 'production',
4894
+ * pkgName: 'my-package'
4895
+ * }
4896
+ * );
4897
+ * // 'Release production my-package 1.0.0'
4898
+ *
4899
+ * // With custom template
4900
+ * const title = params.getPRTitle(
4901
+ * {
4902
+ * tagName: '1.0.0',
4903
+ * releaseBranch: 'release-1.0.0'
4904
+ * },
4905
+ * {
4906
+ * env: 'staging',
4907
+ * pkgName: 'my-package'
4908
+ * }
4909
+ * );
4910
+ * // Custom formatted title
4911
+ * ```
4912
+ */
5089
4913
  getPRTitle(releaseBranchParams, context) {
5090
4914
  const prTitleTpl = this.config.PRTitle || DEFAULT_PR_TITLE;
5091
- return this.shell.format(prTitleTpl, {
4915
+ return Shell.format(prTitleTpl, {
5092
4916
  ...context,
5093
4917
  tagName: releaseBranchParams.tagName,
5094
4918
  pkgName: releaseBranchParams.releaseBranch
5095
4919
  });
5096
4920
  }
5097
4921
  /**
5098
- * Gets the body for the release pull request.
4922
+ * Generates the body content for the release pull request
4923
+ *
4924
+ * Handles both single and multi-package releases, combining
4925
+ * changelogs appropriately. For batch releases, formats each
4926
+ * package's changelog according to the batch template.
5099
4927
  *
5100
- * @param options - The options containing tag name and changelog.
5101
- * @returns The formatted release pull request body.
4928
+ * Template Variables:
4929
+ * - ${tagName}: Release tag or combined workspace versions
4930
+ * - ${changelog}: Single changelog or combined batch changelogs
4931
+ * - All template context properties
4932
+ *
4933
+ * @param composeWorkspaces - Array of workspace configurations
4934
+ * @param releaseBranchParams - Release branch parameters
4935
+ * @param context - Template context for variable interpolation
4936
+ * @returns Formatted PR body content
4937
+ *
4938
+ * @example Single package
4939
+ * ```typescript
4940
+ * const body = params.getPRBody(
4941
+ * [{
4942
+ * name: 'pkg-a',
4943
+ * version: '1.0.0',
4944
+ * changelog: '- Feature: New functionality\n- Fix: Bug fix'
4945
+ * }],
4946
+ * {
4947
+ * tagName: '1.0.0',
4948
+ * releaseBranch: 'release-1.0.0'
4949
+ * },
4950
+ * context
4951
+ * );
4952
+ * // Custom formatted body with single changelog
4953
+ * ```
4954
+ *
4955
+ * @example Multiple packages
4956
+ * ```typescript
4957
+ * const body = params.getPRBody(
4958
+ * [
4959
+ * {
4960
+ * name: 'pkg-a',
4961
+ * version: '1.0.0',
4962
+ * changelog: '- Feature: Package A changes'
4963
+ * },
4964
+ * {
4965
+ * name: 'pkg-b',
4966
+ * version: '2.0.0',
4967
+ * changelog: '- Feature: Package B changes'
4968
+ * }
4969
+ * ],
4970
+ * {
4971
+ * tagName: 'batch-2-packages-1234567890',
4972
+ * releaseBranch: 'batch-release'
4973
+ * },
4974
+ * context
4975
+ * );
4976
+ * // Formatted body with combined changelogs:
4977
+ * // ## pkg-a 1.0.0
4978
+ * // - Feature: Package A changes
4979
+ * //
4980
+ * // ## pkg-b 2.0.0
4981
+ * // - Feature: Package B changes
4982
+ * ```
5102
4983
  */
5103
4984
  getPRBody(composeWorkspaces, releaseBranchParams, context) {
5104
4985
  const PRBodyTpl = this.config.PRBody;
5105
4986
  const changelog = composeWorkspaces.length > 1 ? composeWorkspaces.map((workspace) => {
5106
- return this.shell.format(
4987
+ return Shell.format(
5107
4988
  BATCH_PR_BODY,
5108
4989
  workspace
5109
4990
  );
@@ -5112,7 +4993,7 @@ var ReleaseParams = class {
5112
4993
  const tagName = composeWorkspaces.length === 1 ? releaseBranchParams.tagName : composeWorkspaces.map(
5113
4994
  (workspace) => `${workspace.name}${workspaceVersionSeparator}${workspace.version}`
5114
4995
  ).join(" ");
5115
- return this.shell.format(PRBodyTpl, {
4996
+ return Shell.format(PRBodyTpl, {
5116
4997
  ...context,
5117
4998
  tagName,
5118
4999
  changelog
@@ -5121,14 +5002,41 @@ var ReleaseParams = class {
5121
5002
  };
5122
5003
 
5123
5004
  // src/plugins/githubPR/GithubManager.ts
5005
+ import { Shell as Shell2 } from "@qlover/scripts-context";
5124
5006
  import { Octokit } from "@octokit/rest";
5125
5007
  var GithubManager = class {
5008
+ /**
5009
+ * Creates a new GithubManager instance
5010
+ *
5011
+ * @param context - Release context containing configuration
5012
+ *
5013
+ * @example
5014
+ * ```typescript
5015
+ * const manager = new GithubManager(context);
5016
+ * ```
5017
+ */
5126
5018
  constructor(context) {
5127
5019
  this.context = context;
5128
5020
  }
5021
+ /** Lazy-loaded Octokit instance */
5129
5022
  _octokit = null;
5023
+ /**
5024
+ * Gets GitHub repository information
5025
+ *
5026
+ * Retrieves the owner and repository name from the context.
5027
+ * This information is required for most GitHub API operations.
5028
+ *
5029
+ * @returns Repository owner and name
5030
+ * @throws Error if owner or repo name is not set
5031
+ *
5032
+ * @example
5033
+ * ```typescript
5034
+ * const info = manager.getGitHubUserInfo();
5035
+ * // { owner: 'org-name', repo: 'repo-name' }
5036
+ * ```
5037
+ */
5130
5038
  getGitHubUserInfo() {
5131
- const { authorName, repoName } = this.context.shared;
5039
+ const { authorName, repoName } = this.context.getOptions();
5132
5040
  if (!authorName || !repoName) {
5133
5041
  throw new Error("Author name or repo name is not set");
5134
5042
  }
@@ -5137,8 +5045,30 @@ var GithubManager = class {
5137
5045
  repo: repoName
5138
5046
  };
5139
5047
  }
5048
+ /**
5049
+ * Gets GitHub API token
5050
+ *
5051
+ * Retrieves the GitHub API token from environment variables.
5052
+ * The token name can be configured via the tokenRef option.
5053
+ *
5054
+ * @returns GitHub API token
5055
+ * @throws Error if token is not set
5056
+ *
5057
+ * @example Default token
5058
+ * ```typescript
5059
+ * const token = manager.getToken();
5060
+ * // Uses GITHUB_TOKEN env var
5061
+ * ```
5062
+ *
5063
+ * @example Custom token
5064
+ * ```typescript
5065
+ * context.options.githubPR.tokenRef = 'CUSTOM_TOKEN';
5066
+ * const token = manager.getToken();
5067
+ * // Uses CUSTOM_TOKEN env var
5068
+ * ```
5069
+ */
5140
5070
  getToken() {
5141
- const { tokenRef = "GITHUB_TOKEN" } = this.context.getConfig("githubPR");
5071
+ const { tokenRef = "GITHUB_TOKEN" } = this.context.getOptions("githubPR");
5142
5072
  const token = this.context.env.get(tokenRef);
5143
5073
  if (!token) {
5144
5074
  throw new Error(
@@ -5147,11 +5077,29 @@ var GithubManager = class {
5147
5077
  }
5148
5078
  return token;
5149
5079
  }
5080
+ /**
5081
+ * Gets Octokit instance
5082
+ *
5083
+ * Lazily initializes and returns an Octokit instance configured
5084
+ * with the GitHub token and timeout settings.
5085
+ *
5086
+ * @returns Configured Octokit instance
5087
+ * @throws Error if token retrieval fails
5088
+ *
5089
+ * @example
5090
+ * ```typescript
5091
+ * const octokit = manager.octokit;
5092
+ * await octokit.rest.issues.create({
5093
+ * ...manager.getGitHubUserInfo(),
5094
+ * title: 'Issue title'
5095
+ * });
5096
+ * ```
5097
+ */
5150
5098
  get octokit() {
5151
5099
  if (this._octokit) {
5152
5100
  return this._octokit;
5153
5101
  }
5154
- const { timeout } = this.context.getConfig("githubPR");
5102
+ const { timeout } = this.context.getOptions("githubPR");
5155
5103
  const options = {
5156
5104
  auth: this.getToken(),
5157
5105
  request: {
@@ -5161,9 +5109,37 @@ var GithubManager = class {
5161
5109
  this._octokit = new Octokit(options);
5162
5110
  return this._octokit;
5163
5111
  }
5112
+ /**
5113
+ * Gets logger instance
5114
+ *
5115
+ * Provides access to the context's logger for consistent
5116
+ * logging across the manager.
5117
+ *
5118
+ * @returns Logger instance
5119
+ *
5120
+ * @example
5121
+ * ```typescript
5122
+ * manager.logger.info('Creating release...');
5123
+ * manager.logger.debug('API response:', response);
5124
+ * ```
5125
+ */
5164
5126
  get logger() {
5165
5127
  return this.context.logger;
5166
5128
  }
5129
+ /**
5130
+ * Gets shell interface
5131
+ *
5132
+ * Provides access to the context's shell interface for
5133
+ * executing Git commands and other shell operations.
5134
+ *
5135
+ * @returns Shell interface
5136
+ *
5137
+ * @example
5138
+ * ```typescript
5139
+ * await manager.shell.exec('git fetch origin');
5140
+ * await manager.shell.exec(['git', 'push', 'origin', 'main']);
5141
+ * ```
5142
+ */
5167
5143
  get shell() {
5168
5144
  return this.context.shell;
5169
5145
  }
@@ -5172,24 +5148,77 @@ var GithubManager = class {
5172
5148
  *
5173
5149
  * @default `squash`
5174
5150
  */
5151
+ /**
5152
+ * Gets auto-merge type for pull requests
5153
+ *
5154
+ * Determines how pull requests should be merged when
5155
+ * auto-merge is enabled. Defaults to 'squash'.
5156
+ *
5157
+ * @returns Auto-merge type ('merge', 'squash', or 'rebase')
5158
+ *
5159
+ * @example
5160
+ * ```typescript
5161
+ * const mergeType = manager.autoMergeType;
5162
+ * // 'squash' (default)
5163
+ *
5164
+ * context.options.autoMergeType = 'rebase';
5165
+ * manager.autoMergeType; // 'rebase'
5166
+ * ```
5167
+ */
5175
5168
  get autoMergeType() {
5176
- return this.context.shared.autoMergeType || DEFAULT_AUTO_MERGE_TYPE;
5169
+ return this.context.getOptions().autoMergeType || DEFAULT_AUTO_MERGE_TYPE;
5177
5170
  }
5178
5171
  /**
5179
5172
  * Dry run PR number
5180
5173
  *
5181
5174
  * @default `999999`
5182
5175
  */
5176
+ /**
5177
+ * Gets pull request number for dry runs
5178
+ *
5179
+ * Returns a placeholder PR number when running in dry-run mode.
5180
+ * This allows testing PR-related functionality without creating
5181
+ * actual pull requests.
5182
+ *
5183
+ * @returns Dry run PR number (default: '999999')
5184
+ *
5185
+ * @example
5186
+ * ```typescript
5187
+ * context.dryRun = true;
5188
+ * const prNumber = manager.dryRunPRNumber;
5189
+ * // '999999'
5190
+ *
5191
+ * context.options.githubPR.dryRunPRNumber = '123456';
5192
+ * manager.dryRunPRNumber; // '123456'
5193
+ * ```
5194
+ */
5183
5195
  get dryRunPRNumber() {
5184
- return this.context.getConfig("githubPR.dryRunPRNumber", "999999");
5196
+ return this.context.getOptions("githubPR.dryRunPRNumber", "999999");
5185
5197
  }
5186
5198
  /**
5187
5199
  * Auto merge release PR
5188
5200
  *
5189
5201
  * @default `false`
5190
5202
  */
5203
+ /**
5204
+ * Gets auto-merge setting for release PRs
5205
+ *
5206
+ * Determines whether release pull requests should be
5207
+ * automatically merged after creation. Defaults to false.
5208
+ *
5209
+ * @returns True if auto-merge is enabled
5210
+ *
5211
+ * @example
5212
+ * ```typescript
5213
+ * const autoMerge = manager.autoMergeReleasePR;
5214
+ * // false (default)
5215
+ *
5216
+ * context.options.autoMergeReleasePR = true;
5217
+ * manager.autoMergeReleasePR; // true
5218
+ * ```
5219
+ */
5191
5220
  get autoMergeReleasePR() {
5192
- return this.context.shared.autoMergeReleasePR || DEFAULT_AUTO_MERGE_RELEASE_PR;
5221
+ return this.context.getOptions("autoMergeReleasePR") || DEFAULT_AUTO_MERGE_RELEASE_PR;
5193
5222
  }
5194
5223
  /**
5195
5224
  * Automatically merges a pull request.
@@ -5197,6 +5226,30 @@ var GithubManager = class {
5197
5226
  * @param prNumber - The pull request number to merge.
5198
5227
  * @param releaseBranch - The branch to merge into.
5199
5228
  */
5229
+ /**
5230
+ * Merges a pull request
5231
+ *
5232
+ * Merges the specified pull request using the configured
5233
+ * merge method. In dry-run mode, logs the merge action
5234
+ * without performing it.
5235
+ *
5236
+ * @param prNumber - Pull request number
5237
+ * @param releaseBranch - Branch to merge
5238
+ * @throws Error if merge fails
5239
+ *
5240
+ * @example Basic merge
5241
+ * ```typescript
5242
+ * await manager.mergePR('123', 'release-1.0.0');
5243
+ * // Merges PR #123 using configured merge method
5244
+ * ```
5245
+ *
5246
+ * @example Dry run
5247
+ * ```typescript
5248
+ * context.dryRun = true;
5249
+ * await manager.mergePR('123', 'release-1.0.0');
5250
+ * // Logs merge action without performing it
5251
+ * ```
5252
+ */
5200
5253
  async mergePR(prNumber, releaseBranch) {
5201
5254
  if (!prNumber) {
5202
5255
  this.logger.error("Failed to create Pull Request.", prNumber);
@@ -5204,7 +5257,7 @@ var GithubManager = class {
5204
5257
  }
5205
5258
  const mergeMethod = this.autoMergeType;
5206
5259
  if (this.context.dryRun) {
5207
- const { repoName, authorName } = this.context.shared;
5260
+ const { repoName, authorName } = this.context.getOptions();
5208
5261
  this.logger.info(
5209
5262
  `[DRY RUN] Would merge PR #${prNumber} with method '${mergeMethod}' in repo ${authorName}/${repoName}, branch ${releaseBranch}`
5210
5263
  );
@@ -5216,6 +5269,24 @@ var GithubManager = class {
5216
5269
  merge_method: mergeMethod
5217
5270
  });
5218
5271
  }
5272
+ /**
5273
+ * Gets commits from a pull request
5274
+ *
5275
+ * Retrieves all commits associated with the specified pull request.
5276
+ * Useful for generating changelogs or analyzing changes.
5277
+ *
5278
+ * @param prNumber - Pull request number
5279
+ * @returns Promise resolving to array of commit information
5280
+ * @throws Error if request fails
5281
+ *
5282
+ * @example
5283
+ * ```typescript
5284
+ * const commits = await manager.getPullRequestCommits(123);
5285
+ * commits.forEach(commit => {
5286
+ * console.log(commit.sha, commit.commit.message);
5287
+ * });
5288
+ * ```
5289
+ */
5219
5290
  async getPullRequestCommits(prNumber) {
5220
5291
  const pr = await this.octokit.rest.pulls.listCommits({
5221
5292
  ...this.getGitHubUserInfo(),
@@ -5223,6 +5294,23 @@ var GithubManager = class {
5223
5294
  });
5224
5295
  return pr.data;
5225
5296
  }
5297
+ /**
5298
+ * Gets detailed information about a commit
5299
+ *
5300
+ * Retrieves detailed information about a specific commit,
5301
+ * including files changed, author details, and commit message.
5302
+ *
5303
+ * @param commitSha - Commit SHA
5304
+ * @returns Promise resolving to commit information
5305
+ * @throws Error if request fails
5306
+ *
5307
+ * @example
5308
+ * ```typescript
5309
+ * const info = await manager.getCommitInfo('abc123');
5310
+ * console.log(info.commit.message);
5311
+ * console.log(info.files.map(f => f.filename));
5312
+ * ```
5313
+ */
5226
5314
  async getCommitInfo(commitSha) {
5227
5315
  const pr = await this.octokit.rest.repos.getCommit({
5228
5316
  ...this.getGitHubUserInfo(),
@@ -5230,6 +5318,24 @@ var GithubManager = class {
5230
5318
  });
5231
5319
  return pr.data;
5232
5320
  }
5321
+ /**
5322
+ * Gets pull request information
5323
+ *
5324
+ * Retrieves detailed information about a pull request,
5325
+ * including title, body, labels, and review status.
5326
+ *
5327
+ * @param prNumber - Pull request number
5328
+ * @returns Promise resolving to pull request information
5329
+ * @throws Error if request fails
5330
+ *
5331
+ * @example
5332
+ * ```typescript
5333
+ * const pr = await manager.getPullRequest(123);
5334
+ * console.log(pr.title);
5335
+ * console.log(pr.labels.map(l => l.name));
5336
+ * console.log(pr.mergeable_state);
5337
+ * ```
5338
+ */
5233
5339
  async getPullRequest(prNumber) {
5234
5340
  const pr = await this.octokit.rest.pulls.get({
5235
5341
  ...this.getGitHubUserInfo(),
@@ -5243,6 +5349,27 @@ var GithubManager = class {
5243
5349
  * @param prNumber - The pull request number to check.
5244
5350
  * @param releaseBranch - The branch to check against.
5245
5351
  */
5352
+ /**
5353
+ * Checks pull request status and cleans up
5354
+ *
5355
+ * Verifies pull request status and deletes the release branch
5356
+ * if the PR has been merged. Used for post-merge cleanup.
5357
+ *
5358
+ * Process:
5359
+ * 1. Verify PR exists and status
5360
+ * 2. Delete release branch if PR merged
5361
+ * 3. Log cleanup results
5362
+ *
5363
+ * @param prNumber - Pull request number
5364
+ * @param releaseBranch - Branch to clean up
5365
+ * @throws Error if verification or cleanup fails
5366
+ *
5367
+ * @example
5368
+ * ```typescript
5369
+ * await manager.checkedPR('123', 'release-1.0.0');
5370
+ * // Verifies PR #123 and deletes release-1.0.0 if merged
5371
+ * ```
5372
+ */
5246
5373
  async checkedPR(prNumber, releaseBranch) {
5247
5374
  try {
5248
5375
  await this.getPullRequest(Number(prNumber));
@@ -5269,7 +5396,7 @@ var GithubManager = class {
5269
5396
  * @throws If the label is not valid or if the creation fails.
5270
5397
  */
5271
5398
  async createReleasePRLabel() {
5272
- const label = this.context.shared.label;
5399
+ const label = this.context.getOptions().label;
5273
5400
  if (!label || !label.name || !label.description || !label.color) {
5274
5401
  throw new Error("Label is not valid, skipping creation");
5275
5402
  }
@@ -5304,7 +5431,7 @@ var GithubManager = class {
5304
5431
  * @throws If the creation fails or if the pull request already exists.
5305
5432
  */
5306
5433
  async createReleasePR(options) {
5307
- const dryRunCreatePR = this.context.getConfig("githubPR.dryRunCreatePR");
5434
+ const dryRunCreatePR = this.context.getOptions("githubPR.dryRunCreatePR");
5308
5435
  if (dryRunCreatePR || this.context.dryRun) {
5309
5436
  this.logger.info(`[DRY RUN] Would create PR with:`, {
5310
5437
  ...options,
@@ -5343,10 +5470,55 @@ var GithubManager = class {
5343
5470
  throw error;
5344
5471
  }
5345
5472
  }
5473
+ /**
5474
+ * Truncates long PR/release body text
5475
+ *
5476
+ * GitHub has a limit on PR and release body length.
5477
+ * This method ensures the text stays within limits by
5478
+ * truncating if necessary.
5479
+ *
5480
+ * @param body - Body text to truncate
5481
+ * @returns Truncated text (if > 124000 chars)
5482
+ *
5483
+ * @example
5484
+ * ```typescript
5485
+ * const body = manager.truncateBody(veryLongText);
5486
+ * // Returns truncated text if > 124000 chars
5487
+ * // Adds '...' to indicate truncation
5488
+ * ```
5489
+ * @private
5490
+ */
5346
5491
  truncateBody(body) {
5347
5492
  if (body && body.length >= 124e3) return body.substring(0, 124e3) + "...";
5348
5493
  return body;
5349
5494
  }
5495
+ /**
5496
+ * Builds GitHub release options
5497
+ *
5498
+ * Combines default release options with provided overrides
5499
+ * and context configuration. Handles formatting of release
5500
+ * name, body, and other settings.
5501
+ *
5502
+ * @param options - Override options for release
5503
+ * @returns Complete release options
5504
+ *
5505
+ * @example
5506
+ * ```typescript
5507
+ * const opts = manager.getOctokitReleaseOptions({
5508
+ * tag_name: 'v1.0.0',
5509
+ * body: 'Release notes...'
5510
+ * });
5511
+ * // Returns merged options with defaults:
5512
+ * // {
5513
+ * // name: 'Release v1.0.0',
5514
+ * // body: 'Release notes...',
5515
+ * // draft: false,
5516
+ * // prerelease: false,
5517
+ * // ...
5518
+ * // }
5519
+ * ```
5520
+ * @private
5521
+ */
5350
5522
  getOctokitReleaseOptions(options) {
5351
5523
  const {
5352
5524
  releaseName,
@@ -5356,7 +5528,7 @@ var GithubManager = class {
5356
5528
  makeLatest = true,
5357
5529
  releaseNotes,
5358
5530
  discussionCategoryName = void 0
5359
- } = this.context.getConfig("githubPR");
5531
+ } = this.context.getOptions("githubPR");
5360
5532
  const name = releaseName;
5361
5533
  const body = autoGenerate ? "" : this.truncateBody(String(releaseNotes));
5362
5534
  return {
@@ -5372,12 +5544,43 @@ var GithubManager = class {
5372
5544
  ...this.getGitHubUserInfo()
5373
5545
  };
5374
5546
  }
5547
+ /**
5548
+ * Creates a GitHub release
5549
+ *
5550
+ * Creates a new GitHub release for a workspace with:
5551
+ * - Formatted release name
5552
+ * - Changelog as release notes
5553
+ * - Proper tag
5554
+ * - Configurable settings (draft, prerelease, etc.)
5555
+ *
5556
+ * Handles dry run mode and error cases gracefully.
5557
+ *
5558
+ * @param workspace - Workspace to create release for
5559
+ * @throws Error if tag name is missing or creation fails
5560
+ *
5561
+ * @example Basic release
5562
+ * ```typescript
5563
+ * await manager.createRelease({
5564
+ * name: 'pkg-a',
5565
+ * version: '1.0.0',
5566
+ * tagName: 'v1.0.0',
5567
+ * changelog: '...'
5568
+ * });
5569
+ * ```
5570
+ *
5571
+ * @example Dry run
5572
+ * ```typescript
5573
+ * context.dryRun = true;
5574
+ * await manager.createRelease(workspace);
5575
+ * // Logs release info without creating
5576
+ * ```
5577
+ */
5375
5578
  async createRelease(workspace) {
5376
5579
  const meragedOptions = this.getOctokitReleaseOptions({
5377
5580
  tag_name: workspace.tagName,
5378
5581
  body: workspace.changelog
5379
5582
  });
5380
- meragedOptions.name = this.shell.format(
5583
+ meragedOptions.name = Shell2.format(
5381
5584
  meragedOptions.name,
5382
5585
  workspace
5383
5586
  );
@@ -5391,110 +5594,56 @@ var GithubManager = class {
5391
5594
  throw new Error("TagName is undefined");
5392
5595
  }
5393
5596
  if (this.context.dryRun) {
5394
- return;
5395
- }
5396
- try {
5397
- const response = await this.octokit.repos.createRelease(meragedOptions);
5398
- this.logger.debug(
5399
- `[DONE] octokit repos.createRelease "${meragedOptions.name}" (${meragedOptions.tag_name}) (${response.headers.location})`
5400
- );
5401
- } catch (error) {
5402
- this.logger.error(
5403
- `[FAILED] octokit repos.createRelease "${meragedOptions.name}" (${meragedOptions.tag_name})`,
5404
- error
5405
- );
5406
- }
5407
- }
5408
- };
5409
-
5410
- // src/plugins/GitBase.ts
5411
- var import_isString = __toESM(require_isString(), 1);
5412
-
5413
- // src/plugins/Plugin.ts
5414
- var import_merge2 = __toESM(require_merge(), 1);
5415
- var import_get2 = __toESM(require_get(), 1);
5416
- var Plugin = class {
5417
- constructor(context, pluginName, props = {}) {
5418
- this.context = context;
5419
- this.pluginName = pluginName;
5420
- this.props = props;
5421
- this.setConfig(this.getInitialProps(props));
5422
- }
5423
- onlyOne = true;
5424
- getInitialProps(props) {
5425
- const pluginConfig = this.context.options[this.pluginName];
5426
- const fileConfig = (0, import_get2.default)(this.context.shared, this.pluginName);
5427
- return pluginConfig || props ? (0, import_merge2.default)({}, fileConfig, props, pluginConfig) : {};
5428
- }
5429
- get logger() {
5430
- return this.context.logger;
5431
- }
5432
- get shell() {
5433
- return this.context.shell;
5434
- }
5435
- get options() {
5436
- return this.context.getConfig(this.pluginName, {});
5437
- }
5438
- getEnv(key, defaultValue) {
5439
- return this.context.env.get(key) ?? defaultValue;
5440
- }
5441
- enabled(_name, _context) {
5442
- return true;
5443
- }
5444
- getConfig(keys, defaultValue) {
5445
- if (!keys) {
5446
- return this.context.getConfig(this.pluginName, defaultValue);
5447
- }
5448
- return this.context.getConfig(
5449
- [this.pluginName, ...Array.isArray(keys) ? keys : [keys]],
5450
- defaultValue
5451
- );
5452
- }
5453
- setConfig(config) {
5454
- this.context.setConfig({
5455
- [this.pluginName]: config
5456
- });
5457
- }
5458
- onBefore(_context) {
5459
- }
5460
- onExec(_context) {
5461
- }
5462
- onSuccess(_context) {
5463
- }
5464
- onError(_context) {
5465
- }
5466
- /**
5467
- * run a step
5468
- *
5469
- * this will log the step and return the result of the task
5470
- *
5471
- * @param label - the label of the step
5472
- * @param task - the task to run
5473
- * @returns the result of the task
5474
- */
5475
- async step({ label, task }) {
5476
- this.logger.log();
5477
- this.logger.info(label);
5478
- this.logger.log();
5597
+ return;
5598
+ }
5479
5599
  try {
5480
- const res = await task();
5481
- this.logger.info(`${label} - success`);
5482
- return res;
5483
- } catch (e) {
5484
- this.logger.error(e);
5485
- throw e;
5600
+ const response = await this.octokit.repos.createRelease(meragedOptions);
5601
+ this.logger.debug(
5602
+ `[DONE] octokit repos.createRelease "${meragedOptions.name}" (${meragedOptions.tag_name}) (${response.headers.location})`
5603
+ );
5604
+ } catch (error) {
5605
+ this.logger.error(
5606
+ `[FAILED] octokit repos.createRelease "${meragedOptions.name}" (${meragedOptions.tag_name})`,
5607
+ error
5608
+ );
5486
5609
  }
5487
5610
  }
5488
5611
  };
5489
5612
 
5490
5613
  // src/plugins/GitBase.ts
5491
- var GitBase = class extends Plugin {
5614
+ var import_isString = __toESM(require_isString(), 1);
5615
+ import { ScriptPlugin } from "@qlover/scripts-context";
5616
+ var GitBase = class extends ScriptPlugin {
5617
+ /**
5618
+ * Plugin initialization hook
5619
+ *
5620
+ * Runs before plugin execution to set up repository context:
5621
+ * 1. Retrieves repository information
5622
+ * 2. Gets current branch
5623
+ * 3. Switches to current branch if needed
5624
+ * 4. Updates context with repository info
5625
+ *
5626
+ * @throws Error if repository information cannot be retrieved
5627
+ *
5628
+ * @example
5629
+ * ```typescript
5630
+ * class MyPlugin extends GitBase<GitBaseProps> {
5631
+ * async onExec() {
5632
+ * // onBefore has already:
5633
+ * // - Set up repository info
5634
+ * // - Switched to correct branch
5635
+ * // - Updated context
5636
+ * await this.doSomething();
5637
+ * }
5638
+ * }
5639
+ * ```
5640
+ */
5492
5641
  async onBefore() {
5493
5642
  const repoInfo = await this.getUserInfo();
5494
5643
  if (!repoInfo) {
5495
5644
  throw new Error("Failed to get repoInfo");
5496
5645
  }
5497
- let currentBranch = this.context.shared.currentBranch;
5646
+ let currentBranch = this.context.options.currentBranch;
5498
5647
  if (!currentBranch) {
5499
5648
  currentBranch = await this.getCurrentBranch();
5500
5649
  }
@@ -5503,18 +5652,50 @@ var GitBase = class extends Plugin {
5503
5652
  dryRun: false
5504
5653
  });
5505
5654
  }
5506
- this.context.setShared({
5655
+ this.context.setOptions({
5507
5656
  repoName: repoInfo.repoName,
5508
5657
  authorName: repoInfo.authorName,
5509
5658
  currentBranch
5510
5659
  });
5511
5660
  }
5661
+ /**
5662
+ * Gets the current Git branch name
5663
+ *
5664
+ * Retrieves the name of the currently checked out Git branch.
5665
+ * Includes a small delay to ensure Git's internal state is updated.
5666
+ *
5667
+ * @returns Promise resolving to branch name
5668
+ * @throws Error if branch name cannot be retrieved
5669
+ *
5670
+ * @example
5671
+ * ```typescript
5672
+ * const branch = await plugin.getCurrentBranch();
5673
+ * // 'main' or 'feature/new-feature'
5674
+ * ```
5675
+ */
5512
5676
  async getCurrentBranch() {
5513
5677
  await new Promise((resolve2) => setTimeout(resolve2, 100));
5514
5678
  return this.context.shell.exec("git rev-parse --abbrev-ref HEAD", {
5515
5679
  dryRun: false
5516
5680
  });
5517
5681
  }
5682
+ /**
5683
+ * Gets the Git remote URL
5684
+ *
5685
+ * Retrieves the URL of the 'origin' remote from Git configuration.
5686
+ * This URL is used to identify the GitHub repository.
5687
+ *
5688
+ * @returns Promise resolving to remote URL
5689
+ * @throws Error if remote URL cannot be retrieved
5690
+ *
5691
+ * @example
5692
+ * ```typescript
5693
+ * const url = await plugin.getRemoteUrl();
5694
+ * // 'https://github.com/org/repo.git'
5695
+ * // or
5696
+ * // 'git@github.com:org/repo.git'
5697
+ * ```
5698
+ */
5518
5699
  async getRemoteUrl() {
5519
5700
  return (await this.context.shell.exec("git config --get remote.origin.url", {
5520
5701
  dryRun: false
@@ -5568,9 +5749,53 @@ var GitBase = class extends Plugin {
5568
5749
  * @param value - The value to check.
5569
5750
  * @returns True if the value is a valid string, otherwise false.
5570
5751
  */
5752
+ /**
5753
+ * Type guard for valid string values
5754
+ *
5755
+ * Checks if a value is a non-empty string. Used for validating
5756
+ * repository information and other string inputs.
5757
+ *
5758
+ * @param value - Value to check
5759
+ * @returns True if value is a non-empty string
5760
+ *
5761
+ * @example
5762
+ * ```typescript
5763
+ * if (plugin.isValidString(value)) {
5764
+ * // value is definitely a non-empty string
5765
+ * console.log(value.toUpperCase());
5766
+ * }
5767
+ * ```
5768
+ */
5571
5769
  isValidString(value) {
5572
5770
  return !!value && (0, import_isString.default)(value);
5573
5771
  }
5772
+ /**
5773
+ * Creates a Git commit
5774
+ *
5775
+ * Creates a new Git commit with the specified message and optional
5776
+ * additional arguments. The message is automatically JSON-stringified
5777
+ * to handle special characters properly.
5778
+ *
5779
+ * @param message - Commit message
5780
+ * @param args - Additional Git commit arguments
5781
+ * @returns Promise resolving to command output
5782
+ *
5783
+ * @example Basic commit
5784
+ * ```typescript
5785
+ * await plugin.commit('feat: add new feature');
5786
+ * ```
5787
+ *
5788
+ * @example Commit with arguments
5789
+ * ```typescript
5790
+ * await plugin.commit('fix: update deps', ['--no-verify']);
5791
+ * ```
5792
+ *
5793
+ * @example Commit with special characters
5794
+ * ```typescript
5795
+ * await plugin.commit('fix: handle "quotes" & symbols');
5796
+ * // Message is automatically escaped
5797
+ * ```
5798
+ */
5574
5799
  commit(message, args = []) {
5575
5800
  return this.context.shell.exec([
5576
5801
  "git",
@@ -5605,24 +5830,60 @@ var CHANGELOG_ALL_FIELDS = [
5605
5830
  "tag"
5606
5831
  ];
5607
5832
  var GitChangelog = class {
5833
+ /**
5834
+ * Creates a new GitChangelog instance
5835
+ *
5836
+ * @param options - Configuration options including shell and logger
5837
+ *
5838
+ * @example
5839
+ * ```typescript
5840
+ * const changelog = new GitChangelog({
5841
+ * shell: new Shell(),
5842
+ * logger: new Logger(),
5843
+ * directory: 'packages/my-pkg',
5844
+ * noMerges: true
5845
+ * });
5846
+ * ```
5847
+ */
5608
5848
  constructor(options) {
5609
5849
  this.options = options;
5610
5850
  }
5611
5851
  /**
5612
- * Get the git log
5852
+ * Retrieves Git commit history with specified options
5613
5853
  *
5614
- * @param options
5615
- * @returns
5854
+ * Fetches commit information between specified tags or commits,
5855
+ * with support for filtering and field selection.
5856
+ *
5857
+ * @param options - Configuration options for Git log retrieval
5858
+ * @returns Array of commit objects with requested fields
5859
+ *
5860
+ * @example Basic usage
5861
+ * ```typescript
5862
+ * const commits = await changelog.getGitLog({
5863
+ * from: 'v1.0.0',
5864
+ * to: 'v2.0.0',
5865
+ * directory: 'packages/my-pkg',
5866
+ * noMerges: true
5867
+ * });
5868
+ * ```
5869
+ *
5870
+ * @example Custom fields
5871
+ * ```typescript
5872
+ * const commits = await changelog.getGitLog({
5873
+ * fields: ['hash', 'subject', 'authorName'],
5874
+ * directory: 'src'
5875
+ * });
5876
+ * ```
5616
5877
  */
5617
5878
  async getGitLog(options = {}) {
5618
- const { directory, noMerges = true, fileds } = options;
5879
+ const { directory, noMerges = true, fields } = options;
5619
5880
  const from = await this.resolveTag(options.from, "root");
5620
5881
  const to = await this.resolveTag(options.to, "HEAD");
5621
5882
  const range = from === to ? to : `${from}..${to}`;
5622
5883
  const gitLogOptions = {
5623
5884
  repo: ".",
5624
5885
  number: 1e3,
5625
- fields: fileds,
5886
+ fields,
5626
5887
  branch: range,
5627
5888
  file: directory,
5628
5889
  nameStatus: false,
@@ -5633,6 +5894,38 @@ var GitChangelog = class {
5633
5894
  this.options.logger?.debug("GitChangelog commits", commits);
5634
5895
  return commits;
5635
5896
  }
5897
+ /**
5898
+ * Retrieves and parses Git commits with metadata
5899
+ *
5900
+ * Gets commit history and enhances it with parsed conventional
5901
+ * commit information and PR metadata.
5902
+ *
5903
+ * @param options - Configuration options for Git log retrieval
5904
+ * @returns Array of enhanced commit objects with parsed metadata
5905
+ *
5906
+ * @example Basic usage
5907
+ * ```typescript
5908
+ * const commits = await changelog.getCommits({
5909
+ * from: 'v1.0.0',
5910
+ * to: 'v2.0.0'
5911
+ * });
5912
+ * // [
5913
+ * // {
5914
+ * // base: { hash: '...', subject: '...' },
5915
+ * // commitlint: { type: 'feat', scope: 'api', ... },
5916
+ * // commits: []
5917
+ * // }
5918
+ * // ]
5919
+ * ```
5920
+ *
5921
+ * @example Filtered commits
5922
+ * ```typescript
5923
+ * const commits = await changelog.getCommits({
5924
+ * directory: 'packages/my-pkg',
5925
+ * noMerges: true
5926
+ * });
5927
+ * ```
5928
+ */
5636
5929
  async getCommits(options) {
5637
5930
  const gitCommits = await this.getGitLog(options);
5638
5931
  return gitCommits.map((commit) => {
@@ -5645,6 +5938,28 @@ var GitChangelog = class {
5645
5938
  };
5646
5939
  });
5647
5940
  }
5941
+ /**
5942
+ * Creates a base commit object from message and optional data
5943
+ *
5944
+ * Utility method to create a standardized commit object with
5945
+ * basic metadata. Used internally for commit value creation.
5946
+ *
5947
+ * @param message - Commit message
5948
+ * @param target - Optional additional commit data
5949
+ * @returns Base commit object
5950
+ * @protected
5951
+ *
5952
+ * @example
5953
+ * ```typescript
5954
+ * const commit = changelog.createBaseCommit(
5955
+ * 'feat: new feature',
5956
+ * {
5957
+ * hash: 'abc123',
5958
+ * authorName: 'John Doe'
5959
+ * }
5960
+ * );
5961
+ * ```
5962
+ */
5648
5963
  createBaseCommit(message, target) {
5649
5964
  return {
5650
5965
  subject: message,
@@ -5654,16 +5969,66 @@ var GitChangelog = class {
5654
5969
  };
5655
5970
  }
5656
5971
  /**
5657
- * Tabify the body
5972
+ * Indents each line of a text block
5973
+ *
5974
+ * Adds specified number of spaces to the start of each line
5975
+ * in a multi-line string. Used for formatting commit body text.
5658
5976
  *
5659
5977
  * @since 2.3.2
5660
- * @param body
5661
- * @param size
5662
- * @returns
5978
+ * @param body - Text to indent
5979
+ * @param size - Number of spaces to add (default: 2)
5980
+ * @returns Indented text
5981
+ *
5982
+ * @example
5983
+ * ```typescript
5984
+ * const text = changelog.tabify(
5985
+ * 'Line 1\nLine 2\nLine 3',
5986
+ * 4
5987
+ * );
5988
+ * // ' Line 1\n Line 2\n Line 3'
5989
+ * ```
5663
5990
  */
5664
5991
  tabify(body, size = 2) {
5665
5992
  return body.split("\n").map((line) => " ".repeat(size) + line.trim()).join("\n");
5666
5993
  }
5994
+ /**
5995
+ * Parses a commit message into conventional commit format
5996
+ *
5997
+ * Extracts type, scope, message, and body from a commit message
5998
+ * following the conventional commit specification.
5999
+ *
6000
+ * Format: type(scope): message
6001
+ *
6002
+ * @param subject - Commit subject line
6003
+ * @param rawBody - Full commit message body
6004
+ * @returns Parsed conventional commit data
6005
+ *
6006
+ * @example Basic commit
6007
+ * ```typescript
6008
+ * const commit = changelog.parseCommitlint(
6009
+ * 'feat(api): add new endpoint'
6010
+ * );
6011
+ * // {
6012
+ * // type: 'feat',
6013
+ * // scope: 'api',
6014
+ * // message: 'add new endpoint'
6015
+ * // }
6016
+ * ```
6017
+ *
6018
+ * @example With body
6019
+ * ```typescript
6020
+ * const commit = changelog.parseCommitlint(
6021
+ * 'fix(core): memory leak',
6022
+ * 'Fixed memory leak in core module\n\nBREAKING CHANGE: API changed'
6023
+ * );
6024
+ * // {
6025
+ * // type: 'fix',
6026
+ * // scope: 'core',
6027
+ * // message: 'memory leak',
6028
+ * // body: ' Fixed memory leak in core module\n\n BREAKING CHANGE: API changed'
6029
+ * // }
6030
+ * ```
6031
+ */
5667
6032
  parseCommitlint(subject, rawBody = "") {
5668
6033
  const [title] = subject.trim().split("\n");
5669
6034
  const bodyLines = rawBody.startsWith(title) ? rawBody.replace(title, "") : rawBody;
@@ -5682,6 +6047,51 @@ var GitChangelog = class {
5682
6047
  body: bodyLines ? this.tabify(bodyLines) : void 0
5683
6048
  };
5684
6049
  }
6050
+ /**
6051
+ * Creates a complete commit value object from hash and message
6052
+ *
6053
+ * Combines commit hash, parsed conventional commit data, and
6054
+ * PR information into a single commit value object.
6055
+ *
6056
+ * @param hash - Commit hash
6057
+ * @param message - Full commit message
6058
+ * @returns Complete commit value object
6059
+ *
6060
+ * @example Basic commit
6061
+ * ```typescript
6062
+ * const commit = changelog.toCommitValue(
6063
+ * 'abc123',
6064
+ * 'feat(api): new endpoint'
6065
+ * );
6066
+ * // {
6067
+ * // base: {
6068
+ * // hash: 'abc123',
6069
+ * // abbrevHash: 'abc123',
6070
+ * // subject: 'feat(api): new endpoint'
6071
+ * // },
6072
+ * // commitlint: {
6073
+ * // type: 'feat',
6074
+ * // scope: 'api',
6075
+ * // message: 'new endpoint'
6076
+ * // },
6077
+ * // commits: []
6078
+ * // }
6079
+ * ```
6080
+ *
6081
+ * @example PR commit
6082
+ * ```typescript
6083
+ * const commit = changelog.toCommitValue(
6084
+ * 'def456',
6085
+ * 'fix(core): memory leak (#123)'
6086
+ * );
6087
+ * // {
6088
+ * // base: { hash: 'def456', ... },
6089
+ * // commitlint: { type: 'fix', ... },
6090
+ * // commits: [],
6091
+ * // prNumber: '123'
6092
+ * // }
6093
+ * ```
6094
+ */
5685
6095
  toCommitValue(hash, message) {
5686
6096
  const [title] = message.trim().split("\n");
5687
6097
  const prMatch = title.match(/\(#(\d+)\)/);
@@ -5699,6 +6109,33 @@ var GitChangelog = class {
5699
6109
  prNumber: prMatch?.[1]
5700
6110
  };
5701
6111
  }
6112
+ /**
6113
+ * Resolves a Git tag or reference to a valid commit reference
6114
+ *
6115
+ * Attempts to resolve a tag name to a valid Git reference.
6116
+ * Falls back to root commit or HEAD if tag doesn't exist.
6117
+ *
6118
+ * @param tag - Tag name to resolve
6119
+ * @param fallback - Fallback value ('root' or 'HEAD')
6120
+ * @returns Resolved Git reference
6121
+ * @protected
6122
+ *
6123
+ * @example Basic tag resolution
6124
+ * ```typescript
6125
+ * const ref = await changelog.resolveTag('v1.0.0');
6126
+ * // 'v1.0.0' if tag exists
6127
+ * // 'HEAD' if tag doesn't exist
6128
+ * ```
6129
+ *
6130
+ * @example Root commit fallback
6131
+ * ```typescript
6132
+ * const ref = await changelog.resolveTag(
6133
+ * 'non-existent-tag',
6134
+ * 'root'
6135
+ * );
6136
+ * // First commit hash if tag doesn't exist
6137
+ * ```
6138
+ */
5702
6139
  async resolveTag(tag, fallback) {
5703
6140
  if (tag) {
5704
6141
  try {
@@ -5716,11 +6153,78 @@ var GitChangelog = class {
5716
6153
 
5717
6154
  // src/implments/changelog/GitChangelogFormatter.ts
5718
6155
  var import_groupBy = __toESM(require_groupBy(), 1);
6156
+ import { Shell as Shell3 } from "@qlover/scripts-context";
5719
6157
  var DEFAULT_TEMPLATE = "\n- ${scopeHeader} ${commitlint.message} ${commitLink} ${prLink}";
5720
6158
  var GitChangelogFormatter = class {
6159
+ /**
6160
+ * Creates a new GitChangelogFormatter instance
6161
+ *
6162
+ * @param options - Configuration options including shell interface
6163
+ *
6164
+ * @example
6165
+ * ```typescript
6166
+ * const formatter = new GitChangelogFormatter({
6167
+ * shell: new Shell(),
6168
+ * repoUrl: 'https://github.com/org/repo',
6169
+ * types: [
6170
+ * { type: 'feat', section: '### Features' }
6171
+ * ],
6172
+ * formatTemplate: '- ${commitlint.message}'
6173
+ * });
6174
+ * ```
6175
+ */
5721
6176
  constructor(options) {
5722
6177
  this.options = options;
5723
6178
  }
6179
+ /**
6180
+ * Formats an array of commits into changelog entries
6181
+ *
6182
+ * Groups commits by type and formats them according to the
6183
+ * configured template and options. Supports commit body
6184
+ * inclusion and type-based sections.
6185
+ *
6186
+ * @param commits - Array of commit values to format
6187
+ * @param options - Optional formatting options
6188
+ * @returns Array of formatted changelog lines
6189
+ *
6190
+ * @example Basic formatting
6191
+ * ```typescript
6192
+ * const changelog = formatter.format([
6193
+ * {
6194
+ * base: { hash: 'abc123' },
6195
+ * commitlint: {
6196
+ * type: 'feat',
6197
+ * scope: 'api',
6198
+ * message: 'new endpoint'
6199
+ * }
6200
+ * }
6201
+ * ]);
6202
+ * // [
6203
+ * // '### Features',
6204
+ * // '- **api:** new endpoint ([abc123](...))'
6205
+ * // ]
6206
+ * ```
6207
+ *
6208
+ * @example With commit body
6209
+ * ```typescript
6210
+ * const changelog = formatter.format(
6211
+ * [{
6212
+ * commitlint: {
6213
+ * type: 'fix',
6214
+ * message: 'memory leak',
6215
+ * body: 'Fixed memory allocation\nAdded cleanup'
6216
+ * }
6217
+ * }],
6218
+ * { commitBody: true }
6219
+ * );
6220
+ * // [
6221
+ * // '### Bug Fixes',
6222
+ * // '- memory leak',
6223
+ * // ' Fixed memory allocation',
6224
+ * // ' Added cleanup'
6225
+ * // ]
6226
+ * ```
6227
+ */
5724
6228
  format(commits, options) {
5725
6229
  const { types = [], commitBody = false } = { ...this.options, ...options };
5726
6230
  const changelog = [];
@@ -5747,6 +6251,41 @@ var GitChangelogFormatter = class {
5747
6251
  });
5748
6252
  return changelog;
5749
6253
  }
6254
+ /**
6255
+ * Formats a single commit into a changelog entry
6256
+ *
6257
+ * Applies the configured template to a commit, including
6258
+ * scope formatting, PR links, and commit hash links.
6259
+ *
6260
+ * @param commit - Commit value to format
6261
+ * @param options - Optional formatting options
6262
+ * @returns Formatted changelog entry
6263
+ *
6264
+ * @example Basic formatting
6265
+ * ```typescript
6266
+ * const entry = formatter.formatCommit({
6267
+ * base: { hash: 'abc123' },
6268
+ * commitlint: {
6269
+ * type: 'feat',
6270
+ * scope: 'api',
6271
+ * message: 'new endpoint'
6272
+ * }
6273
+ * });
6274
+ * // '- **api:** new endpoint ([abc123](...))'
6275
+ * ```
6276
+ *
6277
+ * @example With PR number
6278
+ * ```typescript
6279
+ * const entry = formatter.formatCommit({
6280
+ * base: { hash: 'def456' },
6281
+ * commitlint: {
6282
+ * message: 'fix bug'
6283
+ * },
6284
+ * prNumber: '123'
6285
+ * });
6286
+ * // '- fix bug ([def456](...)) (#123)'
6287
+ * ```
6288
+ */
5750
6289
  formatCommit(commit, options) {
5751
6290
  const {
5752
6291
  commitlint,
@@ -5766,19 +6305,72 @@ var GitChangelogFormatter = class {
5766
6305
  hash.slice(0, 7),
5767
6306
  repoUrl ? `${repoUrl}/commit/${hash}` : ""
5768
6307
  ) : "";
5769
- return this.options.shell.format(formatTemplate, {
6308
+ return Shell3.format(formatTemplate, {
5770
6309
  ...commit,
5771
6310
  scopeHeader,
5772
6311
  commitLink: hashLink,
5773
6312
  prLink
5774
6313
  });
5775
6314
  }
6315
+ /**
6316
+ * Formats a target string as a Markdown link
6317
+ *
6318
+ * Creates a Markdown-formatted link with optional URL.
6319
+ * If no URL is provided, formats as a plain reference.
6320
+ *
6321
+ * @param target - Text to display
6322
+ * @param url - Optional URL for the link
6323
+ * @returns Formatted Markdown link
6324
+ *
6325
+ * @example With URL
6326
+ * ```typescript
6327
+ * const link = formatter.foramtLink('abc123', 'https://github.com/org/repo/commit/abc123');
6328
+ * // '([abc123](https://github.com/org/repo/commit/abc123))'
6329
+ * ```
6330
+ *
6331
+ * @example Without URL
6332
+ * ```typescript
6333
+ * const link = formatter.foramtLink('abc123');
6334
+ * // '(abc123)'
6335
+ * ```
6336
+ */
5776
6337
  foramtLink(target, url) {
5777
6338
  return url ? `([${target}](${url}))` : `(${target})`;
5778
6339
  }
6340
+ /**
6341
+ * Formats a commit hash as a Markdown link
6342
+ *
6343
+ * @deprecated Use foramtLink instead
6344
+ * @param target - Commit hash to display
6345
+ * @param url - Optional URL to the commit
6346
+ * @returns Formatted Markdown link
6347
+ *
6348
+ * @example
6349
+ * ```typescript
6350
+ * const link = formatter.formatCommitLink(
6351
+ * 'abc123',
6352
+ * 'https://github.com/org/repo/commit/abc123'
6353
+ * );
6354
+ * // '([abc123](https://github.com/org/repo/commit/abc123))'
6355
+ * ```
6356
+ */
5779
6357
  formatCommitLink(target, url) {
5780
6358
  return url ? `([${target}](${url}))` : `(${target})`;
5781
6359
  }
6360
+ /**
6361
+ * Formats a commit scope in Markdown
6362
+ *
6363
+ * Wraps the scope in bold syntax and adds a colon.
6364
+ *
6365
+ * @param scope - Scope to format
6366
+ * @returns Formatted scope in Markdown
6367
+ *
6368
+ * @example
6369
+ * ```typescript
6370
+ * const scope = formatter.formatScope('api');
6371
+ * // '**api:**'
6372
+ * ```
6373
+ */
5782
6374
  formatScope(scope) {
5783
6375
  return `**${scope}:**`;
5784
6376
  }
@@ -5832,7 +6424,30 @@ var Pather = class {
5832
6424
  return child[boundaryIndex] === sep;
5833
6425
  }
5834
6426
  /**
5835
- * Normalised `startsWith` helper.
6427
+ * Normalized path prefix check
6428
+ *
6429
+ * Checks if sourcePath starts with targetPath after normalization.
6430
+ * Handles cross-platform path separators and trailing separators.
6431
+ *
6432
+ * @param sourcePath - Path to check
6433
+ * @param targetPath - Prefix path to match
6434
+ * @returns True if sourcePath starts with targetPath
6435
+ *
6436
+ * @example Basic usage
6437
+ * ```typescript
6438
+ * const pather = new Pather();
6439
+ *
6440
+ * pather.startsWith('src/utils/file.ts', 'src') // true
6441
+ * pather.startsWith('src\\utils\\file.ts', 'src') // true
6442
+ * pather.startsWith('lib/utils/file.ts', 'src') // false
6443
+ * ```
6444
+ *
6445
+ * @example Trailing separators
6446
+ * ```typescript
6447
+ * pather.startsWith('src/utils', 'src/') // true
6448
+ * pather.startsWith('src/utils/', 'src') // true
6449
+ * pather.startsWith('src2/utils', 'src') // false
6450
+ * ```
5836
6451
  */
5837
6452
  startsWith(sourcePath, targetPath) {
5838
6453
  let src = this.toLocalPath(sourcePath);
@@ -5846,7 +6461,44 @@ var Pather = class {
5846
6461
  return src.startsWith(tgt);
5847
6462
  }
5848
6463
  /**
5849
- * Segment-aware containment check (not mere substring).
6464
+ * Segment-aware path containment check
6465
+ *
6466
+ * Checks if sourcePath contains targetPath as a complete path segment.
6467
+ * Unlike simple substring matching, this ensures proper path boundaries.
6468
+ * For example, 'src/abc' does not contain 'src/a' even though 'src/a'
6469
+ * is a substring.
6470
+ *
6471
+ * Features:
6472
+ * - Cross-platform path handling
6473
+ * - Proper segment boundary checking
6474
+ * - Trailing separator normalization
6475
+ * - Exact match support
6476
+ *
6477
+ * @param sourcePath - Path to search in
6478
+ * @param targetPath - Path to search for
6479
+ * @returns True if sourcePath contains targetPath as a segment
6480
+ *
6481
+ * @example Basic usage
6482
+ * ```typescript
6483
+ * const pather = new Pather();
6484
+ *
6485
+ * pather.containsPath('src/utils/file.ts', 'utils') // true
6486
+ * pather.containsPath('src/utils/file.ts', 'src/utils') // true
6487
+ * pather.containsPath('src/utils/file.ts', 'til') // false
6488
+ * ```
6489
+ *
6490
+ * @example Segment boundaries
6491
+ * ```typescript
6492
+ * pather.containsPath('src/abc/file.ts', 'src/a') // false
6493
+ * pather.containsPath('src/abc/file.ts', 'src/abc') // true
6494
+ * ```
6495
+ *
6496
+ * @example Trailing separators
6497
+ * ```typescript
6498
+ * pather.containsPath('src/utils/', 'utils') // true
6499
+ * pather.containsPath('src/utils', 'utils/') // true
6500
+ * pather.containsPath('src/utils/', 'utils/') // true
6501
+ * ```
5850
6502
  */
5851
6503
  containsPath(sourcePath, targetPath) {
5852
6504
  let src = this.toLocalPath(sourcePath);
@@ -5872,18 +6524,49 @@ var Pather = class {
5872
6524
  // src/plugins/githubPR/GithubChangelog.ts
5873
6525
  var DOMAIN = "https://github.com";
5874
6526
  var GithubChangelog = class _GithubChangelog extends GitChangelog {
6527
+ /**
6528
+ * Creates a new GitHub changelog generator
6529
+ *
6530
+ * @param options - Changelog generation options
6531
+ * @param githubManager - GitHub API manager
6532
+ *
6533
+ * @example
6534
+ * ```typescript
6535
+ * const changelog = new GithubChangelog({
6536
+ * shell,
6537
+ * logger,
6538
+ * mergePRcommit: true,
6539
+ * githubRootPath: 'https://github.com/org/repo'
6540
+ * }, githubManager);
6541
+ * ```
6542
+ */
5875
6543
  constructor(options, githubManager) {
5876
6544
  super(options);
5877
6545
  this.options = options;
5878
6546
  this.githubManager = githubManager;
5879
6547
  }
6548
+ /** Path manipulation utility */
5880
6549
  pather = new Pather();
5881
6550
  /**
5882
- * Filter commits by directory
5883
- * @param commits - commits
5884
- * @param directory - directory
5885
- * @returns filtered commits
6551
+ * Filters commits by directory
6552
+ *
6553
+ * Filters commits based on whether they contain changes in
6554
+ * the specified directory. Uses GitHub API to get detailed
6555
+ * commit information.
6556
+ *
6557
+ * @param commits - Array of commits to filter
6558
+ * @param directory - Directory path to filter by
6559
+ * @returns Promise resolving to filtered commits
5886
6560
  * @since 2.4.0
6561
+ *
6562
+ * @example
6563
+ * ```typescript
6564
+ * const commits = await changelog.filterCommitsByDirectory(
6565
+ * allCommits,
6566
+ * 'packages/pkg-a'
6567
+ * );
6568
+ * // Only commits that modified files in packages/pkg-a
6569
+ * ```
5887
6570
  */
5888
6571
  async filterCommitsByDirectory(commits, directory) {
5889
6572
  const result = [];
@@ -5901,6 +6584,41 @@ var GithubChangelog = class _GithubChangelog extends GitChangelog {
5901
6584
  }
5902
6585
  return result;
5903
6586
  }
6587
+ /**
6588
+ * Gets complete commit information with PR details
6589
+ *
6590
+ * Retrieves commits and enhances them with pull request
6591
+ * information. For commits associated with PRs, includes
6592
+ * all PR commits and filters by directory.
6593
+ *
6594
+ * Process:
6595
+ * 1. Get base commits
6596
+ * 2. Extract PR numbers
6597
+ * 3. Fetch PR commits
6598
+ * 4. Filter by directory
6599
+ * 5. Flatten results
6600
+ *
6601
+ * @param options - Changelog options
6602
+ * @returns Promise resolving to enhanced commits
6603
+ *
6604
+ * @example Basic usage
6605
+ * ```typescript
6606
+ * const commits = await changelog.getFullCommit({
6607
+ * from: 'v1.0.0',
6608
+ * directory: 'packages/pkg-a'
6609
+ * });
6610
+ * // Returns commits with PR information
6611
+ * ```
6612
+ *
6613
+ * @example With PR merging
6614
+ * ```typescript
6615
+ * const commits = await changelog.getFullCommit({
6616
+ * mergePRcommit: true,
6617
+ * directory: 'packages/pkg-a'
6618
+ * });
6619
+ * // Includes all PR commits
6620
+ * ```
6621
+ */
5904
6622
  async getFullCommit(options) {
5905
6623
  const _options = { ...this.options, ...options };
5906
6624
  const allCommits = await this.getCommits(_options);
@@ -5928,14 +6646,49 @@ var GithubChangelog = class _GithubChangelog extends GitChangelog {
5928
6646
  );
5929
6647
  return newallCommits.flat();
5930
6648
  }
6649
+ /**
6650
+ * Transforms workspaces with GitHub changelogs
6651
+ *
6652
+ * Processes each workspace to add GitHub-specific changelog
6653
+ * information. Includes:
6654
+ * - GitHub repository URL
6655
+ * - PR-aware commit history
6656
+ * - Formatted changelog with links
6657
+ *
6658
+ * Process:
6659
+ * 1. Build GitHub root path
6660
+ * 2. Configure changelog options
6661
+ * 3. Get commits for each workspace
6662
+ * 4. Format changelog with links
6663
+ * 5. Update workspace objects
6664
+ *
6665
+ * @param workspaces - Array of workspaces to process
6666
+ * @param context - Release context
6667
+ * @returns Promise resolving to updated workspaces
6668
+ *
6669
+ * @example
6670
+ * ```typescript
6671
+ * const workspaces = await changelog.transformWorkspace(
6672
+ * [
6673
+ * {
6674
+ * name: 'pkg-a',
6675
+ * path: 'packages/a',
6676
+ * lastTag: 'v1.0.0'
6677
+ * }
6678
+ * ],
6679
+ * context
6680
+ * );
6681
+ * // Returns workspaces with GitHub-formatted changelogs
6682
+ * ```
6683
+ */
5931
6684
  async transformWorkspace(workspaces, context) {
5932
6685
  const githubRootPath = [
5933
6686
  DOMAIN,
5934
- context.shared.authorName,
5935
- context.shared.repoName
6687
+ context.getOptions("authorName"),
6688
+ context.getOptions("repoName")
5936
6689
  ].join("/");
5937
6690
  const changelogProps = {
5938
- ...context.getConfig("changelog"),
6691
+ ...context.getOptions("changelog"),
5939
6692
  githubRootPath,
5940
6693
  mergePRcommit: true,
5941
6694
  shell: context.shell,
@@ -5951,7 +6704,7 @@ var GithubChangelog = class _GithubChangelog extends GitChangelog {
5951
6704
  const changelog = await githubChangelog.getFullCommit({
5952
6705
  from: workspace.lastTag ?? "",
5953
6706
  directory: workspace.path,
5954
- fileds: CHANGELOG_ALL_FIELDS
6707
+ fields: CHANGELOG_ALL_FIELDS
5955
6708
  });
5956
6709
  if (typeof changelog === "string") {
5957
6710
  return {
@@ -5973,9 +6726,30 @@ var GithubChangelog = class _GithubChangelog extends GitChangelog {
5973
6726
  };
5974
6727
 
5975
6728
  // src/plugins/githubPR/GithubPR.ts
6729
+ import { Shell as Shell4 } from "@qlover/scripts-context";
5976
6730
  var DEFAULT_RELEASE_NAME = "Release ${name} v${version}";
5977
6731
  var DEFAULT_COMMIT_MESSAGE = "chore(tag): ${name} v${version}";
5978
6732
  var GithubPR = class extends GitBase {
6733
+ /**
6734
+ * Creates a new GithubPR plugin instance
6735
+ *
6736
+ * Initializes the plugin with GitHub-specific configuration and
6737
+ * sets up release parameters and GitHub manager.
6738
+ *
6739
+ * @param context - Release context
6740
+ * @param props - Plugin configuration
6741
+ *
6742
+ * @example
6743
+ * ```typescript
6744
+ * const plugin = new GithubPR(context, {
6745
+ * releasePR: true,
6746
+ * releaseName: 'Release v${version}',
6747
+ * commitMessage: 'chore: release v${version}',
6748
+ * draft: false,
6749
+ * preRelease: false
6750
+ * });
6751
+ * ```
6752
+ */
5979
6753
  constructor(context, props) {
5980
6754
  super(context, "githubPR", {
5981
6755
  releaseName: DEFAULT_RELEASE_NAME,
@@ -5983,23 +6757,75 @@ var GithubPR = class extends GitBase {
5983
6757
  });
5984
6758
  this.context = context;
5985
6759
  this.githubManager = new GithubManager(this.context);
5986
- this.releaseParams = new ReleaseParams(context.shell, context.logger, {
5987
- PRTitle: this.getConfig("PRTitle", this.context.shared.PRTitle),
5988
- PRBody: this.getConfig("PRBody", this.context.shared.PRBody),
6760
+ this.releaseParams = new ReleaseParams(context.logger, {
6761
+ PRTitle: this.getConfig("PRTitle", this.context.options.PRTitle),
6762
+ PRBody: this.getConfig("PRBody", this.context.options.PRBody),
5989
6763
  ...this.props
5990
6764
  });
5991
6765
  }
5992
6766
  releaseParams;
5993
6767
  githubManager;
6768
+ /**
6769
+ * Determines if the plugin should be enabled
6770
+ *
6771
+ * Plugin is enabled unless explicitly skipped via configuration.
6772
+ * This allows for conditional PR creation and release publishing.
6773
+ *
6774
+ * @param _name - Plugin name (unused)
6775
+ * @returns True if plugin should be enabled
6776
+ *
6777
+ * @example
6778
+ * ```typescript
6779
+ * const plugin = new GithubPR(context, { skip: true });
6780
+ * plugin.enabled(); // false
6781
+ *
6782
+ * const plugin2 = new GithubPR(context, {});
6783
+ * plugin2.enabled(); // true
6784
+ * ```
6785
+ */
5994
6786
  enabled(_name) {
5995
6787
  if (this.getConfig("skip")) {
5996
6788
  return false;
5997
6789
  }
5998
6790
  return true;
5999
6791
  }
6792
+ /**
6793
+ * Determines if the plugin is in publish mode
6794
+ *
6795
+ * In publish mode, the plugin publishes releases directly.
6796
+ * In non-publish mode (releasePR=true), it creates pull requests.
6797
+ *
6798
+ * @returns True if in publish mode
6799
+ *
6800
+ * @example
6801
+ * ```typescript
6802
+ * const plugin = new GithubPR(context, { releasePR: true });
6803
+ * plugin.isPublish; // false (PR mode)
6804
+ *
6805
+ * const plugin2 = new GithubPR(context, { releasePR: false });
6806
+ * plugin2.isPublish; // true (publish mode)
6807
+ * ```
6808
+ */
6000
6809
  get isPublish() {
6001
6810
  return !this.getConfig("releasePR");
6002
6811
  }
6812
+ /**
6813
+ * Checks if the current repository is a GitHub repository
6814
+ *
6815
+ * Verifies that the remote URL contains 'github.com' to ensure
6816
+ * GitHub-specific features can be used.
6817
+ *
6818
+ * @returns Promise resolving to true if GitHub repository
6819
+ *
6820
+ * @example
6821
+ * ```typescript
6822
+ * const isGithub = await plugin.isGithubRepository();
6823
+ * if (isGithub) {
6824
+ * // Use GitHub-specific features
6825
+ * }
6826
+ * ```
6827
+ * @private
6828
+ */
6003
6829
  async isGithubRepository() {
6004
6830
  try {
6005
6831
  const remoteUrl = await this.getRemoteUrl();
@@ -6008,6 +6834,24 @@ var GithubPR = class extends GitBase {
6008
6834
  return false;
6009
6835
  }
6010
6836
  }
6837
+ /**
6838
+ * Plugin initialization hook
6839
+ *
6840
+ * Performs pre-execution setup:
6841
+ * 1. Verifies repository is on GitHub
6842
+ * 2. Runs parent class initialization
6843
+ * 3. Sets up NPM token for publishing
6844
+ *
6845
+ * @throws Error if not a GitHub repository
6846
+ * @throws Error if NPM_TOKEN missing in publish mode
6847
+ *
6848
+ * @example
6849
+ * ```typescript
6850
+ * const plugin = new GithubPR(context, {});
6851
+ * await plugin.onBefore();
6852
+ * // Throws if not GitHub repo or missing NPM token
6853
+ * ```
6854
+ */
6011
6855
  async onBefore() {
6012
6856
  this.logger.debug("GithubPR onBefore");
6013
6857
  const isGithub = await this.isGithubRepository();
@@ -6018,7 +6862,7 @@ var GithubPR = class extends GitBase {
6018
6862
  }
6019
6863
  await super.onBefore();
6020
6864
  if (this.isPublish) {
6021
- const npmToken = this.getEnv("NPM_TOKEN");
6865
+ const npmToken = this.context.getEnv("NPM_TOKEN");
6022
6866
  if (!npmToken) {
6023
6867
  throw new Error("NPM_TOKEN is not set");
6024
6868
  }
@@ -6027,10 +6871,28 @@ var GithubPR = class extends GitBase {
6027
6871
  );
6028
6872
  }
6029
6873
  }
6874
+ /**
6875
+ * Main plugin execution hook
6876
+ *
6877
+ * Processes changelogs for all workspaces using GitHub-specific
6878
+ * formatting and updates the context with the results.
6879
+ *
6880
+ * Process:
6881
+ * 1. Initialize GitHub changelog processor
6882
+ * 2. Transform workspace changelogs
6883
+ * 3. Update context with new workspace info
6884
+ *
6885
+ * @example
6886
+ * ```typescript
6887
+ * const plugin = new GithubPR(context, {});
6888
+ * await plugin.onExec();
6889
+ * // Transforms changelogs with GitHub links
6890
+ * ```
6891
+ */
6030
6892
  async onExec() {
6031
6893
  const workspaces = this.context.workspaces;
6032
6894
  const githubChangelog = new GithubChangelog(
6033
- this.context.getConfig("changelog"),
6895
+ this.context.getOptions("changelog"),
6034
6896
  this.githubManager
6035
6897
  );
6036
6898
  const newWorkspaces = await this.step({
@@ -6039,6 +6901,27 @@ var GithubPR = class extends GitBase {
6039
6901
  });
6040
6902
  this.context.setWorkspaces(newWorkspaces);
6041
6903
  }
6904
+ /**
6905
+ * Success hook after plugin execution
6906
+ *
6907
+ * Handles either PR creation or release publishing based on
6908
+ * configuration. In publish mode, publishes to NPM and creates
6909
+ * GitHub releases. In PR mode, creates release pull requests.
6910
+ *
6911
+ * @example PR mode
6912
+ * ```typescript
6913
+ * const plugin = new GithubPR(context, { releasePR: true });
6914
+ * await plugin.onSuccess();
6915
+ * // Creates release PR
6916
+ * ```
6917
+ *
6918
+ * @example Publish mode
6919
+ * ```typescript
6920
+ * const plugin = new GithubPR(context, { releasePR: false });
6921
+ * await plugin.onSuccess();
6922
+ * // Publishes to NPM and creates GitHub release
6923
+ * ```
6924
+ */
6042
6925
  async onSuccess() {
6043
6926
  if (this.isPublish) {
6044
6927
  await this.publishPR(this.context.workspaces);
@@ -6046,6 +6929,28 @@ var GithubPR = class extends GitBase {
6046
6929
  }
6047
6930
  await this.releasePR(this.context.workspaces);
6048
6931
  }
6932
+ /**
6933
+ * Creates a release pull request
6934
+ *
6935
+ * Handles the complete process of creating a release PR:
6936
+ * 1. Creates release commit
6937
+ * 2. Creates release branch
6938
+ * 3. Creates and configures pull request
6939
+ *
6940
+ * @param workspaces - Array of workspace configurations
6941
+ *
6942
+ * @example
6943
+ * ```typescript
6944
+ * const workspaces = [{
6945
+ * name: 'pkg-a',
6946
+ * version: '1.0.0',
6947
+ * changelog: '...'
6948
+ * }];
6949
+ *
6950
+ * await plugin.releasePR(workspaces);
6951
+ * // Creates PR with release changes
6952
+ * ```
6953
+ */
6049
6954
  async releasePR(workspaces) {
6050
6955
  await this.step({
6051
6956
  label: "Release Commit",
@@ -6057,6 +6962,28 @@ var GithubPR = class extends GitBase {
6057
6962
  });
6058
6963
  await this.releasePullRequest(workspaces, releaseBranchParams);
6059
6964
  }
6965
+ /**
6966
+ * Publishes releases to NPM and GitHub
6967
+ *
6968
+ * In non-dry-run mode:
6969
+ * 1. Publishes packages to NPM
6970
+ * 2. Pushes tags to GitHub
6971
+ * 3. Creates GitHub releases
6972
+ *
6973
+ * @param workspaces - Array of workspace configurations
6974
+ *
6975
+ * @example
6976
+ * ```typescript
6977
+ * const workspaces = [{
6978
+ * name: 'pkg-a',
6979
+ * version: '1.0.0',
6980
+ * changelog: '...'
6981
+ * }];
6982
+ *
6983
+ * await plugin.publishPR(workspaces);
6984
+ * // Publishes to NPM and creates GitHub releases
6985
+ * ```
6986
+ */
6060
6987
  async publishPR(workspaces) {
6061
6988
  if (!this.getConfig("dryRunCreatePR")) {
6062
6989
  await this.context.runChangesetsCli("publish");
@@ -6072,6 +6999,34 @@ var GithubPR = class extends GitBase {
6072
6999
  )
6073
7000
  });
6074
7001
  }
7002
+ /**
7003
+ * Creates release commit(s)
7004
+ *
7005
+ * Creates either a single commit for all workspaces or
7006
+ * individual commits per workspace. Uses configured commit
7007
+ * message template.
7008
+ *
7009
+ * @param workspaces - Array of workspace configurations
7010
+ *
7011
+ * @example Single workspace
7012
+ * ```typescript
7013
+ * await plugin.relesaeCommit([{
7014
+ * name: 'pkg-a',
7015
+ * version: '1.0.0'
7016
+ * }]);
7017
+ * // Creates: "chore(tag): pkg-a v1.0.0"
7018
+ * ```
7019
+ *
7020
+ * @example Multiple workspaces
7021
+ * ```typescript
7022
+ * await plugin.relesaeCommit([
7023
+ * { name: 'pkg-a', version: '1.0.0' },
7024
+ * { name: 'pkg-b', version: '2.0.0' }
7025
+ * ]);
7026
+ * // Creates: "chore(tag): pkg-a v1.0.0,pkg-b v2.0.0"
7027
+ * ```
7028
+ * @private
7029
+ */
6075
7030
  async relesaeCommit(workspaces) {
6076
7031
  const commitArgs = this.getConfig("commitArgs", []);
6077
7032
  if (workspaces.length === 1) {
@@ -6083,6 +7038,34 @@ var GithubPR = class extends GitBase {
6083
7038
  const commitMessage = `chore(tag): ${workspaces.map((w) => `${w.name} v${w.version}`).join(",")}`;
6084
7039
  await this.commit(commitMessage, commitArgs);
6085
7040
  }
7041
+ /**
7042
+ * Creates and optionally merges a release pull request
7043
+ *
7044
+ * Creates a PR with release changes and handles auto-merge
7045
+ * if configured. Adds release and change labels to the PR.
7046
+ *
7047
+ * @param workspaces - Array of workspace configurations
7048
+ * @param releaseBranchParams - Branch and tag information
7049
+ *
7050
+ * @example Manual merge
7051
+ * ```typescript
7052
+ * await plugin.releasePullRequest(
7053
+ * workspaces,
7054
+ * { releaseBranch: 'release-v1.0.0', tagName: 'v1.0.0' }
7055
+ * );
7056
+ * // Creates PR for manual merge
7057
+ * ```
7058
+ *
7059
+ * @example Auto-merge
7060
+ * ```typescript
7061
+ * const plugin = new GithubPR(context, {
7062
+ * autoMergeReleasePR: true
7063
+ * });
7064
+ *
7065
+ * await plugin.releasePullRequest(workspaces, params);
7066
+ * // Creates and auto-merges PR
7067
+ * ```
7068
+ */
6086
7069
  async releasePullRequest(workspaces, releaseBranchParams) {
6087
7070
  const prNumber = await this.step({
6088
7071
  label: "Create Release PR",
@@ -6104,8 +7087,36 @@ var GithubPR = class extends GitBase {
6104
7087
  `Please manually merge PR(#${prNumber}) and complete the publishing process afterwards`
6105
7088
  );
6106
7089
  }
7090
+ /**
7091
+ * Creates a commit for a single workspace
7092
+ *
7093
+ * Uses the configured commit message template to create a
7094
+ * commit for the workspace's changes.
7095
+ *
7096
+ * @param workspace - Workspace configuration
7097
+ * @param commitArgs - Additional Git commit arguments
7098
+ * @returns Promise resolving to commit output
7099
+ *
7100
+ * @example Basic commit
7101
+ * ```typescript
7102
+ * await plugin.commitWorkspace({
7103
+ * name: 'pkg-a',
7104
+ * version: '1.0.0'
7105
+ * });
7106
+ * // Creates: "chore(tag): pkg-a v1.0.0"
7107
+ * ```
7108
+ *
7109
+ * @example With arguments
7110
+ * ```typescript
7111
+ * await plugin.commitWorkspace(
7112
+ * { name: 'pkg-a', version: '1.0.0' },
7113
+ * ['--no-verify']
7114
+ * );
7115
+ * ```
7116
+ * @private
7117
+ */
6107
7118
  async commitWorkspace(workspace, commitArgs = []) {
6108
- const commitMessage = this.shell.format(
7119
+ const commitMessage = Shell4.format(
6109
7120
  this.getConfig("commitMessage", DEFAULT_COMMIT_MESSAGE),
6110
7121
  workspace
6111
7122
  );
@@ -6121,16 +7132,48 @@ var GithubPR = class extends GitBase {
6121
7132
  *
6122
7133
  * @returns The release branch.
6123
7134
  */
7135
+ /**
7136
+ * Creates a release branch for changes
7137
+ *
7138
+ * Creates a new branch from the current branch for release
7139
+ * changes. The branch name is generated from the configured
7140
+ * template and workspace information.
7141
+ *
7142
+ * Process:
7143
+ * 1. Generate branch parameters
7144
+ * 2. Fetch required branches
7145
+ * 3. Create and push release branch
7146
+ *
7147
+ * @param workspaces - Array of workspace configurations
7148
+ * @returns Promise resolving to branch parameters
7149
+ *
7150
+ * @example
7151
+ * ```typescript
7152
+ * const params = await plugin.createReleaseBranch([{
7153
+ * name: 'pkg-a',
7154
+ * version: '1.0.0'
7155
+ * }]);
7156
+ * // {
7157
+ * // tagName: 'pkg-a@1.0.0',
7158
+ * // releaseBranch: 'release-pkg-a-1.0.0'
7159
+ * // }
7160
+ * ```
7161
+ *
7162
+ * @throws Error if tag name is invalid
7163
+ * @throws Error if branch creation fails
7164
+ * @private
7165
+ */
6124
7166
  async createReleaseBranch(workspaces) {
6125
7167
  const params = this.releaseParams.getReleaseBranchParams(
6126
7168
  workspaces,
7169
+ // @ts-expect-error TODO: fix this
6127
7170
  this.context.getTemplateContext()
6128
7171
  );
6129
7172
  const { tagName, releaseBranch } = params;
6130
7173
  if (typeof tagName !== "string") {
6131
7174
  throw new Error("Tag name is not a string");
6132
7175
  }
6133
- const { sourceBranch, currentBranch } = this.context.shared;
7176
+ const { sourceBranch, currentBranch } = this.context.getOptions();
6134
7177
  this.context.logger.debug("PR TagName is:", tagName);
6135
7178
  this.context.logger.debug("PR CurrentBranch is:", currentBranch);
6136
7179
  this.context.logger.debug("PR SourceBranch is:", sourceBranch);
@@ -6162,11 +7205,47 @@ var GithubPR = class extends GitBase {
6162
7205
  * @param releaseBranchParams - The release branch params.
6163
7206
  * @returns The created pull request number.
6164
7207
  */
7208
+ /**
7209
+ * Creates a release pull request
7210
+ *
7211
+ * Creates a pull request with:
7212
+ * 1. Release label
7213
+ * 2. Change labels (if configured)
7214
+ * 3. Generated title and body
7215
+ * 4. Proper branch configuration
7216
+ *
7217
+ * @param workspaces - Array of workspace configurations
7218
+ * @param releaseBranchParams - Branch and tag information
7219
+ * @returns Promise resolving to PR number
7220
+ *
7221
+ * @example Basic PR
7222
+ * ```typescript
7223
+ * const prNumber = await plugin.createReleasePR(
7224
+ * workspaces,
7225
+ * { releaseBranch: 'release-v1.0.0', tagName: 'v1.0.0' }
7226
+ * );
7227
+ * // Creates PR with default labels
7228
+ * ```
7229
+ *
7230
+ * @example With change labels
7231
+ * ```typescript
7232
+ * const plugin = new GithubPR(context, {
7233
+ * pushChangeLabels: true
7234
+ * });
7235
+ *
7236
+ * const prNumber = await plugin.createReleasePR(
7237
+ * workspaces,
7238
+ * params
7239
+ * );
7240
+ * // Creates PR with release and change labels
7241
+ * ```
7242
+ * @private
7243
+ */
6165
7244
  async createReleasePR(workspaces, releaseBranchParams) {
6166
7245
  const label = await this.githubManager.createReleasePRLabel();
6167
7246
  let labels = [label.name];
6168
7247
  if (this.getConfig("pushChangeLabels")) {
6169
- const changeLabels = this.context.getConfig("workspaces.changeLabels");
7248
+ const changeLabels = this.context.getOptions("workspaces.changeLabels");
6170
7249
  if (Array.isArray(changeLabels) && changeLabels.length > 0) {
6171
7250
  labels.push(...changeLabels);
6172
7251
  }
@@ -6195,21 +7274,137 @@ import { join as join2, resolve, relative } from "path";
6195
7274
 
6196
7275
  // src/implments/ReleaseLabel.ts
6197
7276
  var ReleaseLabel = class {
7277
+ /**
7278
+ * Creates a new ReleaseLabel instance
7279
+ *
7280
+ * @param options - Configuration options for label management
7281
+ *
7282
+ * @example
7283
+ * ```typescript
7284
+ * const label = new ReleaseLabel({
7285
+ * // Label template with ${name} placeholder
7286
+ * changePackagesLabel: 'changed:${name}',
7287
+ *
7288
+ * // Package directories to monitor
7289
+ * packagesDirectories: ['packages/a', 'packages/b'],
7290
+ *
7291
+ * // Optional custom comparison logic
7292
+ * compare: (file, pkg) => file.includes(pkg)
7293
+ * });
7294
+ * ```
7295
+ */
6198
7296
  constructor(options) {
6199
7297
  this.options = options;
6200
7298
  }
7299
+ /**
7300
+ * Compares a changed file path against a package path
7301
+ *
7302
+ * Uses custom comparison function if provided, otherwise
7303
+ * checks if the file path starts with the package path.
7304
+ *
7305
+ * @param changedFilePath - Path of the changed file
7306
+ * @param packagePath - Path of the package to check against
7307
+ * @returns True if the file belongs to the package
7308
+ *
7309
+ * @example
7310
+ * ```typescript
7311
+ * // Default comparison
7312
+ * label.compare('packages/a/src/index.ts', 'packages/a');
7313
+ * // true
7314
+ *
7315
+ * // Custom comparison
7316
+ * const label = new ReleaseLabel({
7317
+ * ...options,
7318
+ * compare: (file, pkg) => file.includes(pkg)
7319
+ * });
7320
+ * label.compare('src/packages/a/index.ts', 'packages/a');
7321
+ * // true
7322
+ * ```
7323
+ */
6201
7324
  compare(changedFilePath, packagePath) {
6202
7325
  if (typeof this.options.compare === "function") {
6203
7326
  return this.options.compare(changedFilePath, packagePath);
6204
7327
  }
6205
7328
  return changedFilePath.startsWith(packagePath);
6206
7329
  }
7330
+ /**
7331
+ * Generates a change label for a single package
7332
+ *
7333
+ * Replaces ${name} placeholder in the label template with
7334
+ * the package path.
7335
+ *
7336
+ * @param packagePath - Path of the package
7337
+ * @param label - Optional custom label template
7338
+ * @returns Formatted change label
7339
+ *
7340
+ * @example
7341
+ * ```typescript
7342
+ * // Default label template
7343
+ * label.toChangeLabel('packages/a');
7344
+ * // 'changed:packages/a'
7345
+ *
7346
+ * // Custom label template
7347
+ * label.toChangeLabel('packages/a', 'modified:${name}');
7348
+ * // 'modified:packages/a'
7349
+ * ```
7350
+ */
6207
7351
  toChangeLabel(packagePath, label = this.options.changePackagesLabel) {
6208
7352
  return label.replace("${name}", packagePath);
6209
7353
  }
7354
+ /**
7355
+ * Generates change labels for multiple packages
7356
+ *
7357
+ * Maps each package path to a formatted change label.
7358
+ *
7359
+ * @param packages - Array of package paths
7360
+ * @param label - Optional custom label template
7361
+ * @returns Array of formatted change labels
7362
+ *
7363
+ * @example
7364
+ * ```typescript
7365
+ * // Default label template
7366
+ * label.toChangeLabels(['packages/a', 'packages/b']);
7367
+ * // ['changed:packages/a', 'changed:packages/b']
7368
+ *
7369
+ * // Custom label template
7370
+ * label.toChangeLabels(
7371
+ * ['packages/a', 'packages/b'],
7372
+ * 'modified:${name}'
7373
+ * );
7374
+ * // ['modified:packages/a', 'modified:packages/b']
7375
+ * ```
7376
+ */
6210
7377
  toChangeLabels(packages, label = this.options.changePackagesLabel) {
6211
7378
  return packages.map((pkg) => this.toChangeLabel(pkg, label));
6212
7379
  }
7380
+ /**
7381
+ * Identifies packages affected by changed files
7382
+ *
7383
+ * Checks each changed file against package paths to determine
7384
+ * which packages have been modified.
7385
+ *
7386
+ * @param changedFiles - Array or Set of changed file paths
7387
+ * @param packages - Optional array of package paths to check
7388
+ * @returns Array of affected package paths
7389
+ *
7390
+ * @example
7391
+ * ```typescript
7392
+ * // Check against default packages
7393
+ * label.pick(['packages/a/src/index.ts']);
7394
+ * // ['packages/a']
7395
+ *
7396
+ * // Check specific packages
7397
+ * label.pick(
7398
+ * ['packages/a/index.ts', 'packages/b/test.ts'],
7399
+ * ['packages/a', 'packages/c']
7400
+ * );
7401
+ * // ['packages/a']
7402
+ *
7403
+ * // Using Set of files
7404
+ * label.pick(new Set(['packages/a/index.ts']));
7405
+ * // ['packages/a']
7406
+ * ```
7407
+ */
6213
7408
  pick(changedFiles, packages = this.options.packagesDirectories) {
6214
7409
  const result = [];
6215
7410
  for (const pkgPath of packages) {
@@ -6254,7 +7449,8 @@ var WorkspaceCreator = class _WorkspaceCreator {
6254
7449
  };
6255
7450
 
6256
7451
  // src/plugins/workspaces/Workspaces.ts
6257
- var Workspaces = class extends Plugin {
7452
+ import { ScriptPlugin as ScriptPlugin2 } from "@qlover/scripts-context";
7453
+ var Workspaces = class extends ScriptPlugin2 {
6258
7454
  releaseTask = null;
6259
7455
  workspacesList = [];
6260
7456
  _skip = false;
@@ -6262,8 +7458,8 @@ var Workspaces = class extends Plugin {
6262
7458
  constructor(context) {
6263
7459
  super(context, "workspaces");
6264
7460
  this.releaseLabel = new ReleaseLabel({
6265
- changePackagesLabel: this.context.shared.changePackagesLabel || "change:${name}",
6266
- packagesDirectories: this.context.shared.packagesDirectories || [],
7461
+ changePackagesLabel: this.context.options.changePackagesLabel || "change:${name}",
7462
+ packagesDirectories: this.context.options.packagesDirectories || [],
6267
7463
  compare: (changedFilePath, packagePath) => resolve(changedFilePath).startsWith(resolve(packagePath))
6268
7464
  });
6269
7465
  }
@@ -6281,7 +7477,7 @@ var Workspaces = class extends Plugin {
6281
7477
  if (this.getConfig("skipCheckPackage") || workspaces.length === 0) {
6282
7478
  throw new Error("No changes to publish packages");
6283
7479
  }
6284
- const { publishPath } = this.context.shared;
7480
+ const publishPath = this.context.getOptions("publishPath");
6285
7481
  if (publishPath) {
6286
7482
  const targetWorkspace = workspaces.find(
6287
7483
  (workspace2) => resolve(workspace2.root) === resolve(publishPath)
@@ -6315,7 +7511,7 @@ var Workspaces = class extends Plugin {
6315
7511
  this.releaseTask = releaseTask;
6316
7512
  }
6317
7513
  setCurrentWorkspace(workspace, workspaces) {
6318
- this.context.setShared({
7514
+ this.context.setOptions({
6319
7515
  publishPath: workspace.path
6320
7516
  });
6321
7517
  this.setConfig({
@@ -6347,7 +7543,7 @@ var Workspaces = class extends Plugin {
6347
7543
  }
6348
7544
  getProjectWorkspaces() {
6349
7545
  const rootPath = this.context.rootPath;
6350
- const packagesDirectories = this.context.shared.packagesDirectories;
7546
+ const packagesDirectories = this.context.options.packagesDirectories;
6351
7547
  if (Array.isArray(packagesDirectories) && packagesDirectories.length > 0) {
6352
7548
  return packagesDirectories.map(
6353
7549
  (path) => WorkspaceCreator.toWorkspace({ path }, rootPath)
@@ -6571,8 +7767,37 @@ async function loaderPluginsFromPluginTuples(context, pluginsTuples, maxLimit =
6571
7767
  // src/plugins/Changelog.ts
6572
7768
  import { join as join4 } from "path";
6573
7769
  import { existsSync, writeFileSync } from "fs";
7770
+ import {
7771
+ ScriptPlugin as ScriptPlugin3,
7772
+ Shell as Shell5
7773
+ } from "@qlover/scripts-context";
6574
7774
  var contentTmplate = "---\n'${name}': '${increment}'\n---\n\n${changelog}";
6575
- var Changelog = class extends Plugin {
7775
+ var Changelog = class extends ScriptPlugin3 {
7776
+ /**
7777
+ * Creates a new Changelog plugin instance
7778
+ *
7779
+ * Initializes the plugin with default configuration values and
7780
+ * merges them with provided options.
7781
+ *
7782
+ * Default values:
7783
+ * - increment: 'patch'
7784
+ * - changesetRoot: '.changeset'
7785
+ * - tagTemplate: '${name}@${version}'
7786
+ * - tagPrefix: '${name}'
7787
+ * - tagMatch: '${name}@*'
7788
+ *
7789
+ * @param context - Release context
7790
+ * @param props - Plugin configuration
7791
+ *
7792
+ * @example
7793
+ * ```typescript
7794
+ * const plugin = new Changelog(context, {
7795
+ * increment: 'minor',
7796
+ * changesetRoot: 'custom/changeset',
7797
+ * tagTemplate: 'v${version}'
7798
+ * });
7799
+ * ```
7800
+ */
6576
7801
  constructor(context, props) {
6577
7802
  super(context, "changelog", {
6578
7803
  increment: "patch",
@@ -6583,15 +7808,78 @@ var Changelog = class extends Plugin {
6583
7808
  ...props
6584
7809
  });
6585
7810
  }
7811
+ /**
7812
+ * Gets the absolute path to the changeset root directory
7813
+ *
7814
+ * Combines the project root path with the configured changeset
7815
+ * directory path.
7816
+ *
7817
+ * @returns Absolute path to changeset directory
7818
+ *
7819
+ * @example
7820
+ * ```typescript
7821
+ * const root = plugin.changesetRoot;
7822
+ * // '/path/to/project/.changeset'
7823
+ * ```
7824
+ */
6586
7825
  get changesetRoot() {
6587
7826
  return join4(this.context.rootPath, this.getConfig("changesetRoot"));
6588
7827
  }
7828
+ /**
7829
+ * Gets the path to the changeset configuration file
7830
+ *
7831
+ * Returns the absolute path to the config.json file in the
7832
+ * changeset directory.
7833
+ *
7834
+ * @returns Path to changeset config file
7835
+ *
7836
+ * @example
7837
+ * ```typescript
7838
+ * const configPath = plugin.changesetConfigPath;
7839
+ * // '/path/to/project/.changeset/config.json'
7840
+ * ```
7841
+ */
6589
7842
  get changesetConfigPath() {
6590
7843
  return join4(this.changesetRoot, "config.json");
6591
7844
  }
7845
+ /**
7846
+ * Determines if the plugin should be enabled
7847
+ *
7848
+ * Plugin is enabled unless explicitly skipped via configuration.
7849
+ * This allows for conditional changelog generation.
7850
+ *
7851
+ * @returns True if plugin should be enabled
7852
+ *
7853
+ * @example
7854
+ * ```typescript
7855
+ * const plugin = new Changelog(context, { skip: true });
7856
+ * plugin.enabled(); // false
7857
+ *
7858
+ * const plugin2 = new Changelog(context, {});
7859
+ * plugin2.enabled(); // true
7860
+ * ```
7861
+ */
6592
7862
  enabled() {
6593
7863
  return !this.getConfig("skip");
6594
7864
  }
7865
+ /**
7866
+ * Plugin initialization hook
7867
+ *
7868
+ * Verifies that the changeset directory exists before proceeding
7869
+ * with changelog generation.
7870
+ *
7871
+ * @throws Error if changeset directory does not exist
7872
+ *
7873
+ * @example
7874
+ * ```typescript
7875
+ * const plugin = new Changelog(context, {
7876
+ * changesetRoot: '.changeset'
7877
+ * });
7878
+ *
7879
+ * await plugin.onBefore();
7880
+ * // Throws if .changeset directory doesn't exist
7881
+ * ```
7882
+ */
6595
7883
  async onBefore() {
6596
7884
  if (!existsSync(this.changesetRoot)) {
6597
7885
  throw new Error(
@@ -6600,6 +7888,33 @@ var Changelog = class extends Plugin {
6600
7888
  }
6601
7889
  this.logger.debug(`${this.changesetRoot} exists`);
6602
7890
  }
7891
+ /**
7892
+ * Updates workspace information with latest versions
7893
+ *
7894
+ * Reads the latest version information from each workspace's
7895
+ * package.json and updates the workspace objects with new
7896
+ * versions and tag names.
7897
+ *
7898
+ * @param workspaces - Array of workspace configurations
7899
+ * @returns Updated workspace configurations
7900
+ *
7901
+ * @example
7902
+ * ```typescript
7903
+ * const workspaces = [
7904
+ * { name: 'pkg-a', path: 'packages/a', version: '1.0.0' }
7905
+ * ];
7906
+ *
7907
+ * const updated = plugin.mergeWorkspaces(workspaces);
7908
+ * // [
7909
+ * // {
7910
+ * // name: 'pkg-a',
7911
+ * // path: 'packages/a',
7912
+ * // version: '1.1.0', // Updated version
7913
+ * // tagName: 'pkg-a@1.1.0'
7914
+ * // }
7915
+ * // ]
7916
+ * ```
7917
+ */
6603
7918
  mergeWorkspaces(workspaces) {
6604
7919
  return workspaces.map((workspace) => {
6605
7920
  const newPackgeJson = WorkspaceCreator.toWorkspace(
@@ -6616,6 +7931,25 @@ var Changelog = class extends Plugin {
6616
7931
  return newWorkspace;
6617
7932
  });
6618
7933
  }
7934
+ /**
7935
+ * Main plugin execution hook
7936
+ *
7937
+ * Generates changelogs for all workspaces in parallel and updates
7938
+ * the context with the results.
7939
+ *
7940
+ * Process:
7941
+ * 1. Generate changelogs for each workspace
7942
+ * 2. Update context with new workspace information
7943
+ *
7944
+ * @param _context - Execution context
7945
+ *
7946
+ * @example
7947
+ * ```typescript
7948
+ * const plugin = new Changelog(context, {});
7949
+ * await plugin.onExec(execContext);
7950
+ * // Generates changelogs for all workspaces
7951
+ * ```
7952
+ */
6619
7953
  async onExec(_context) {
6620
7954
  const workspaces = await this.step({
6621
7955
  label: "Generate Changelogs",
@@ -6627,6 +7961,28 @@ var Changelog = class extends Plugin {
6627
7961
  });
6628
7962
  this.context.setWorkspaces(workspaces);
6629
7963
  }
7964
+ /**
7965
+ * Success hook after plugin execution
7966
+ *
7967
+ * Handles post-changelog generation tasks:
7968
+ * 1. Creates changeset files (if not skipped)
7969
+ * 2. Updates package versions
7970
+ * 3. Restores unchanged packages (if configured)
7971
+ * 4. Updates workspace information
7972
+ *
7973
+ * @example
7974
+ * ```typescript
7975
+ * const plugin = new Changelog(context, {
7976
+ * skipChangeset: false,
7977
+ * ignoreNonUpdatedPackages: true
7978
+ * });
7979
+ *
7980
+ * await plugin.onSuccess();
7981
+ * // - Creates changeset files
7982
+ * // - Updates versions
7983
+ * // - Restores unchanged packages
7984
+ * ```
7985
+ */
6630
7986
  async onSuccess() {
6631
7987
  const workspaces = this.context.workspaces;
6632
7988
  if (!this.getConfig("skipChangeset")) {
@@ -6650,8 +8006,27 @@ var Changelog = class extends Plugin {
6650
8006
  this.logger.debug("new workspaces", newWorkspaces);
6651
8007
  this.context.setWorkspaces(newWorkspaces);
6652
8008
  }
8009
+ /**
8010
+ * Restores unchanged packages to their original state
8011
+ *
8012
+ * When ignoreNonUpdatedPackages is enabled, this method:
8013
+ * 1. Identifies packages without changes
8014
+ * 2. Uses git restore to revert them to original state
8015
+ *
8016
+ * @example
8017
+ * ```typescript
8018
+ * // With changed and unchanged packages
8019
+ * context.options.workspaces = {
8020
+ * packages: ['pkg-a', 'pkg-b', 'pkg-c'],
8021
+ * changedPaths: ['pkg-a', 'pkg-b']
8022
+ * };
8023
+ *
8024
+ * await plugin.restoreIgnorePackages();
8025
+ * // Restores 'pkg-c' to original state
8026
+ * ```
8027
+ */
6653
8028
  async restoreIgnorePackages() {
6654
- const { changedPaths = [], packages = [] } = this.context.getConfig(
8029
+ const { changedPaths = [], packages = [] } = this.context.getOptions(
6655
8030
  "workspaces"
6656
8031
  );
6657
8032
  const noChangedPackages = packages.filter((pkgPath) => !changedPaths.includes(pkgPath)).map(
@@ -6662,12 +8037,60 @@ var Changelog = class extends Plugin {
6662
8037
  await this.shell.exec(["git", "restore", ...noChangedPackages]);
6663
8038
  }
6664
8039
  }
8040
+ /**
8041
+ * Gets the tag prefix for a workspace
8042
+ *
8043
+ * Formats the configured tag prefix template with workspace
8044
+ * information. Used for generating Git tag names.
8045
+ *
8046
+ * @param workspace - Workspace configuration
8047
+ * @returns Formatted tag prefix
8048
+ *
8049
+ * @example
8050
+ * ```typescript
8051
+ * const workspace = {
8052
+ * name: 'pkg-a',
8053
+ * version: '1.0.0'
8054
+ * };
8055
+ *
8056
+ * const prefix = plugin.getTagPrefix(workspace);
8057
+ * // With default template: 'pkg-a'
8058
+ * // With custom template: 'v1.0.0'
8059
+ * ```
8060
+ */
6665
8061
  getTagPrefix(workspace) {
6666
- return this.shell.format(
8062
+ return Shell5.format(
6667
8063
  this.getConfig("tagPrefix"),
6668
8064
  workspace
6669
8065
  );
6670
8066
  }
8067
+ /**
8068
+ * Generates a changelog for a workspace
8069
+ *
8070
+ * Creates a changelog by:
8071
+ * 1. Getting the appropriate tag name
8072
+ * 2. Retrieving commits since last tag
8073
+ * 3. Formatting commits into changelog entries
8074
+ *
8075
+ * @param workspace - Workspace configuration
8076
+ * @returns Updated workspace with changelog
8077
+ *
8078
+ * @example
8079
+ * ```typescript
8080
+ * const workspace = {
8081
+ * name: 'pkg-a',
8082
+ * path: 'packages/a',
8083
+ * version: '1.0.0'
8084
+ * };
8085
+ *
8086
+ * const updated = await plugin.generateChangelog(workspace);
8087
+ * // {
8088
+ * // ...workspace,
8089
+ * // lastTag: 'pkg-a@1.0.0',
8090
+ * // changelog: '- feat: new feature\n- fix: bug fix'
8091
+ * // }
8092
+ * ```
8093
+ */
6671
8094
  async generateChangelog(workspace) {
6672
8095
  let tagName = await this.getTagName(workspace);
6673
8096
  if (workspace.lastTag) {
@@ -6680,8 +8103,8 @@ var Changelog = class extends Plugin {
6680
8103
  ...baseConfig,
6681
8104
  from: tagName,
6682
8105
  directory: workspace.path,
6683
- shell: this.shell,
6684
- fileds: CHANGELOG_ALL_FIELDS,
8106
+ shell: this.context.shell,
8107
+ fields: CHANGELOG_ALL_FIELDS,
6685
8108
  logger: this.logger
6686
8109
  };
6687
8110
  const gitChangelog = new GitChangelog(props);
@@ -6693,10 +8116,36 @@ var Changelog = class extends Plugin {
6693
8116
  changelog: changelog.join("\n")
6694
8117
  };
6695
8118
  }
8119
+ /**
8120
+ * Generates a tag name for a workspace
8121
+ *
8122
+ * Uses the configured tag template to generate a tag name
8123
+ * for the workspace. Handles errors by providing a fallback.
8124
+ *
8125
+ * @param workspace - Workspace configuration
8126
+ * @returns Generated tag name
8127
+ *
8128
+ * @example
8129
+ * ```typescript
8130
+ * // With default template
8131
+ * const tag = plugin.generateTagName({
8132
+ * name: 'pkg-a',
8133
+ * version: '1.0.0'
8134
+ * });
8135
+ * // 'pkg-a@1.0.0'
8136
+ *
8137
+ * // With error (fallback)
8138
+ * const tag = plugin.generateTagName({
8139
+ * name: 'pkg-a'
8140
+ * });
8141
+ * // 'pkg-a-v0.0.0'
8142
+ * ```
8143
+ * @private
8144
+ */
6696
8145
  generateTagName(workspace) {
6697
8146
  try {
6698
8147
  const tagTemplate = this.getConfig("tagTemplate");
6699
- return this.shell.format(
8148
+ return Shell5.format(
6700
8149
  tagTemplate,
6701
8150
  workspace
6702
8151
  );
@@ -6705,10 +8154,42 @@ var Changelog = class extends Plugin {
6705
8154
  return `${workspace.name}-v0.0.0`;
6706
8155
  }
6707
8156
  }
8157
+ /**
8158
+ * Gets the appropriate tag name for a workspace
8159
+ *
8160
+ * Attempts to find the latest tag for the workspace, falling back
8161
+ * to generating a new tag if none exists. Uses git commands to
8162
+ * find and sort tags by creation date.
8163
+ *
8164
+ * Process:
8165
+ * 1. Generate current tag pattern
8166
+ * 2. Search for existing tags matching pattern
8167
+ * 3. Return latest tag or generate new one
8168
+ *
8169
+ * @param workspace - Workspace configuration
8170
+ * @returns Promise resolving to tag name
8171
+ *
8172
+ * @example
8173
+ * ```typescript
8174
+ * // With existing tags
8175
+ * const tag = await plugin.getTagName({
8176
+ * name: 'pkg-a',
8177
+ * version: '1.0.0'
8178
+ * });
8179
+ * // Returns latest matching tag: 'pkg-a@0.9.0'
8180
+ *
8181
+ * // Without existing tags
8182
+ * const tag = await plugin.getTagName({
8183
+ * name: 'pkg-b',
8184
+ * version: '1.0.0'
8185
+ * });
8186
+ * // Returns new tag: 'pkg-b@1.0.0'
8187
+ * ```
8188
+ */
6708
8189
  async getTagName(workspace) {
6709
8190
  try {
6710
8191
  const currentTagPattern = this.generateTagName(workspace);
6711
- const tagMatch = this.shell.format(
8192
+ const tagMatch = Shell5.format(
6712
8193
  this.getConfig("tagMatch"),
6713
8194
  workspace
6714
8195
  );
@@ -6731,8 +8212,33 @@ var Changelog = class extends Plugin {
6731
8212
  return fallbackTag;
6732
8213
  }
6733
8214
  }
8215
+ /**
8216
+ * Determines the version increment type
8217
+ *
8218
+ * Checks for increment labels in the following order:
8219
+ * 1. 'increment:major' label
8220
+ * 2. 'increment:minor' label
8221
+ * 3. Configured increment value
8222
+ * 4. Default to 'patch'
8223
+ *
8224
+ * @returns Version increment type
8225
+ *
8226
+ * @example
8227
+ * ```typescript
8228
+ * // With labels
8229
+ * context.options.workspaces.changeLabels = ['increment:major'];
8230
+ * plugin.getIncrement(); // 'major'
8231
+ *
8232
+ * // With configuration
8233
+ * const plugin = new Changelog(context, { increment: 'minor' });
8234
+ * plugin.getIncrement(); // 'minor'
8235
+ *
8236
+ * // Default
8237
+ * plugin.getIncrement(); // 'patch'
8238
+ * ```
8239
+ */
6734
8240
  getIncrement() {
6735
- const lables = this.context.getConfig("workspaces.changeLabels");
8241
+ const lables = this.context.getOptions("workspaces.changeLabels");
6736
8242
  if (Array.isArray(lables) && lables.length > 0) {
6737
8243
  if (lables.includes("increment:major")) {
6738
8244
  return "major";
@@ -6744,13 +8250,50 @@ var Changelog = class extends Plugin {
6744
8250
  const increment = this.getConfig("increment", "patch");
6745
8251
  return increment;
6746
8252
  }
8253
+ /**
8254
+ * Generates a changeset file for a workspace
8255
+ *
8256
+ * Creates a changeset file containing version increment
8257
+ * information and changelog content. Handles dry run mode
8258
+ * and existing files.
8259
+ *
8260
+ * File format:
8261
+ * ```yaml
8262
+ * ---
8263
+ * 'package-name': 'increment-type'
8264
+ * ---
8265
+ *
8266
+ * changelog content
8267
+ * ```
8268
+ *
8269
+ * @param workspace - Workspace configuration
8270
+ *
8271
+ * @example
8272
+ * ```typescript
8273
+ * const workspace = {
8274
+ * name: 'pkg-a',
8275
+ * version: '1.0.0',
8276
+ * changelog: '- feat: new feature'
8277
+ * };
8278
+ *
8279
+ * await plugin.generateChangesetFile(workspace);
8280
+ * // Creates .changeset/pkg-a-1.0.0.md
8281
+ * ```
8282
+ *
8283
+ * @example Dry run
8284
+ * ```typescript
8285
+ * context.dryRun = true;
8286
+ * await plugin.generateChangesetFile(workspace);
8287
+ * // Logs file content without creating file
8288
+ * ```
8289
+ */
6747
8290
  async generateChangesetFile(workspace) {
6748
8291
  const { name, version: version2 } = workspace;
6749
8292
  const changesetName = `${name}-${version2}`.replace(/[\/\\]/g, "_");
6750
8293
  const changesetPath = join4(this.changesetRoot, `${changesetName}.md`);
6751
8294
  const increment = this.getIncrement();
6752
8295
  this.logger.debug("increment is:", [increment]);
6753
- const fileContent = this.shell.format(contentTmplate, {
8296
+ const fileContent = Shell5.format(contentTmplate, {
6754
8297
  ...workspace,
6755
8298
  increment
6756
8299
  });
@@ -6775,18 +8318,93 @@ var innerTuples = [
6775
8318
  tuple(Changelog, {}),
6776
8319
  tuple(GithubPR, {})
6777
8320
  ];
8321
+ var defaultName = "release";
6778
8322
  var ReleaseTask = class {
8323
+ /**
8324
+ * Creates a new ReleaseTask instance
8325
+ *
8326
+ * Initializes the release context and sets up plugin configuration.
8327
+ * Supports custom executors and plugin configurations.
8328
+ *
8329
+ * @param options - Release context configuration
8330
+ * @param executor - Custom async executor (optional)
8331
+ * @param defaultTuples - Plugin configuration tuples (optional)
8332
+ *
8333
+ * @example
8334
+ * ```typescript
8335
+ * // Basic initialization
8336
+ * const task = new ReleaseTask({
8337
+ * rootPath: '/path/to/project',
8338
+ * sourceBranch: 'main'
8339
+ * });
8340
+ *
8341
+ * // With custom executor and plugins
8342
+ * const task = new ReleaseTask(
8343
+ * { rootPath: '/path/to/project' },
8344
+ * new AsyncExecutor(),
8345
+ * [tuple(CustomPlugin, { option: 'value' })]
8346
+ * );
8347
+ * ```
8348
+ */
6779
8349
  constructor(options = {}, executor = new AsyncExecutor(), defaultTuples = innerTuples) {
6780
8350
  this.executor = executor;
6781
8351
  this.defaultTuples = defaultTuples;
6782
- this.context = new ReleaseContext(options);
8352
+ this.context = new ReleaseContext(defaultName, options);
6783
8353
  }
8354
+ /**
8355
+ * Release context instance
8356
+ * @protected
8357
+ */
6784
8358
  context;
8359
+ /**
8360
+ * Gets the current release context
8361
+ *
8362
+ * @returns Release context instance
8363
+ *
8364
+ * @example
8365
+ * ```typescript
8366
+ * const task = new ReleaseTask();
8367
+ * const context = task.getContext();
8368
+ *
8369
+ * console.log(context.releaseEnv);
8370
+ * console.log(context.sourceBranch);
8371
+ * ```
8372
+ */
6785
8373
  getContext() {
6786
8374
  return this.context;
6787
8375
  }
8376
+ /**
8377
+ * Loads and configures plugins for the release task
8378
+ *
8379
+ * Combines default and external plugins, initializes them with
8380
+ * the current context, and configures special cases like the
8381
+ * Workspaces plugin.
8382
+ *
8383
+ * Plugin Loading Process:
8384
+ * 1. Merge default and external plugins
8385
+ * 2. Initialize plugins with context
8386
+ * 3. Configure special plugins
8387
+ * 4. Add plugins to executor
8388
+ *
8389
+ * @param externalTuples - Additional plugin configurations
8390
+ * @returns Array of initialized plugins
8391
+ *
8392
+ * @example Basic usage
8393
+ * ```typescript
8394
+ * const task = new ReleaseTask();
8395
+ * const plugins = await task.usePlugins();
8396
+ * ```
8397
+ *
8398
+ * @example Custom plugins
8399
+ * ```typescript
8400
+ * const task = new ReleaseTask();
8401
+ * const plugins = await task.usePlugins([
8402
+ * tuple(CustomPlugin, { option: 'value' })
8403
+ * ]);
8404
+ * ```
8405
+ */
6788
8406
  async usePlugins(externalTuples) {
6789
- externalTuples = externalTuples || this.context.shared.plugins || [];
8407
+ externalTuples = externalTuples || this.context.options.plugins || [];
6790
8408
  const plugins = await loaderPluginsFromPluginTuples(this.context, [
6791
8409
  ...this.defaultTuples,
6792
8410
  ...externalTuples
@@ -6799,12 +8417,65 @@ var ReleaseTask = class {
6799
8417
  });
6800
8418
  return plugins;
6801
8419
  }
8420
+ /**
8421
+ * Executes the release task
8422
+ *
8423
+ * Internal method that runs the task through the executor.
8424
+ * Preserves the context through the execution chain.
8425
+ *
8426
+ * @returns Execution result
8427
+ * @internal
8428
+ */
6802
8429
  async run() {
6803
8430
  return this.executor.exec(
6804
8431
  this.context,
6805
8432
  (context) => Promise.resolve(context)
6806
8433
  );
6807
8434
  }
8435
+ /**
8436
+ * Main entry point for executing the release task
8437
+ *
8438
+ * Checks environment conditions, loads plugins, and executes
8439
+ * the release process. Supports additional plugin configuration
8440
+ * at execution time.
8441
+ *
8442
+ * Environment Control:
8443
+ * - Checks FE_RELEASE environment variable
8444
+ * - Skips release if FE_RELEASE=false
8445
+ *
8446
+ * @param externalTuples - Additional plugin configurations
8447
+ * @returns Execution result
8448
+ * @throws Error if release is skipped via environment variable
8449
+ *
8450
+ * @example Basic execution
8451
+ * ```typescript
8452
+ * const task = new ReleaseTask();
8453
+ * await task.exec();
8454
+ * ```
8455
+ *
8456
+ * @example With additional plugins
8457
+ * ```typescript
8458
+ * const task = new ReleaseTask();
8459
+ * await task.exec([
8460
+ * tuple(CustomPlugin, { option: 'value' })
8461
+ * ]);
8462
+ * ```
8463
+ *
8464
+ * @example Environment control
8465
+ * ```typescript
8466
+ * // Skip release
8467
+ * process.env.FE_RELEASE = 'false';
8468
+ *
8469
+ * const task = new ReleaseTask();
8470
+ * try {
8471
+ * await task.exec();
8472
+ * } catch (e) {
8473
+ * if (e.message === 'Skip Release') {
8474
+ * console.log('Release skipped via environment variable');
8475
+ * }
8476
+ * }
8477
+ * ```
8478
+ */
6808
8479
  async exec(externalTuples) {
6809
8480
  if (this.context.env.get("FE_RELEASE") === "false") {
6810
8481
  throw new Error("Skip Release");
@@ -6863,16 +8534,11 @@ function programArgs() {
6863
8534
  splitWithComma
6864
8535
  );
6865
8536
  program.parse();
6866
- return reduceOptions(program.opts(), "shared");
8537
+ return reduceOptions(program.opts(), "global");
6867
8538
  }
6868
8539
  async function main() {
6869
- const { shared: commonOptions, ...allOptions } = programArgs();
6870
- const { dryRun, verbose, ...shared } = commonOptions;
6871
- const options = Object.assign(
6872
- allOptions,
6873
- {}
6874
- );
6875
- await new ReleaseTask({ dryRun, verbose, options, shared }).exec();
8540
+ const { global: global2, ...allOptions } = programArgs();
8541
+ await new ReleaseTask({ ...global2, options: allOptions }).exec();
6876
8542
  }
6877
8543
  main().catch((e) => {
6878
8544
  console.error(e.message);