@operad-io/dev 0.0.1 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -791
- package/dev.schema.json +46 -17
- package/package.json +7 -7
- package/src/chat.ts +1 -1
- package/src/gate.ts +83 -30
- package/src/index.ts +2 -1
- package/src/integrate.ts +14 -2
- package/src/marks.ts +1 -1
- package/src/model.ts +6 -0
- package/src/notcode.ts +39 -0
- package/src/project-settings.ts +7 -0
- package/src/rerun.ts +15 -3
- package/src/schedule.ts +1 -1
- package/src/settings.ts +36 -4
package/src/settings.ts
CHANGED
|
@@ -123,6 +123,8 @@ export interface WorkSettings {
|
|
|
123
123
|
export interface GateSettings {
|
|
124
124
|
readonly commands: readonly CheckCommand[];
|
|
125
125
|
readonly commandTimeoutSecs: number;
|
|
126
|
+
/** How long a gate command may write nothing; unset turns the limit off. */
|
|
127
|
+
readonly stallSecs?: number;
|
|
126
128
|
/** The most checks of this repository that run at once; unset means no limit of its own. */
|
|
127
129
|
readonly places?: number;
|
|
128
130
|
}
|
|
@@ -204,8 +206,11 @@ export interface ReviewerSettings {
|
|
|
204
206
|
* reviewer's own for that review. Every later review uses the reviewer's.
|
|
205
207
|
*/
|
|
206
208
|
readonly first?: ReviewerFirst | undefined;
|
|
207
|
-
/**
|
|
208
|
-
|
|
209
|
+
/**
|
|
210
|
+
* The step, or the steps in order, used when the primary reviewer is
|
|
211
|
+
* unavailable or does not write the report.
|
|
212
|
+
*/
|
|
213
|
+
readonly fallback?: ReviewerFallback | readonly ReviewerFallback[] | undefined;
|
|
209
214
|
readonly timeoutSecs: number;
|
|
210
215
|
/** How long a review may print nothing; unset uses the harness default. */
|
|
211
216
|
readonly stallSecs?: number | undefined;
|
|
@@ -610,7 +615,12 @@ function gateSettings(value: unknown, field: string): GateSettings {
|
|
|
610
615
|
throw new DevError(field, "must be an object");
|
|
611
616
|
}
|
|
612
617
|
for (const key of Object.keys(value)) {
|
|
613
|
-
if (
|
|
618
|
+
if (
|
|
619
|
+
key !== "commands" &&
|
|
620
|
+
key !== "commandTimeoutSecs" &&
|
|
621
|
+
key !== "stallSecs" &&
|
|
622
|
+
key !== "places"
|
|
623
|
+
) {
|
|
614
624
|
throw new DevError(`${field}.${key}`, "is not a gate setting");
|
|
615
625
|
}
|
|
616
626
|
}
|
|
@@ -623,6 +633,9 @@ function gateSettings(value: unknown, field: string): GateSettings {
|
|
|
623
633
|
value.commandTimeoutSecs === undefined
|
|
624
634
|
? DEFAULT_DEV_SETTINGS.gate.commandTimeoutSecs
|
|
625
635
|
: positiveSeconds(value.commandTimeoutSecs, `${field}.commandTimeoutSecs`),
|
|
636
|
+
...(value.stallSecs === undefined
|
|
637
|
+
? {}
|
|
638
|
+
: { stallSecs: positiveSeconds(value.stallSecs, `${field}.stallSecs`) }),
|
|
626
639
|
...(value.places === undefined
|
|
627
640
|
? {}
|
|
628
641
|
: { places: positiveCount(value.places, `${field}.places`) }),
|
|
@@ -718,6 +731,25 @@ function fixLevelOf(value: unknown, field: string): FixLevel {
|
|
|
718
731
|
return value;
|
|
719
732
|
}
|
|
720
733
|
|
|
734
|
+
/** The fallbacks of a reviewer in the order they are tried. */
|
|
735
|
+
export function reviewerFallbacks(
|
|
736
|
+
fallback: ReviewerFallback | readonly ReviewerFallback[] | undefined,
|
|
737
|
+
): readonly ReviewerFallback[] {
|
|
738
|
+
if (fallback === undefined) return [];
|
|
739
|
+
return Array.isArray(fallback) ? fallback : [fallback as ReviewerFallback];
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
function reviewerFallbackSetting(
|
|
743
|
+
value: unknown,
|
|
744
|
+
field: string,
|
|
745
|
+
): ReviewerFallback | readonly ReviewerFallback[] {
|
|
746
|
+
if (!Array.isArray(value)) return reviewerFallback(value, field);
|
|
747
|
+
if (value.length === 0) throw new DevError(field, "must not be an empty list");
|
|
748
|
+
return value.map((entry, index) =>
|
|
749
|
+
reviewerFallback(entry, `${field}[${index}]`),
|
|
750
|
+
);
|
|
751
|
+
}
|
|
752
|
+
|
|
721
753
|
function reviewerFallback(value: unknown, field: string): ReviewerFallback {
|
|
722
754
|
if (!isRecord(value)) {
|
|
723
755
|
throw new DevError(field, "must be an object");
|
|
@@ -800,7 +832,7 @@ function reviewerSettings(value: unknown, field: string): ReviewerSettings {
|
|
|
800
832
|
const fallback =
|
|
801
833
|
value.fallback === undefined
|
|
802
834
|
? undefined
|
|
803
|
-
:
|
|
835
|
+
: reviewerFallbackSetting(value.fallback, `${field}.fallback`);
|
|
804
836
|
return {
|
|
805
837
|
use:
|
|
806
838
|
value.use === undefined
|