@kitman-sh/software-engineering 0.12.0-rc.1 → 0.12.0-rc.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bundle.js CHANGED
@@ -12605,8 +12605,23 @@ var LOCAL_PATH_KEYS = new Set([
12605
12605
  "docker_socket",
12606
12606
  "ssh_agent_socket"
12607
12607
  ]);
12608
- var wrappedValue = String.raw`<[A-Za-z][A-Za-z0-9 _.-]*>|\$\{[^{}\s]*\}|\{\{[^{}]*\}\}|proxy-ep=[A-Za-z0-9.-]+;kitmanref(?:[0-9a-f]{2})+(?![A-Za-z0-9._~+/-])`;
12608
+ var wrappedValue = String.raw`<[A-Za-z][A-Za-z0-9 _.|-]*>|\$\{[^{}\s]*\}|\{\{[^{}]*\}\}|proxy-ep=[A-Za-z0-9.-]+;kitmanref(?:[0-9a-f]{2})+(?![A-Za-z0-9._~+/-])`;
12609
+ var placeholderWord = "(?:[A-Z]?[a-z]+|[A-Z]+)";
12610
+ var placeholderNamePart = `(?:[A-Z]?[a-z]+|[A-Z]+)(?:[A-Z][a-z]+)*[0-9]{0,4}`;
12611
+ var anglePlaceholder = `<${placeholderWord}[0-9]{0,2}(?:[ _.|-]${placeholderWord}[0-9]{0,2})*>`;
12612
+ var secretReferencePart = String.raw`(?:[A-Za-z0-9_.-]+|${anglePlaceholder}|\$\{[A-Za-z_][A-Za-z0-9_]*\}|\{\{\s*[A-Za-z_][A-Za-z0-9_.]*\s*\}\}|\*|\u2026)`;
12613
+ var describedSecretReference = new RegExp(`^secret://${secretReferencePart}/(?:${secretReferencePart})?$`, "u");
12609
12614
  var secretReferenceTail = String.raw`(?<=secret:)\/\/[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+(?![^\s,;}"')\]\x60])`;
