jackherd 1.17.0 → 1.18.1
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/CHANGELOG.md +12 -0
- package/README.md +25 -30
- package/herdr-plugin/herdr-plugin.toml +1 -1
- package/install.sh +1 -1
- package/kit/hooks/hooks/merge-guard/approval.ts +1 -1
- package/kit/hooks/hooks/merge-guard/lane-plan.ts +2 -3
- package/kit/hooks/hooks/plain-question/arguments.ts +8 -0
- package/kit/hooks/hooks/plain-question/index.ts +17 -5
- package/kit/hooks/hooks/plain-question/self-merge-files.ts +35 -0
- package/kit/hooks/hooks/plain-question/staged-files.ts +24 -0
- package/kit/hooks/hooks/shared/worktree-list.ts +8 -0
- package/kit/hooks/hooks/watch-guard/decision.ts +6 -4
- package/kit/hooks/hooks/watch-guard/index.ts +2 -0
- package/kit/review/skills/pre-commit/SKILL.md +16 -22
- package/kit/rules/rules/kit/code-style.md +22 -50
- package/kit/rules/rules/kit/pull-requests.md +17 -40
- package/kit/rules/rules/kit/testing.md +6 -12
- package/kit/workflow/skills/implement/SKILL.md +27 -42
- package/kit/workflow/skills/orchestrate/SKILL.md +158 -235
- package/kit/workflow/skills/orchestrate/references/approvals.md +23 -0
- package/kit/workflow/skills/orchestrate/references/plan-commit.md +2 -1
- package/kit/workflow/skills/plan/SKILL.md +27 -47
- package/package.json +1 -1
- package/src/check/skill-budget-defaults.ts +20 -13
- package/src/check/skill-budgets.ts +42 -12
- package/src/watch/command.ts +7 -3
- package/src/watch/feedback.ts +30 -12
- package/src/watch/lane-report.ts +4 -4
- package/src/watch/preview-read.ts +3 -3
- package/src/watch/previews.ts +9 -9
package/src/watch/previews.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { isRecord } from '../shared/is-record'
|
|
2
|
-
import { type
|
|
2
|
+
import { isReadTime, type LaneFeedbackTarget } from './feedback'
|
|
3
3
|
import { FEEDBACK_FORM, type FeedbackItem } from './feedback-item'
|
|
4
4
|
|
|
5
5
|
export const PREVIEW_EVENT = 'preview'
|
|
@@ -33,7 +33,7 @@ export type PreviewRecord = { reportedHead: string | null; stamps: Record<string
|
|
|
33
33
|
/** `since` is the epoch milliseconds of the last read, null before the first. */
|
|
34
34
|
export type PreviewState = { since: number | null; pullRequests: Record<string, PreviewRecord> }
|
|
35
35
|
|
|
36
|
-
export type PreviewRead = { readAt: number; targets:
|
|
36
|
+
export type PreviewRead = { readAt: number; targets: LaneFeedbackTarget[]; candidates: PreviewCandidate[] }
|
|
37
37
|
|
|
38
38
|
/** Which comments name a preview: their authors' logins, and optionally a pattern whose first group is the URL. */
|
|
39
39
|
export type PreviewSettings = { authors: readonly string[]; urlPattern?: string }
|
|
@@ -125,7 +125,7 @@ export const previewDeployments = (deployments: readonly Deployment[], deployEnv
|
|
|
125
125
|
|
|
126
126
|
/** A deployment of `target`'s head as a candidate once its latest status succeeded with an https URL. */
|
|
127
127
|
export const deploymentCandidate = (
|
|
128
|
-
target:
|
|
128
|
+
target: LaneFeedbackTarget,
|
|
129
129
|
id: number,
|
|
130
130
|
status: DeploymentStatus,
|
|
131
131
|
): PreviewCandidate | null => {
|
|
@@ -144,7 +144,7 @@ export const deploymentCandidate = (
|
|
|
144
144
|
|
|
145
145
|
export const previewReadOf = (
|
|
146
146
|
readAt: number,
|
|
147
|
-
targets:
|
|
147
|
+
targets: LaneFeedbackTarget[],
|
|
148
148
|
candidates: readonly PreviewCandidate[],
|
|
149
149
|
): PreviewRead => {
|
|
150
150
|
const numbers = new Set(targets.map(({ number }) => number))
|
|
@@ -152,18 +152,18 @@ export const previewReadOf = (
|
|
|
152
152
|
}
|
|
153
153
|
|
|
154
154
|
/** A candidate with a URL that may stand for the target's current head: a comment, or a deployment of that head. */
|
|
155
|
-
const isUsable = (candidate: PreviewCandidate, target:
|
|
155
|
+
const isUsable = (candidate: PreviewCandidate, target: LaneFeedbackTarget): boolean =>
|
|
156
156
|
candidate.url !== null && (candidate.headCommit === null || candidate.headCommit === target.headCommit)
|
|
157
157
|
|
|
158
158
|
/** Deployments before comments: a deployment names its commit, a comment does not. */
|
|
159
159
|
const byDeploymentFirst = (a: PreviewCandidate, b: PreviewCandidate): number =>
|
|
160
160
|
Number(a.source !== PREVIEW_SOURCE.deployment) - Number(b.source !== PREVIEW_SOURCE.deployment)
|
|
161
161
|
|
|
162
|
-
const candidatesOf = (read: PreviewRead, target:
|
|
162
|
+
const candidatesOf = (read: PreviewRead, target: LaneFeedbackTarget): PreviewCandidate[] =>
|
|
163
163
|
read.candidates.filter(({ pullRequest }) => pullRequest === target.number).sort(byDeploymentFirst)
|
|
164
164
|
|
|
165
165
|
/** The usable candidate that changed since `record`, when the head has had no preview reported yet. */
|
|
166
|
-
const freshPreview = (record: PreviewRecord, target:
|
|
166
|
+
const freshPreview = (record: PreviewRecord, target: LaneFeedbackTarget, candidates: readonly PreviewCandidate[]) =>
|
|
167
167
|
target.headCommit === record.reportedHead
|
|
168
168
|
? undefined
|
|
169
169
|
: candidates.find((candidate) => record.stamps[candidate.key] !== candidate.stamp && isUsable(candidate, target))
|
|
@@ -189,7 +189,7 @@ export const previewEvents = (previous: PreviewState, read: PreviewRead): Previe
|
|
|
189
189
|
: []
|
|
190
190
|
})
|
|
191
191
|
|
|
192
|
-
const recordOf = (record: PreviewRecord | undefined, target:
|
|
192
|
+
const recordOf = (record: PreviewRecord | undefined, target: LaneFeedbackTarget, candidates: PreviewCandidate[]) => {
|
|
193
193
|
const stamps = Object.fromEntries(candidates.map(({ key, stamp }) => [key, stamp]))
|
|
194
194
|
const shown = record
|
|
195
195
|
? freshPreview(record, target, candidates)
|
|
@@ -211,7 +211,7 @@ export const recordPreviews = (previous: PreviewState, read: PreviewRead): Previ
|
|
|
211
211
|
})
|
|
212
212
|
|
|
213
213
|
/** The targets whose current head has no preview reported yet; only they need their deployments read. */
|
|
214
|
-
export const unreportedTargets = (state: PreviewState, targets: readonly
|
|
214
|
+
export const unreportedTargets = (state: PreviewState, targets: readonly LaneFeedbackTarget[]): LaneFeedbackTarget[] =>
|
|
215
215
|
targets.filter(({ number, headCommit }) => state.pullRequests[String(number)]?.reportedHead !== headCommit)
|
|
216
216
|
|
|
217
217
|
const isPreviewRecord = (value: unknown): boolean =>
|