@kitman-sh/software-engineering 0.50.0 → 0.50.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/dist/bundle.js +132 -23
- package/dist/declarations.json +801 -57
- package/package.json +3 -3
- package/src/build.ts +7 -4
- package/src/implemented.ts +112 -16
- package/src/reproduced.ts +28 -3
- package/src/suggested-check.ts +104 -4
package/dist/bundle.js
CHANGED
|
@@ -20259,6 +20259,7 @@ var EvidenceCheck = Struct({
|
|
|
20259
20259
|
outputTail: optionalKey2(String5),
|
|
20260
20260
|
failedTests: optionalKey2(ArraySchema(String5)),
|
|
20261
20261
|
suggested: optionalKey2(Boolean3),
|
|
20262
|
+
notStarted: optionalKey2(Boolean3),
|
|
20262
20263
|
skippedSinceBaseline: optionalKey2(ArraySchema(String5)),
|
|
20263
20264
|
newNotRun: optionalKey2(ArraySchema(String5)),
|
|
20264
20265
|
environmentFailure: optionalKey2(Struct({
|
|
@@ -20273,7 +20274,12 @@ var VerifyResult = Struct({
|
|
|
20273
20274
|
tree: String5,
|
|
20274
20275
|
passed: Boolean3,
|
|
20275
20276
|
unchanged: optionalKey2(Boolean3),
|
|
20276
|
-
checks: ArraySchema(EvidenceCheck)
|
|
20277
|
+
checks: ArraySchema(EvidenceCheck),
|
|
20278
|
+
runnable: optionalKey2(ArraySchema(Struct({
|
|
20279
|
+
name: String5,
|
|
20280
|
+
command: String5,
|
|
20281
|
+
workingDirectory: optionalKey2(String5)
|
|
20282
|
+
})))
|
|
20277
20283
|
});
|
|
20278
20284
|
var verdict = (reasons) => reasons.length === 0 ? { settled: true } : { settled: false, reasons };
|
|
20279
20285
|
var missing2 = (side) => `No verification evidence for the ${side}`;
|
|
@@ -23566,6 +23572,7 @@ var scriptedHost = (script, engine, agentLaunches, childLaunches, waits, verifyL
|
|
|
23566
23572
|
step: launch.step,
|
|
23567
23573
|
...launch.revision === undefined ? undefined : { revision: launch.revision },
|
|
23568
23574
|
...launch.checks === undefined ? undefined : { checks: launch.checks },
|
|
23575
|
+
...launch.suggested === undefined ? undefined : { suggested: launch.suggested },
|
|
23569
23576
|
...launch.extra === undefined ? undefined : { extra: launch.extra },
|
|
23570
23577
|
...launch.rerunFailed === undefined ? undefined : { rerunFailed: launch.rerunFailed }
|
|
23571
23578
|
});
|
|
@@ -23574,7 +23581,11 @@ var scriptedHost = (script, engine, agentLaunches, childLaunches, waits, verifyL
|
|
|
23574
23581
|
const flat = Array.from({ length: launch.measure.samples }, () => Object.fromEntries(launch.measure?.plan.metrics.map((metric) => [metric.name, 100]) ?? []));
|
|
23575
23582
|
return resolve(measureDeferred(launch.step), launch.token, measured instanceof ScriptedFailure ? fail5(new StepFailed({ step: launch.step, reason: measured.reason })) : succeed4(measured ?? { base: flat, head: flat, ...launch.measure.calibrate ? { baseAgain: flat } : undefined }));
|
|
23576
23583
|
}
|
|
23577
|
-
return resolve(verifyDeferred(launch.step), launch.token, scripted instanceof ScriptedFailure ? fail5(new StepFailed({
|
|
23584
|
+
return resolve(verifyDeferred(launch.step), launch.token, scripted instanceof ScriptedFailure ? fail5(new StepFailed({
|
|
23585
|
+
step: launch.step,
|
|
23586
|
+
reason: scripted.reason,
|
|
23587
|
+
...scripted.code === undefined ? undefined : { code: scripted.code }
|
|
23588
|
+
})) : succeed4(scripted ?? {
|
|
23578
23589
|
revision: launch.revision ?? "head",
|
|
23579
23590
|
tree: launch.revision ?? "head",
|
|
23580
23591
|
passed: true,
|
|
@@ -24718,9 +24729,62 @@ var reviewer = agent("reviewer");
|
|
|
24718
24729
|
|
|
24719
24730
|
// src/suggested-check.ts
|
|
24720
24731
|
var SuggestedCheck = Struct({
|
|
24721
|
-
name:
|
|
24722
|
-
command:
|
|
24723
|
-
workingDirectory:
|
|
24732
|
+
name: ApprovedCheck.fields.name,
|
|
24733
|
+
command: ApprovedCheck.fields.command,
|
|
24734
|
+
workingDirectory: ApprovedCheck.fields.workingDirectory
|
|
24735
|
+
});
|
|
24736
|
+
var checkRefusals = ["Already a check of this repository with another command", "Two checks named", "Could not start"];
|
|
24737
|
+
var refusedCheck = (error) => error.code === "step_refused" && checkRefusals.some((refusal) => error.reason.startsWith(refusal));
|
|
24738
|
+
var sameCommand = (one, other) => one.command === other.command && one.workingDirectory === other.workingDirectory;
|
|
24739
|
+
var clashingChecks = (step, checks) => {
|
|
24740
|
+
const twice = [
|
|
24741
|
+
...new Set(checks.flatMap((check, index) => checks.slice(0, index).some((other) => other.name === check.name && !sameCommand(other, check)) ? [check.name] : []))
|
|
24742
|
+
];
|
|
24743
|
+
return twice.length === 0 ? undefined : new StepFailed({
|
|
24744
|
+
step,
|
|
24745
|
+
code: "step_refused",
|
|
24746
|
+
reason: `Two checks named with different commands: ${twice.join(", ")}; give each check its own name`
|
|
24747
|
+
});
|
|
24748
|
+
};
|
|
24749
|
+
var unstartedChecks = (result, named) => result.checks.filter((check) => check.notStarted === true && named.some((one) => one.name === check.name && one.command === check.command));
|
|
24750
|
+
var unstartedRefusal = (step, result, named) => {
|
|
24751
|
+
const unstarted = unstartedChecks(result, named);
|
|
24752
|
+
return unstarted.length === 0 ? undefined : new StepFailed({
|
|
24753
|
+
step,
|
|
24754
|
+
code: "step_refused",
|
|
24755
|
+
reason: [
|
|
24756
|
+
`Could not start: ${unstarted.map((check) => `${check.name}: \`${check.command}\` printed ${JSON.stringify(check.outputTail ?? "")}`).join("; ")}`,
|
|
24757
|
+
(result.runnable ?? []).length === 0 ? "The repository approves no checks" : `Its checks are ${(result.runnable ?? []).map(shownCheck).join("; ")}`
|
|
24758
|
+
].join(". ")
|
|
24759
|
+
});
|
|
24760
|
+
};
|
|
24761
|
+
var Renamed = Struct({
|
|
24762
|
+
renamed: Record(String5, CheckName),
|
|
24763
|
+
commands: optional2(Record(String5, Struct({
|
|
24764
|
+
command: SuggestedCheck.fields.command,
|
|
24765
|
+
workingDirectory: SuggestedCheck.fields.workingDirectory
|
|
24766
|
+
})))
|
|
24767
|
+
});
|
|
24768
|
+
var shownCheck = (check) => `${check.name}: \`${check.command}\`${check.workingDirectory === undefined ? "" : ` in ${check.workingDirectory}`}`;
|
|
24769
|
+
var numbered = (check, index) => `${index + 1}. ${shownCheck(check)}`;
|
|
24770
|
+
var renamePrompt = (reason, named, kept = []) => [
|
|
24771
|
+
`Kitman will not run the checks you named: ${reason}`,
|
|
24772
|
+
["You named:", ...named.map(numbered)].join(`
|
|
24773
|
+
`),
|
|
24774
|
+
...kept.length === 0 ? [] : [["These keep their names:", ...kept.map((check) => `- ${shownCheck(check)}`)].join(`
|
|
24775
|
+
`)],
|
|
24776
|
+
"Give in `renamed`, keyed by each one's number, a new name of letters, digits, `.`, `_`, `:` and `-` that no other check has, for each you rename. Kitman keeps each command and runs it under its new name, except one that could not start: give it, in `commands` under its number, a command that runs in this repository, or one of its checks exactly with that check's name. Change nothing in the workspace."
|
|
24777
|
+
].join(`
|
|
24778
|
+
|
|
24779
|
+
`);
|
|
24780
|
+
var renamedChecks = (named, renamed) => named.map((check, index) => {
|
|
24781
|
+
const key = String(index + 1);
|
|
24782
|
+
const run = renamed.commands?.[key] ?? check;
|
|
24783
|
+
return {
|
|
24784
|
+
name: renamed.renamed[key] ?? check.name,
|
|
24785
|
+
command: run.command,
|
|
24786
|
+
...run.workingDirectory === undefined ? undefined : { workingDirectory: run.workingDirectory }
|
|
24787
|
+
};
|
|
24724
24788
|
});
|
|
24725
24789
|
|
|
24726
24790
|
// src/implemented.ts
|
|
@@ -24728,19 +24792,20 @@ var Change = Struct({
|
|
|
24728
24792
|
title: String5,
|
|
24729
24793
|
summary: ChangeRequestSummary,
|
|
24730
24794
|
claims: ArraySchema(ShortStatement),
|
|
24731
|
-
documented: optional2(ArraySchema(
|
|
24732
|
-
rollback: optional2(
|
|
24795
|
+
documented: optional2(ArraySchema(SuggestedCheck)),
|
|
24796
|
+
rollback: optional2(SuggestedCheck),
|
|
24733
24797
|
criteria: optional2(ArraySchema(CriterionAnswer)),
|
|
24734
24798
|
checks: optional2(ArraySchema(SuggestedCheck))
|
|
24735
24799
|
});
|
|
24736
24800
|
var Criteria = Struct({ criteria: ArraySchema(CriterionAnswer) });
|
|
24801
|
+
var proofGuidance = "Give each the command itself, with a `name` of letters, digits, `.`, `_`, `:` and `-` that no check of the repository has, unless it is exactly an approved check's name, command and directory. Kitman runs them on every head; a narrower command than an approved check is its own check.";
|
|
24737
24802
|
var outcomeGuidance = {
|
|
24738
24803
|
feature: "Deliver the whole scope; review checks it was met.",
|
|
24739
24804
|
bug: "Your failing test is already in place: make it pass.",
|
|
24740
24805
|
refactor: "Keep behaviour exactly as it is; the approved verifications must pass before and after.",
|
|
24741
24806
|
investigation: "Investigate and report what you found, with its sources.",
|
|
24742
|
-
docs:
|
|
24743
|
-
migration:
|
|
24807
|
+
docs: `Name, in \`documented\`, a check for each command you documented that runs exactly it. ${proofGuidance}`,
|
|
24808
|
+
migration: `Name, in \`rollback\`, the check that rolls the migration back. ${proofGuidance}`,
|
|
24744
24809
|
performance: "Make it faster without changing behaviour."
|
|
24745
24810
|
};
|
|
24746
24811
|
var criteriaGuidance = "If your brief has a Task, answer each of its acceptance criteria in `criteria`: met, with the test or file that shows it; after_merge, with why it can only be seen once merged; or not_met, with why. Give an empty `criteria` when the Task has none.";
|
|
@@ -24774,6 +24839,40 @@ var criteriaPrompt = (unanswered, unmet, cases) => [
|
|
|
24774
24839
|
].join(`
|
|
24775
24840
|
|
|
24776
24841
|
`);
|
|
24842
|
+
var proofsOf = (outcome, change) => {
|
|
24843
|
+
if (outcome === "docs")
|
|
24844
|
+
return change.documented ?? [];
|
|
24845
|
+
return outcome === "migration" && change.rollback !== undefined ? [change.rollback] : [];
|
|
24846
|
+
};
|
|
24847
|
+
var runnableProofs = (outcome, change, reproducing) => gen2(function* () {
|
|
24848
|
+
const kept = reproducing === undefined ? [] : [reproducing];
|
|
24849
|
+
const checked = ({
|
|
24850
|
+
checks,
|
|
24851
|
+
proofs
|
|
24852
|
+
}, verified) => proofs.length === 0 ? suspend2(() => {
|
|
24853
|
+
const clash = clashingChecks("implemented", [...kept, ...checks]);
|
|
24854
|
+
return clash === undefined ? void_3 : fail7(clash);
|
|
24855
|
+
}) : verified({ checks: [], ...checks.length === 0 ? undefined : { suggested: checks }, extra: proofs }).pipe(flatMap3((result) => {
|
|
24856
|
+
const refusal = unstartedRefusal("implemented", result, proofs);
|
|
24857
|
+
return refusal === undefined ? void_3 : fail7(refusal);
|
|
24858
|
+
}));
|
|
24859
|
+
const named = { checks: change.checks ?? [], proofs: proofsOf(outcome, change) };
|
|
24860
|
+
const { checks, proofs } = yield* checked(named, (launch) => verify("proofs", launch)).pipe(as2(named), catchTag2("StepFailed", (error) => refusedCheck(error) ? gen2(function* () {
|
|
24861
|
+
const all = [...named.checks, ...named.proofs];
|
|
24862
|
+
const renamed = renamedChecks(all, yield* implementer("rename", { prompt: renamePrompt(error.reason, all, kept), output: Renamed }));
|
|
24863
|
+
const again = {
|
|
24864
|
+
checks: renamed.slice(0, named.checks.length),
|
|
24865
|
+
proofs: renamed.slice(named.checks.length)
|
|
24866
|
+
};
|
|
24867
|
+
yield* checked(again, (launch) => verify("proofs-renamed", launch));
|
|
24868
|
+
return again;
|
|
24869
|
+
}) : fail7(error)));
|
|
24870
|
+
return {
|
|
24871
|
+
...change.checks === undefined ? undefined : { checks },
|
|
24872
|
+
...outcome === "docs" && change.documented !== undefined ? { documented: proofs } : undefined,
|
|
24873
|
+
...outcome === "migration" && change.rollback !== undefined ? { rollback: proofs[0] } : undefined
|
|
24874
|
+
};
|
|
24875
|
+
});
|
|
24777
24876
|
|
|
24778
24877
|
class Implemented extends TaggedClass2()("Implemented", {
|
|
24779
24878
|
...Change.fields,
|
|
@@ -24793,12 +24892,15 @@ var implemented = step2("implemented", {
|
|
|
24793
24892
|
cases: optional2(ArraySchema(String5)).annotate({
|
|
24794
24893
|
description: "The Task's Out of scope list, which the implementer does not build."
|
|
24795
24894
|
}),
|
|
24895
|
+
reproducing: optional2(SuggestedCheck).annotate({
|
|
24896
|
+
description: "The bug's reproducing check, whose name the implementer's checks may not take for another command."
|
|
24897
|
+
}),
|
|
24796
24898
|
planReviewed: optional2(Boolean3).annotate({
|
|
24797
24899
|
description: "Plan review passed the Task and this is its first implementation: the `planned-implementer` makes it."
|
|
24798
24900
|
})
|
|
24799
24901
|
},
|
|
24800
24902
|
success: Implemented,
|
|
24801
|
-
run: ({ words, taskId, outcome, continuing, cases = [], planReviewed }) => gen2(function* () {
|
|
24903
|
+
run: ({ words, taskId, outcome, continuing, cases = [], reproducing, planReviewed }) => gen2(function* () {
|
|
24802
24904
|
const work = {
|
|
24803
24905
|
skill: "implement",
|
|
24804
24906
|
prompt: implementPrompt(taskOf(words), outcome, continuing, cases),
|
|
@@ -24807,13 +24909,8 @@ var implemented = step2("implemented", {
|
|
|
24807
24909
|
const change = yield* planReviewed === true ? plannedImplementer("implement", work) : implementer("implement", work);
|
|
24808
24910
|
const unanswered = taskId !== undefined && change.criteria === undefined;
|
|
24809
24911
|
const unmet = (change.criteria ?? []).filter((answer) => answer.status === "not_met" && caseOf(cases, answer) === undefined);
|
|
24810
|
-
|
|
24811
|
-
|
|
24812
|
-
const { criteria } = yield* implementer("criteria", {
|
|
24813
|
-
prompt: criteriaPrompt(unanswered, unmet, cases),
|
|
24814
|
-
output: Criteria
|
|
24815
|
-
});
|
|
24816
|
-
return new Implemented({ ...change, criteria });
|
|
24912
|
+
const { criteria } = !unanswered && unmet.length === 0 ? { criteria: change.criteria ?? [] } : yield* implementer("criteria", { prompt: criteriaPrompt(unanswered, unmet, cases), output: Criteria });
|
|
24913
|
+
return new Implemented({ ...change, ...yield* runnableProofs(outcome, change, reproducing), criteria });
|
|
24817
24914
|
})
|
|
24818
24915
|
});
|
|
24819
24916
|
|
|
@@ -28969,8 +29066,18 @@ var reproduced = step2("reproduced", {
|
|
|
28969
29066
|
prompt: continuing === undefined ? reproducePrompt(task) : reproducedOnBranchPrompt(task),
|
|
28970
29067
|
output: ReproducingTest
|
|
28971
29068
|
});
|
|
28972
|
-
const
|
|
28973
|
-
|
|
29069
|
+
const verifyAt = (name, reproducing) => verify(name, { ...revision === undefined ? undefined : { revision }, extra: [reproducing] }).pipe(flatMap3((base) => {
|
|
29070
|
+
const refusal = unstartedRefusal(name, base, [reproducing]);
|
|
29071
|
+
return refusal === undefined ? succeed7(new Reproduced({ check: reproducing, base: withoutOutput(base) })) : fail7(refusal);
|
|
29072
|
+
}));
|
|
29073
|
+
return yield* verifyAt("verify", check).pipe(catchTag2("StepFailed", (error) => refusedCheck(error) ? gen2(function* () {
|
|
29074
|
+
const renamed = yield* implementer("rename", {
|
|
29075
|
+
prompt: renamePrompt(error.reason, [check]),
|
|
29076
|
+
output: Renamed
|
|
29077
|
+
});
|
|
29078
|
+
const [reproducing = check] = renamedChecks([check], renamed);
|
|
29079
|
+
return yield* verifyAt("verify-renamed", reproducing);
|
|
29080
|
+
}) : fail7(error)));
|
|
28974
29081
|
})
|
|
28975
29082
|
});
|
|
28976
29083
|
|
|
@@ -29163,8 +29270,8 @@ var gated = ({
|
|
|
29163
29270
|
...before._tag === "NotNeeded" ? undefined : { base: before.base },
|
|
29164
29271
|
...last.scope === undefined ? undefined : { review: last.scope },
|
|
29165
29272
|
...before._tag === "Reproduced" ? { reproducing: before.check.name } : undefined,
|
|
29166
|
-
...change.documented === undefined ? undefined : { documented: change.documented },
|
|
29167
|
-
...change.rollback === undefined ? undefined : { rollback: change.rollback }
|
|
29273
|
+
...change.documented === undefined ? undefined : { documented: change.documented.map((check) => check.name) },
|
|
29274
|
+
...change.rollback === undefined ? undefined : { rollback: change.rollback.name }
|
|
29168
29275
|
});
|
|
29169
29276
|
const stopped = stoppedAs[last._tag];
|
|
29170
29277
|
const findings = codeFindings(last.settled);
|
|
@@ -29253,8 +29360,10 @@ var build2 = defineLoop({
|
|
|
29253
29360
|
outcome,
|
|
29254
29361
|
continuing,
|
|
29255
29362
|
...cases.length === 0 ? undefined : { cases },
|
|
29363
|
+
...before._tag === "Reproduced" ? { reproducing: before.check } : undefined,
|
|
29256
29364
|
...input.planReviewed === true ? { planReviewed: true } : undefined
|
|
29257
29365
|
});
|
|
29366
|
+
const proven = [...before._tag === "Reproduced" ? [before.check] : [], ...proofsOf(outcome, change)];
|
|
29258
29367
|
const last = yield* rallied({
|
|
29259
29368
|
fixer: "implementer",
|
|
29260
29369
|
maxRounds: input.maxRounds ?? 3,
|
|
@@ -29262,7 +29371,7 @@ var build2 = defineLoop({
|
|
|
29262
29371
|
outcome,
|
|
29263
29372
|
claims: [...change.claims, ...change.criteria.map((answer) => `Criterion ${answerLine(answer, cases)}`)],
|
|
29264
29373
|
suggested: change.checks ?? [],
|
|
29265
|
-
extra:
|
|
29374
|
+
extra: proven.length === 0 ? undefined : proven,
|
|
29266
29375
|
reviewed: input.reviewed,
|
|
29267
29376
|
earlier: input.earlier,
|
|
29268
29377
|
deliveredBy: input.changeRequestId,
|
|
@@ -40096,4 +40205,4 @@ var runKit = (config, identity, packages) => {
|
|
|
40096
40205
|
runMain2(program.pipe(flatMap3((code) => sync2(() => process.exit(code)))));
|
|
40097
40206
|
};
|
|
40098
40207
|
// .kitman-build-entry.ts
|
|
40099
|
-
runKit(kitman_config_default, { name: "@kitman-sh/software-engineering", version: "0.50.
|
|
40208
|
+
runKit(kitman_config_default, { name: "@kitman-sh/software-engineering", version: "0.50.1" }, []);
|