12615
+ var referenceInText = new RegExp(String.raw`secret:\/\/${secretReferencePart}\/${secretReferencePart}(?![^\s,;}"')\]\x60])`, "gu");
12616
+ function inSecretReference(text, start, end) {
12617
+ for (const reference of text.matchAll(referenceInText)) {
12618
+ const referenceEnd = reference.index + reference[0].length;
12619
+ if (reference.index <= start && end <= referenceEnd)
12620
+ return isPlaceholder(unwrapped(reference[0]));
12621
+ }
12622
+ return false;
12623
+ }
12624
+ var placeholderTokenName = new RegExp(`^<?(?:ghp_|github_pat_|glpat-|ksa1\\.|sk-|xox[baprs]-)${placeholderNamePart}(?:[_.-]${placeholderNamePart})*>?$`, "u");
12610
12625
  var bearerValue = /[0-9]|[._~+/:-][A-Za-z0-9]|[<{]/u;
12611
12626
  var VALUE_RULES = [
12612
12627
  { classification: "secret", name: "private-key", pattern: /-----BEGIN (?:RSA |EC |OPENSSH )?PRIVATE KEY-----/u },
@@ -12620,7 +12635,7 @@ var VALUE_RULES = [
12620
12635
  classification: "credential",
12621
12636
  name: "provider-token",
12622
12637
  pattern: /(?:^|[^A-Za-z0-9])(?<value><?(?:ghp_|github_pat_|glpat-|ksa1\.|sk-[A-Za-z0-9_-]{8,}|xox[baprs]-)[A-Za-z0-9._*-]*[A-Za-z0-9_*-]>?)/u,
12623
- holds: (value) => !isPlaceholder(value)
12638
+ holds: (value, _matched, text, start) => !isPlaceholder(value) && !(placeholderTokenName.test(value) && inSecretReference(text, start, start + value.length))
12624
12639
  },
12625
12640
  {
12626
12641
  classification: "credential",
@@ -12651,10 +12666,10 @@ var VALUE_RULES = [
12651
12666
  { classification: "transcript", name: "transcript-content", pattern: /(?:^|\n)\s*(?:user|assistant|system)\s*:/iu }
12652
12667
  ];
12653
12668
  var maskedToken = /^(?:ghp_|github_pat_|glpat-|ksa1\.|xox[baprs]-|sk-(?:ant-(?:[a-z]+[0-9]*-)?|proj-|or-v[0-9]+-)?)(?:x{4,}|X{4,}|\*{4,})$/u;
12654
- var placeholderWord = "(?:[A-Z]?[a-z]+|[A-Z]+)";
12655
12669
  var placeholders = [
12656
12670
  maskedToken,
12657
- new RegExp(`^<${placeholderWord}[0-9]{0,2}(?:[ _.-]${placeholderWord}[0-9]{0,2})*>$`, "u"),
12671
+ new RegExp(`^${anglePlaceholder}$`, "u"),
12672
+ describedSecretReference,
12658
12673
  /^\$\{[A-Za-z_][A-Za-z0-9_]*\}$/u,
12659
12674
  /^\$[A-Za-z_][A-Za-z0-9_]*$/u,
12660
12675
  /^\{\{\s*[A-Za-z_][A-Za-z0-9_.]*\s*\}\}$/u,
@@ -12670,6 +12685,8 @@ function looksLikeCredential(raw, matched) {
12670
12685
  const value = unwrapped(raw);
12671
12686
  if (isPlaceholder(raw) || isPlaceholder(value))
12672
12687
  return false;
12688
+ if (matched === `secret:${raw}` && isPlaceholder(`secret:${value}`))
12689
+ return false;
12673
12690
  return /^[^\s:=]+=\S/u.test(matched) || value.length >= 6 && /[0-9]/u.test(value) || value.length >= 20 && /[a-z]/u.test(value) && /[A-Z]/u.test(value);
12674
12691
  }
12675
12692
  var globalPatterns = new WeakMap;
@@ -13947,7 +13964,8 @@ var RunWaiting = Union2([
13947
13964
  rank: Literals(ClaimRanks),
13948
13965
  position: Int.check(isGreaterThanOrEqualTo2(1)),
13949
13966
  reason: String5,
13950
- movesUpAt: optionalKey2(String5)
13967
+ movesUpAt: optionalKey2(String5),
13968
+ unrunnable: optionalKey2(String5)
13951
13969
  })
13952
13970
  ]);
13953
13971
  var RunEvidence = Struct({
@@ -21108,11 +21126,16 @@ var SeatFinding = Struct({
21108
21126
  detail: FindingDetail,
21109
21127
  approvedCode: optional2(Boolean3)
21110
21128
  });
21129
+ var ReviewedScope = Struct({
21130
+ ...ScopeJudgement.fields,
21131
+ reported: optional2(ArraySchema(String5))
21132
+ });
21133
+ var agreedScope = (scope) => scope.unmet.length === 0 && (scope.reported ?? []).length > 0 ? { ...scope, met: true } : scope;
21111
21134
  var SeatOutput = Struct({
21112
21135
  summary: OneSentence,
21113
21136
  findings: ArraySchema(SeatFinding),
21114
21137
  verdicts: optional2(ArraySchema(RebuttalVerdict)),
21115
- scope: optional2(ScopeJudgement),
21138
+ scope: optional2(ReviewedScope),
21116
21139
  followUps: optional2(ArraySchema(FollowUp))
21117
21140
  });
21118
21141
  var Output = Struct({
@@ -21123,7 +21146,7 @@ var Output = Struct({
21123
21146
  verdicts: ArraySchema(RebuttalVerdict),
21124
21147
  blocking: Boolean3,
21125
21148
  artifactId: String5,
21126
- scope: optional2(ScopeJudgement),
21149
+ scope: optional2(ReviewedScope),
21127
21150
  approval: optional2(Struct({ head: String5, approved: Boolean3, reason: optional2(String5) })),
21128
21151
  next: optional2(Struct({ choice: Literals(choices), detail: optional2(String5) })),
21129
21152
  deliversTo: optional2(ResolvedDeliveryTarget)
@@ -21184,7 +21207,7 @@ var pinnedRange = (input) => gen2(function* () {
21184
21207
  });
21185
21208
  var wholeChange = (input) => input.files === undefined && input.approved === undefined;
21186
21209
  var scopePrompt = (input) => [
21187
- "If your brief has a Task, judge its scope and give it as `scope`: does the change do what the Task's description and each of its Acceptance Criteria ask? Set `met` to true only if it does all of it, and list in `unmet` one line for each criterion or part of the description that is not done. If your brief has no Task, leave `scope` out.",
21210
+ "If your brief has a Task, judge its scope and give it as `scope`: does the change do what the Task's description and each of its Acceptance Criteria ask? Judge it against what is still agreed: a criterion or part an answer under your brief's Answers so far put out of scope is reported, not unmet; list each in `reported`, one line each, and leave it out of `unmet`. Set `met` to true only if the change does all the rest, and list in `unmet` one line for each other criterion or part of the description that is not done. If your brief has no Task, leave `scope` out.",
21188
21211
  ...input.outcome === undefined ? [] : [`The Outcome to prove is ${input.outcome}.`],
21189
21212
  ...input.claims === undefined || input.claims.length === 0 ? [] : [
21190
21213
  "The implementer claims it built these. Check them against the code rather than taking them on trust:",
@@ -21203,6 +21226,7 @@ var promptFor = (seat, target, input, failing, notRun) => [
21203
21226
  `Review ${target}`,
21204
21227
  "Give `summary`: one sentence on whether it can merge and what matters most.",
21205
21228
  "Report each problem as a finding: severity blocker (must not ship), major (fix before merge) or minor (optional); the file path from the repository root; the line; and the detail. When it is one instance of a class of bug, name every other instance in the diff in its detail. Report nothing you have not checked in the code.",
21229
+ "What an answer under your brief's Answers so far put out of scope is reported, not missing: do not report it as a finding.",
21206
21230
  "If the diff is too big to review in one go, review it directory by directory and say so in a finding on the first file you skipped.",
21207
21231
  ...seat === scopeSeat && wholeChange(input) ? [scopePrompt(input)] : [],
21208
21232
  ...input.earlier === undefined || input.earlier.length === 0 ? [] : [earlierPrompt(input.earlier)],
@@ -21233,8 +21257,11 @@ var followUpsOf = (earlier, answers) => earlier.map((finding) => {
21233
21257
  });
21234
21258
  var findingLines = (findings) => findings.map((finding) => `- **${finding.severity}** \`${finding.id}\` ${finding.detail} _(${finding.seats.join(", ")})_`).join(`
21235
21259
  `);
21236
- var reviewText = (summary, findings, followUps, approvedFindings, notRun) => [
21260
+ var reviewText = (summary, findings, followUps, approvedFindings, notRun, reported) => [
21237
21261
  `**Kitman review.** ${summary}`,
21262
+ ...reported.length === 0 ? [] : [`Out of scope by an answer, so reported, not blocking:
21263
+ ${reported.map((item) => `- ${item}`).join(`
21264
+ `)}`],
21238
21265
  ...notRun.length === 0 ? [] : [`Verify never ran these tests, so they are unverified:
21239
21266
  ${notRun.map((item) => `- ${item}`).join(`
21240
21267
  `)}`],
@@ -21313,10 +21340,11 @@ var review_default = defineLoop({
21313
21340
  const approvedFindings = sinceApproval ? merged(true) : [];
21314
21341
  const findings = [...carried, ...fresh];
21315
21342
  const blockers = findings.filter(isBlocking);
21316
- const scope = wholeChange(input) ? outputs.find(([seat]) => seat === scopeSeat)?.[1].scope : undefined;
21343
+ const judged = wholeChange(input) ? outputs.find(([seat]) => seat === scopeSeat)?.[1].scope : undefined;
21344
+ const scope = judged === undefined ? undefined : agreedScope(judged);
21317
21345
  const summary = blockers.length > 0 ? `Blocking: fix ${blockers.map((finding) => finding.id).join(", ")} before merging.` : scope?.met === false ? "Not ready: the change does not yet do what was asked." : failing.length > 0 ? `Not ready: ${failing.join(", ")} fails on this head.` : notRun.length > 0 ? "Not ready: verify never ran some of its tests, so they are unverified." : findings.length === 0 ? sinceApproval ? `No findings in what changed since ${input.approved}: nothing stands in the way of merging.` : "No findings: nothing stands in the way of merging." : ["Can merge: nothing blocks it.", ...outputs.map(([, output]) => output.summary)].join(" ");
21318
21346
  const freshIds = new Set(fresh.map((finding) => finding.id));
21319
- const text = reviewText(summary, findings, followUps, approvedFindings, notRun);
21347
+ const text = reviewText(summary, findings, followUps, approvedFindings, notRun, scope?.reported ?? []);
21320
21348
  const stored = yield* artifact("findings", {
21321
21349
  kind: "review-findings",
21322
21350
  title: "Review findings",
@@ -23055,7 +23083,7 @@ var implementPrompt = (task, outcome, continuing) => [
23055
23083
 
23056
23084
  `);
23057
23085
  var criteriaPrompt = (unanswered, unmet) => [
23058
- unanswered ? "You did not answer the Task's acceptance criteria. Answer each one before anyone reviews the change." : "These acceptance criteria are not met yet. Meet them, or say why they cannot be met here:",
23086
+ unanswered ? "You did not answer the Task's acceptance criteria. Answer each one before anyone reviews the change." : "These acceptance criteria are not met yet. Meet them, or say why they cannot be met here, such as an answer under Answers so far that put them out of scope; do not ask that Question again:",
23059
23087
  ...unmet.map((answer) => `- ${answer.criterion}: ${answer.detail}`),
23060
23088
  criteriaGuidance
23061
23089
  ].join(`
@@ -31148,4 +31176,4 @@ var runKit = (config, identity, packages) => {
31148
31176
  runMain2(program.pipe(flatMap3((code) => sync2(() => process.exit(code)))));
31149
31177
  };
31150
31178
  // .kitman-build-entry.ts
31151
- runKit(kitman_config_default, { name: "@kitman-sh/software-engineering", version: "0.12.0-rc.1" }, []);
31179
+ runKit(kitman_config_default, { name: "@kitman-sh/software-engineering", version: "0.12.0-rc.2" }, []);
@@ -3861,6 +3861,19 @@
3861
3861
  "items": {
3862
3862
  "type": "string"
3863
3863
  }
3864
+ },
3865
+ "reported": {
3866
+ "anyOf": [
3867
+ {
3868
+ "type": "array",
3869
+ "items": {
3870
+ "type": "string"
3871
+ }
3872
+ },
3873
+ {
3874
+ "type": "null"
3875
+ }
3876
+ ]
3864
3877
  }
3865
3878
  },
3866
3879
  "required": [
@@ -5108,7 +5121,7 @@
5108
5121
  "carried": [
5109
5122
  {
5110
5123
  "name": "@kitman-sh/software-engineering",
5111
- "version": "0.12.0-rc.1",
5124
+ "version": "0.12.0-rc.2",
5112
5125
  "setup": "2a237548a69b0cd53ec3be7f687cfa8c2128335b3a655d34e185f2abce6a3c37",
5113
5126
  "loops": [
5114
5127
  "build",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kitman-sh/software-engineering",
3
- "version": "0.12.0-rc.1",
3
+ "version": "0.12.0-rc.2",
4
4
  "description": "Everything for building software: Loops, their Agents, the skills they use and the Ponytail plugin.",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",
@@ -17,12 +17,12 @@
17
17
  "tsconfig.json"
18
18
  ],
19
19
  "dependencies": {
20
- "@kitman-sh/sdk": "0.12.0-rc.1",
20
+ "@kitman-sh/sdk": "0.12.0-rc.2",
21
21
  "effect": "^4.1.2"
22
22
  },
23
23
  "kitman": {
24
24
  "bundle": "dist/bundle.js",
25
- "digest": "87b8392501ff99d1f4374ee094123c04f5793bb8c8ebc78fbe2b53d324908543",
25
+ "digest": "6f3825aa54f2adb3cad20ee1c1b74c935d0a39dde6fcca70366e513e83243d49",
26
26
  "protocolVersion": 5,
27
27
  "declarations": "dist/declarations.json",
28
28
  "setup": {
package/src/build.ts CHANGED
@@ -211,7 +211,7 @@ const criteriaPrompt = (unanswered: boolean, unmet: readonly CriterionAnswer[])
211
211
  [
212
212
  unanswered
213
213
  ? "You did not answer the Task's acceptance criteria. Answer each one before anyone reviews the change."
214
- : 'These acceptance criteria are not met yet. Meet them, or say why they cannot be met here:',
214
+ : 'These acceptance criteria are not met yet. Meet them, or say why they cannot be met here, such as an answer under Answers so far that put them out of scope; do not ask that Question again:',
215
215
  ...unmet.map(answer => `- ${answer.criterion}: ${answer.detail}`),
216
216
  criteriaGuidance
217
217
  ].join('\n\n')
package/src/review.ts CHANGED
@@ -96,12 +96,22 @@ const SeatFinding = Schema.Struct({
96
96
  approvedCode: Schema.optional(Schema.Boolean)
97
97
  })
98
98
 
99
+ /** A scope judgement with what an answer put out of scope, which is reported and never unmet. */
100
+ const ReviewedScope = Schema.Struct({
101
+ ...ScopeJudgement.fields,
102
+ reported: Schema.optional(Schema.Array(Schema.String))
103
+ })
104
+
105
+ /** Met when nothing is unmet but what an answer put out of scope, so a waived criterion never blocks. */
106
+ const agreedScope = (scope: typeof ReviewedScope.Type): typeof ReviewedScope.Type =>
107
+ scope.unmet.length === 0 && (scope.reported ?? []).length > 0 ? { ...scope, met: true } : scope
108
+
99
109
  const SeatOutput = Schema.Struct({
100
110
  /** One sentence: can it merge, and what matters most. */
101
111
  summary: OneSentence,
102
112
  findings: Schema.Array(SeatFinding),
103
113
  verdicts: Schema.optional(Schema.Array(RebuttalVerdict)),
104
- scope: Schema.optional(ScopeJudgement),
114
+ scope: Schema.optional(ReviewedScope),
105
115
  followUps: Schema.optional(Schema.Array(FollowUp))
106
116
  })
107
117
 
@@ -117,7 +127,7 @@ const Output = Schema.Struct({
117
127
  blocking: Schema.Boolean,
118
128
  artifactId: Schema.String,
119
129
  /** The scope seat's judgement of the Task's scope; absent when there was no Task to judge against. */
120
- scope: Schema.optional(ScopeJudgement),
130
+ scope: Schema.optional(ReviewedScope),
121
131
  /** Kitman's approval of the ChangeRequest's head, recorded when nothing blocks it; or why it was refused. */
122
132
  approval: Schema.optional(
123
133
  Schema.Struct({ head: Schema.String, approved: Schema.Boolean, reason: Schema.optional(Schema.String) })
@@ -211,7 +221,7 @@ const wholeChange = (input: typeof Input.Type) => input.files === undefined && i
211
221
 
212
222
  const scopePrompt = (input: typeof Input.Type) =>
213
223
  [
214
- "If your brief has a Task, judge its scope and give it as `scope`: does the change do what the Task's description and each of its Acceptance Criteria ask? Set `met` to true only if it does all of it, and list in `unmet` one line for each criterion or part of the description that is not done. If your brief has no Task, leave `scope` out.",
224
+ "If your brief has a Task, judge its scope and give it as `scope`: does the change do what the Task's description and each of its Acceptance Criteria ask? Judge it against what is still agreed: a criterion or part an answer under your brief's Answers so far put out of scope is reported, not unmet; list each in `reported`, one line each, and leave it out of `unmet`. Set `met` to true only if the change does all the rest, and list in `unmet` one line for each other criterion or part of the description that is not done. If your brief has no Task, leave `scope` out.",
215
225
  ...(input.outcome === undefined ? [] : [`The Outcome to prove is ${input.outcome}.`]),
216
226
  ...(input.claims === undefined || input.claims.length === 0
217
227
  ? []
@@ -239,6 +249,7 @@ const promptFor = (
239
249
  `Review ${target}`,
240
250
  'Give `summary`: one sentence on whether it can merge and what matters most.',
241
251
  'Report each problem as a finding: severity blocker (must not ship), major (fix before merge) or minor (optional); the file path from the repository root; the line; and the detail. When it is one instance of a class of bug, name every other instance in the diff in its detail. Report nothing you have not checked in the code.',
252
+ "What an answer under your brief's Answers so far put out of scope is reported, not missing: do not report it as a finding.",
242
253
  'If the diff is too big to review in one go, review it directory by directory and say so in a finding on the first file you skipped.',
243
254
  ...(seat === scopeSeat && wholeChange(input) ? [scopePrompt(input)] : []),
244
255
  ...(input.earlier === undefined || input.earlier.length === 0 ? [] : [earlierPrompt(input.earlier)]),
@@ -289,10 +300,14 @@ const reviewText = (
289
300
  findings: readonly MergedFinding[],
290
301
  followUps: readonly (typeof FollowUp.Type)[],
291
302
  approvedFindings: readonly MergedFinding[],
292
- notRun: readonly string[]
303
+ notRun: readonly string[],
304
+ reported: readonly string[]
293
305
  ) =>
294
306
  [
295
307
  `**Kitman review.** ${summary}`,
308
+ ...(reported.length === 0
309
+ ? []
310
+ : [`Out of scope by an answer, so reported, not blocking:\n${reported.map(item => `- ${item}`).join('\n')}`]),
296
311
  ...(notRun.length === 0
297
312
  ? []
298
313
  : [`Verify never ran these tests, so they are unverified:\n${notRun.map(item => `- ${item}`).join('\n')}`]),
@@ -419,7 +434,8 @@ export default defineLoop({
419
434
  const findings = [...carried, ...fresh]
420
435
 
421
436
  const blockers = findings.filter(isBlocking)
422
- const scope = wholeChange(input) ? outputs.find(([seat]) => seat === scopeSeat)?.[1].scope : undefined
437
+ const judged = wholeChange(input) ? outputs.find(([seat]) => seat === scopeSeat)?.[1].scope : undefined
438
+ const scope = judged === undefined ? undefined : agreedScope(judged)
423
439
 
424
440
  // A seat's own summary is kept only when nothing blocks, so it cannot contradict the verdict.
425
441
  const summary =
@@ -438,7 +454,7 @@ export default defineLoop({
438
454
  : ['Can merge: nothing blocks it.', ...outputs.map(([, output]) => output.summary)].join(' ')
439
455
 
440
456
  const freshIds = new Set(fresh.map(finding => finding.id))
441
- const text = reviewText(summary, findings, followUps, approvedFindings, notRun)
457
+ const text = reviewText(summary, findings, followUps, approvedFindings, notRun, scope?.reported ?? [])
442
458
 
443
459
  const stored = yield* artifact('findings', {
444
460
  kind: 'review-findings',