@afaik-lab/weigh 0.0.0-stage → 0.6.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/.env.example +49 -0
- package/LICENSE +373 -0
- package/README.md +102 -2
- package/dist/agent.d.ts +83 -0
- package/dist/agent.d.ts.map +1 -0
- package/dist/agent.js +204 -0
- package/dist/agent.js.map +1 -0
- package/dist/ceilings.d.ts +32 -0
- package/dist/ceilings.d.ts.map +1 -0
- package/dist/ceilings.js +61 -0
- package/dist/ceilings.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +530 -0
- package/dist/cli.js.map +1 -0
- package/dist/config-cli.d.ts +15 -0
- package/dist/config-cli.d.ts.map +1 -0
- package/dist/config-cli.js +132 -0
- package/dist/config-cli.js.map +1 -0
- package/dist/config.d.ts +198 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +373 -0
- package/dist/config.js.map +1 -0
- package/dist/context-cli.d.ts +35 -0
- package/dist/context-cli.d.ts.map +1 -0
- package/dist/context-cli.js +251 -0
- package/dist/context-cli.js.map +1 -0
- package/dist/context.d.ts +118 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +159 -0
- package/dist/context.js.map +1 -0
- package/dist/corrections/correction-set.d.ts +67 -0
- package/dist/corrections/correction-set.d.ts.map +1 -0
- package/dist/corrections/correction-set.js +104 -0
- package/dist/corrections/correction-set.js.map +1 -0
- package/dist/corrections/correction.d.ts +74 -0
- package/dist/corrections/correction.d.ts.map +1 -0
- package/dist/corrections/correction.js +154 -0
- package/dist/corrections/correction.js.map +1 -0
- package/dist/corrections/follow-up.d.ts +69 -0
- package/dist/corrections/follow-up.d.ts.map +1 -0
- package/dist/corrections/follow-up.js +217 -0
- package/dist/corrections/follow-up.js.map +1 -0
- package/dist/corrections/index.d.ts +31 -0
- package/dist/corrections/index.d.ts.map +1 -0
- package/dist/corrections/index.js +31 -0
- package/dist/corrections/index.js.map +1 -0
- package/dist/corrections/ledger.d.ts +78 -0
- package/dist/corrections/ledger.d.ts.map +1 -0
- package/dist/corrections/ledger.js +117 -0
- package/dist/corrections/ledger.js.map +1 -0
- package/dist/corrections/promotion.d.ts +119 -0
- package/dist/corrections/promotion.d.ts.map +1 -0
- package/dist/corrections/promotion.js +221 -0
- package/dist/corrections/promotion.js.map +1 -0
- package/dist/corrections/schema.d.ts +125 -0
- package/dist/corrections/schema.d.ts.map +1 -0
- package/dist/corrections/schema.js +100 -0
- package/dist/corrections/schema.js.map +1 -0
- package/dist/corrections-cli.d.ts +28 -0
- package/dist/corrections-cli.d.ts.map +1 -0
- package/dist/corrections-cli.js +157 -0
- package/dist/corrections-cli.js.map +1 -0
- package/dist/diff.d.ts +105 -0
- package/dist/diff.d.ts.map +1 -0
- package/dist/diff.js +202 -0
- package/dist/diff.js.map +1 -0
- package/dist/doctor.d.ts +38 -0
- package/dist/doctor.d.ts.map +1 -0
- package/dist/doctor.js +197 -0
- package/dist/doctor.js.map +1 -0
- package/dist/events.d.ts +21 -0
- package/dist/events.d.ts.map +1 -0
- package/dist/events.js +5 -0
- package/dist/events.js.map +1 -0
- package/dist/findings.d.ts +510 -0
- package/dist/findings.d.ts.map +1 -0
- package/dist/findings.js +645 -0
- package/dist/findings.js.map +1 -0
- package/dist/follow-up-cli.d.ts +88 -0
- package/dist/follow-up-cli.d.ts.map +1 -0
- package/dist/follow-up-cli.js +208 -0
- package/dist/follow-up-cli.js.map +1 -0
- package/dist/harness.d.ts +64 -0
- package/dist/harness.d.ts.map +1 -0
- package/dist/harness.js +71 -0
- package/dist/harness.js.map +1 -0
- package/dist/help/command-help.d.ts +9 -0
- package/dist/help/command-help.d.ts.map +1 -0
- package/dist/help/command-help.js +21 -0
- package/dist/help/command-help.js.map +1 -0
- package/dist/help/commands/answer.d.ts +3 -0
- package/dist/help/commands/answer.d.ts.map +1 -0
- package/dist/help/commands/answer.js +39 -0
- package/dist/help/commands/answer.js.map +1 -0
- package/dist/help/commands/config.d.ts +3 -0
- package/dist/help/commands/config.d.ts.map +1 -0
- package/dist/help/commands/config.js +25 -0
- package/dist/help/commands/config.js.map +1 -0
- package/dist/help/commands/context.d.ts +3 -0
- package/dist/help/commands/context.d.ts.map +1 -0
- package/dist/help/commands/context.js +44 -0
- package/dist/help/commands/context.js.map +1 -0
- package/dist/help/commands/corrections.d.ts +3 -0
- package/dist/help/commands/corrections.d.ts.map +1 -0
- package/dist/help/commands/corrections.js +30 -0
- package/dist/help/commands/corrections.js.map +1 -0
- package/dist/help/commands/doctor.d.ts +3 -0
- package/dist/help/commands/doctor.d.ts.map +1 -0
- package/dist/help/commands/doctor.js +12 -0
- package/dist/help/commands/doctor.js.map +1 -0
- package/dist/help/commands/index.d.ts +4 -0
- package/dist/help/commands/index.d.ts.map +1 -0
- package/dist/help/commands/index.js +27 -0
- package/dist/help/commands/index.js.map +1 -0
- package/dist/help/commands/memory.d.ts +3 -0
- package/dist/help/commands/memory.d.ts.map +1 -0
- package/dist/help/commands/memory.js +33 -0
- package/dist/help/commands/memory.js.map +1 -0
- package/dist/help/commands/models.d.ts +3 -0
- package/dist/help/commands/models.d.ts.map +1 -0
- package/dist/help/commands/models.js +17 -0
- package/dist/help/commands/models.js.map +1 -0
- package/dist/help/commands/options.d.ts +4 -0
- package/dist/help/commands/options.d.ts.map +1 -0
- package/dist/help/commands/options.js +13 -0
- package/dist/help/commands/options.js.map +1 -0
- package/dist/help/commands/review.d.ts +3 -0
- package/dist/help/commands/review.d.ts.map +1 -0
- package/dist/help/commands/review.js +50 -0
- package/dist/help/commands/review.js.map +1 -0
- package/dist/help/commands/sessions.d.ts +3 -0
- package/dist/help/commands/sessions.d.ts.map +1 -0
- package/dist/help/commands/sessions.js +23 -0
- package/dist/help/commands/sessions.js.map +1 -0
- package/dist/help/commands/show.d.ts +3 -0
- package/dist/help/commands/show.d.ts.map +1 -0
- package/dist/help/commands/show.js +18 -0
- package/dist/help/commands/show.js.map +1 -0
- package/dist/help/help.d.ts +16 -0
- package/dist/help/help.d.ts.map +1 -0
- package/dist/help/help.js +68 -0
- package/dist/help/help.js.map +1 -0
- package/dist/help/index.d.ts +4 -0
- package/dist/help/index.d.ts.map +1 -0
- package/dist/help/index.js +7 -0
- package/dist/help/index.js.map +1 -0
- package/dist/index.d.ts +80 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +51 -0
- package/dist/index.js.map +1 -0
- package/dist/knowledge/block.d.ts +65 -0
- package/dist/knowledge/block.d.ts.map +1 -0
- package/dist/knowledge/block.js +89 -0
- package/dist/knowledge/block.js.map +1 -0
- package/dist/knowledge/claim.d.ts +143 -0
- package/dist/knowledge/claim.d.ts.map +1 -0
- package/dist/knowledge/claim.js +297 -0
- package/dist/knowledge/claim.js.map +1 -0
- package/dist/knowledge/index.d.ts +32 -0
- package/dist/knowledge/index.d.ts.map +1 -0
- package/dist/knowledge/index.js +29 -0
- package/dist/knowledge/index.js.map +1 -0
- package/dist/knowledge/novelty.d.ts +65 -0
- package/dist/knowledge/novelty.d.ts.map +1 -0
- package/dist/knowledge/novelty.js +94 -0
- package/dist/knowledge/novelty.js.map +1 -0
- package/dist/knowledge/recall.d.ts +134 -0
- package/dist/knowledge/recall.d.ts.map +1 -0
- package/dist/knowledge/recall.js +229 -0
- package/dist/knowledge/recall.js.map +1 -0
- package/dist/knowledge/recalled-claim.d.ts +35 -0
- package/dist/knowledge/recalled-claim.d.ts.map +1 -0
- package/dist/knowledge/recalled-claim.js +67 -0
- package/dist/knowledge/recalled-claim.js.map +1 -0
- package/dist/knowledge/recalled.d.ts +70 -0
- package/dist/knowledge/recalled.d.ts.map +1 -0
- package/dist/knowledge/recalled.js +149 -0
- package/dist/knowledge/recalled.js.map +1 -0
- package/dist/knowledge/schema.d.ts +83 -0
- package/dist/knowledge/schema.d.ts.map +1 -0
- package/dist/knowledge/schema.js +96 -0
- package/dist/knowledge/schema.js.map +1 -0
- package/dist/knowledge/staleness.d.ts +48 -0
- package/dist/knowledge/staleness.d.ts.map +1 -0
- package/dist/knowledge/staleness.js +85 -0
- package/dist/knowledge/staleness.js.map +1 -0
- package/dist/knowledge/store.d.ts +100 -0
- package/dist/knowledge/store.d.ts.map +1 -0
- package/dist/knowledge/store.js +184 -0
- package/dist/knowledge/store.js.map +1 -0
- package/dist/memory/compose-file.d.ts +14 -0
- package/dist/memory/compose-file.d.ts.map +1 -0
- package/dist/memory/compose-file.js +25 -0
- package/dist/memory/compose-file.js.map +1 -0
- package/dist/memory/index.d.ts +43 -0
- package/dist/memory/index.d.ts.map +1 -0
- package/dist/memory/index.js +119 -0
- package/dist/memory/index.js.map +1 -0
- package/dist/memory/oss.d.ts +62 -0
- package/dist/memory/oss.d.ts.map +1 -0
- package/dist/memory/oss.js +230 -0
- package/dist/memory/oss.js.map +1 -0
- package/dist/memory/platform.d.ts +37 -0
- package/dist/memory/platform.d.ts.map +1 -0
- package/dist/memory/platform.js +131 -0
- package/dist/memory/platform.js.map +1 -0
- package/dist/memory/scope.d.ts +49 -0
- package/dist/memory/scope.d.ts.map +1 -0
- package/dist/memory/scope.js +70 -0
- package/dist/memory/scope.js.map +1 -0
- package/dist/memory/types.d.ts +113 -0
- package/dist/memory/types.d.ts.map +1 -0
- package/dist/memory/types.js +18 -0
- package/dist/memory/types.js.map +1 -0
- package/dist/memory-cli.d.ts +17 -0
- package/dist/memory-cli.d.ts.map +1 -0
- package/dist/memory-cli.js +107 -0
- package/dist/memory-cli.js.map +1 -0
- package/dist/models-cli.d.ts +12 -0
- package/dist/models-cli.d.ts.map +1 -0
- package/dist/models-cli.js +54 -0
- package/dist/models-cli.js.map +1 -0
- package/dist/models.d.ts +111 -0
- package/dist/models.d.ts.map +1 -0
- package/dist/models.js +227 -0
- package/dist/models.js.map +1 -0
- package/dist/paths.d.ts +35 -0
- package/dist/paths.d.ts.map +1 -0
- package/dist/paths.js +65 -0
- package/dist/paths.js.map +1 -0
- package/dist/profile.d.ts +28 -0
- package/dist/profile.d.ts.map +1 -0
- package/dist/profile.js +154 -0
- package/dist/profile.js.map +1 -0
- package/dist/progress.d.ts +70 -0
- package/dist/progress.d.ts.map +1 -0
- package/dist/progress.js +132 -0
- package/dist/progress.js.map +1 -0
- package/dist/quiet.d.ts +2 -0
- package/dist/quiet.d.ts.map +1 -0
- package/dist/quiet.js +21 -0
- package/dist/quiet.js.map +1 -0
- package/dist/reconcile/continuation.d.ts +132 -0
- package/dist/reconcile/continuation.d.ts.map +1 -0
- package/dist/reconcile/continuation.js +306 -0
- package/dist/reconcile/continuation.js.map +1 -0
- package/dist/reconcile/index.d.ts +26 -0
- package/dist/reconcile/index.d.ts.map +1 -0
- package/dist/reconcile/index.js +28 -0
- package/dist/reconcile/index.js.map +1 -0
- package/dist/reconcile/outcome-set.d.ts +53 -0
- package/dist/reconcile/outcome-set.d.ts.map +1 -0
- package/dist/reconcile/outcome-set.js +124 -0
- package/dist/reconcile/outcome-set.js.map +1 -0
- package/dist/reconcile/outcome.d.ts +56 -0
- package/dist/reconcile/outcome.d.ts.map +1 -0
- package/dist/reconcile/outcome.js +60 -0
- package/dist/reconcile/outcome.js.map +1 -0
- package/dist/reconcile/reconciliation.d.ts +49 -0
- package/dist/reconcile/reconciliation.d.ts.map +1 -0
- package/dist/reconcile/reconciliation.js +88 -0
- package/dist/reconcile/reconciliation.js.map +1 -0
- package/dist/reconcile/schema.d.ts +157 -0
- package/dist/reconcile/schema.d.ts.map +1 -0
- package/dist/reconcile/schema.js +97 -0
- package/dist/reconcile/schema.js.map +1 -0
- package/dist/record/index.d.ts +23 -0
- package/dist/record/index.d.ts.map +1 -0
- package/dist/record/index.js +25 -0
- package/dist/record/index.js.map +1 -0
- package/dist/record/review-record.d.ts +28 -0
- package/dist/record/review-record.d.ts.map +1 -0
- package/dist/record/review-record.js +78 -0
- package/dist/record/review-record.js.map +1 -0
- package/dist/record/schema.d.ts +153 -0
- package/dist/record/schema.d.ts.map +1 -0
- package/dist/record/schema.js +87 -0
- package/dist/record/schema.js.map +1 -0
- package/dist/record/store.d.ts +83 -0
- package/dist/record/store.d.ts.map +1 -0
- package/dist/record/store.js +162 -0
- package/dist/record/store.js.map +1 -0
- package/dist/record/stored-review.d.ts +36 -0
- package/dist/record/stored-review.d.ts.map +1 -0
- package/dist/record/stored-review.js +90 -0
- package/dist/record/stored-review.js.map +1 -0
- package/dist/refute.d.ts +318 -0
- package/dist/refute.d.ts.map +1 -0
- package/dist/refute.js +513 -0
- package/dist/refute.js.map +1 -0
- package/dist/render.d.ts +212 -0
- package/dist/render.d.ts.map +1 -0
- package/dist/render.js +544 -0
- package/dist/render.js.map +1 -0
- package/dist/review-cli.d.ts +181 -0
- package/dist/review-cli.d.ts.map +1 -0
- package/dist/review-cli.js +598 -0
- package/dist/review-cli.js.map +1 -0
- package/dist/reviewer.d.ts +297 -0
- package/dist/reviewer.d.ts.map +1 -0
- package/dist/reviewer.js +580 -0
- package/dist/reviewer.js.map +1 -0
- package/dist/session-cli.d.ts +17 -0
- package/dist/session-cli.d.ts.map +1 -0
- package/dist/session-cli.js +62 -0
- package/dist/session-cli.js.map +1 -0
- package/dist/session.d.ts +36 -0
- package/dist/session.d.ts.map +1 -0
- package/dist/session.js +105 -0
- package/dist/session.js.map +1 -0
- package/dist/settings.d.ts +68 -0
- package/dist/settings.d.ts.map +1 -0
- package/dist/settings.js +175 -0
- package/dist/settings.js.map +1 -0
- package/dist/show-cli.d.ts +39 -0
- package/dist/show-cli.d.ts.map +1 -0
- package/dist/show-cli.js +56 -0
- package/dist/show-cli.js.map +1 -0
- package/dist/stdout.d.ts +28 -0
- package/dist/stdout.d.ts.map +1 -0
- package/dist/stdout.js +44 -0
- package/dist/stdout.js.map +1 -0
- package/dist/target.d.ts +58 -0
- package/dist/target.d.ts.map +1 -0
- package/dist/target.js +96 -0
- package/dist/target.js.map +1 -0
- package/dist/tools/index.d.ts +93 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +146 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/root.d.ts +62 -0
- package/dist/tools/root.d.ts.map +1 -0
- package/dist/tools/root.js +51 -0
- package/dist/tools/root.js.map +1 -0
- package/dist/usage.d.ts +75 -0
- package/dist/usage.d.ts.map +1 -0
- package/dist/usage.js +100 -0
- package/dist/usage.js.map +1 -0
- package/dist/version.d.ts +14 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +26 -0
- package/dist/version.js.map +1 -0
- package/dist/workspace.d.ts +48 -0
- package/dist/workspace.d.ts.map +1 -0
- package/dist/workspace.js +126 -0
- package/dist/workspace.js.map +1 -0
- package/docker-compose.yml +61 -0
- package/package.json +70 -4
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import type { AgentConfig } from './config.js';
|
|
2
|
+
export interface FollowUpOptions {
|
|
3
|
+
/** The message. `"#3 is intentional, we validate at the edge"`. */
|
|
4
|
+
message: string;
|
|
5
|
+
repo?: string;
|
|
6
|
+
/** The review the numbers belong to. Default: the last one of this branch. */
|
|
7
|
+
review?: string;
|
|
8
|
+
json: boolean;
|
|
9
|
+
quiet?: boolean;
|
|
10
|
+
/** Record the ruling without teaching anything from it. */
|
|
11
|
+
noPromote?: boolean;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* `weigh answer "#3 is intentional"` — a human ruling, recorded.
|
|
15
|
+
*
|
|
16
|
+
* No re-review, and no model call. The message is about findings a review
|
|
17
|
+
* already printed, so the work is resolving `#3` to the finding that was
|
|
18
|
+
* numbered 3 and writing down what was said about it. Running a review to
|
|
19
|
+
* accept an answer about the last one would cost minutes and dollars to learn
|
|
20
|
+
* nothing new, and would renumber the findings underneath the person typing.
|
|
21
|
+
*
|
|
22
|
+
* Everything is validated before anything is written. A message ruling on three
|
|
23
|
+
* findings where one label is misspelled records none of them: a half-recorded
|
|
24
|
+
* answer is one the person has to read the ledger to understand.
|
|
25
|
+
*/
|
|
26
|
+
export declare class FollowUpCommand {
|
|
27
|
+
private readonly _options;
|
|
28
|
+
/**
|
|
29
|
+
* The configuration the flags were already applied to.
|
|
30
|
+
*
|
|
31
|
+
* Passed in rather than loaded here, as the memory and context commands
|
|
32
|
+
* take theirs. Loading a second copy ignored every flag that belongs to
|
|
33
|
+
* the store — `--no-memory`, `--memory-backend`, and `-u`, which decides
|
|
34
|
+
* whose name goes on the ruling.
|
|
35
|
+
*/
|
|
36
|
+
private readonly _config;
|
|
37
|
+
constructor(_options: FollowUpOptions,
|
|
38
|
+
/**
|
|
39
|
+
* The configuration the flags were already applied to.
|
|
40
|
+
*
|
|
41
|
+
* Passed in rather than loaded here, as the memory and context commands
|
|
42
|
+
* take theirs. Loading a second copy ignored every flag that belongs to
|
|
43
|
+
* the store — `--no-memory`, `--memory-backend`, and `-u`, which decides
|
|
44
|
+
* whose name goes on the ruling.
|
|
45
|
+
*/
|
|
46
|
+
_config: AgentConfig);
|
|
47
|
+
run(): Promise<number>;
|
|
48
|
+
/**
|
|
49
|
+
* What these rulings teach, written where the next review will read it.
|
|
50
|
+
*
|
|
51
|
+
* The ruling already works without this: the ledger is read on every review,
|
|
52
|
+
* which stops the finding being reported. What a claim adds is that the
|
|
53
|
+
* finding stops being produced — and the two are not the same, because a
|
|
54
|
+
* filter runs forever while a promotion compounds.
|
|
55
|
+
*
|
|
56
|
+
* The review's own head commit travels with the claim, so a later reader can
|
|
57
|
+
* tell how old the code behind the sentence is. `--no-promote` records the
|
|
58
|
+
* ruling and teaches nothing, for a reason that is true of this one branch
|
|
59
|
+
* and that nobody should be told about in every later review.
|
|
60
|
+
*/
|
|
61
|
+
private _promote;
|
|
62
|
+
private _warn;
|
|
63
|
+
/** The review the numbers in the message belong to. See `ReviewStore.pick`. */
|
|
64
|
+
private _review;
|
|
65
|
+
/** `#3`, or a fingerprint, as a finding of that review. */
|
|
66
|
+
private _resolve;
|
|
67
|
+
/**
|
|
68
|
+
* Cite or die.
|
|
69
|
+
*
|
|
70
|
+
* A correction is the one input that can silence a real finding, so the two
|
|
71
|
+
* labels that can do it carry what the finding carried. `incorrect` says the
|
|
72
|
+
* review misread the code, which is answerable only by pointing at what the
|
|
73
|
+
* code says; `intentional` is a claim about the repository, so it needs the
|
|
74
|
+
* claim in words — its evidence is the code the person is calling deliberate,
|
|
75
|
+
* which the finding already names. The three that concede the finding is real
|
|
76
|
+
* justify nothing, because they take nothing away from a later review.
|
|
77
|
+
*
|
|
78
|
+
* Returns the citations that name a file in the tree. The parser catches any
|
|
79
|
+
* word with a slash in it, so "client/server" arrives here too: under
|
|
80
|
+
* `incorrect` a missing file is refused, because the citation is the
|
|
81
|
+
* evidence; under any other label it is dropped as prose that looked like a
|
|
82
|
+
* path, so it neither refuses the ruling nor becomes a glob a promoted claim
|
|
83
|
+
* applies to.
|
|
84
|
+
*/
|
|
85
|
+
private _check;
|
|
86
|
+
}
|
|
87
|
+
export declare function runFollowUpCommand(options: FollowUpOptions, config: AgentConfig): Promise<number>;
|
|
88
|
+
//# sourceMappingURL=follow-up-cli.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"follow-up-cli.d.ts","sourceRoot":"","sources":["../src/follow-up-cli.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAS/C,MAAM,WAAW,eAAe;IAC9B,mEAAmE;IACnE,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,8EAA8E;IAC9E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,2DAA2D;IAC3D,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAQD;;;;;;;;;;;;GAYG;AACH,qBAAa,eAAe;IAExB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB;;;;;;;OAOG;IACH,OAAO,CAAC,QAAQ,CAAC,OAAO;IAV1B,YACmB,QAAQ,EAAE,eAAe;IAC1C;;;;;;;OAOG;IACc,OAAO,EAAE,WAAW,EACnC;IAEE,GAAG,IAAI,OAAO,CAAC,MAAM,CAAC,CA4D3B;IAED;;;;;;;;;;;;OAYG;YACW,QAAQ;IA0BtB,OAAO,CAAC,KAAK;IAIb,+EAA+E;IAC/E,OAAO,CAAC,OAAO;IAIf,2DAA2D;IAC3D,OAAO,CAAC,QAAQ;IAkBhB;;;;;;;;;;;;;;;;;OAiBG;IACH,OAAO,CAAC,MAAM;CAuCf;AAED,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,CAEvG"}
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
// This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
|
+
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
|
+
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
4
|
+
import { existsSync } from 'fs';
|
|
5
|
+
import { resolve, sep } from 'path';
|
|
6
|
+
import { Correction, Corrections, FollowUp, LABEL_RULES, Promotion } from './corrections/index.js';
|
|
7
|
+
import { Knowledge } from './knowledge/index.js';
|
|
8
|
+
import { createMemoryStore } from './memory/index.js';
|
|
9
|
+
import { ReviewStore } from './record/index.js';
|
|
10
|
+
import { writeOut } from './stdout.js';
|
|
11
|
+
import { resolveTarget } from './target.js';
|
|
12
|
+
/**
|
|
13
|
+
* `weigh answer "#3 is intentional"` — a human ruling, recorded.
|
|
14
|
+
*
|
|
15
|
+
* No re-review, and no model call. The message is about findings a review
|
|
16
|
+
* already printed, so the work is resolving `#3` to the finding that was
|
|
17
|
+
* numbered 3 and writing down what was said about it. Running a review to
|
|
18
|
+
* accept an answer about the last one would cost minutes and dollars to learn
|
|
19
|
+
* nothing new, and would renumber the findings underneath the person typing.
|
|
20
|
+
*
|
|
21
|
+
* Everything is validated before anything is written. A message ruling on three
|
|
22
|
+
* findings where one label is misspelled records none of them: a half-recorded
|
|
23
|
+
* answer is one the person has to read the ledger to understand.
|
|
24
|
+
*/
|
|
25
|
+
export class FollowUpCommand {
|
|
26
|
+
_options;
|
|
27
|
+
_config;
|
|
28
|
+
constructor(_options,
|
|
29
|
+
/**
|
|
30
|
+
* The configuration the flags were already applied to.
|
|
31
|
+
*
|
|
32
|
+
* Passed in rather than loaded here, as the memory and context commands
|
|
33
|
+
* take theirs. Loading a second copy ignored every flag that belongs to
|
|
34
|
+
* the store — `--no-memory`, `--memory-backend`, and `-u`, which decides
|
|
35
|
+
* whose name goes on the ruling.
|
|
36
|
+
*/
|
|
37
|
+
_config) {
|
|
38
|
+
this._options = _options;
|
|
39
|
+
this._config = _config;
|
|
40
|
+
}
|
|
41
|
+
async run() {
|
|
42
|
+
const target = resolveTarget({ ...(this._options.repo && { repo: this._options.repo }) });
|
|
43
|
+
const review = this._review(target.root, target.branch);
|
|
44
|
+
const resolved = FollowUp.parse(this._options.message).attributions.map((attribution) => this._resolve(attribution, review));
|
|
45
|
+
const by = this._config.memory.userId;
|
|
46
|
+
const corrections = resolved.map(({ attribution, finding }) => {
|
|
47
|
+
const citations = this._check(attribution, finding, target.root);
|
|
48
|
+
return Correction.of({
|
|
49
|
+
label: attribution.label,
|
|
50
|
+
finding,
|
|
51
|
+
...(attribution.reason && { reason: attribution.reason }),
|
|
52
|
+
citations,
|
|
53
|
+
review: review.id,
|
|
54
|
+
target: target.root,
|
|
55
|
+
branch: target.branch,
|
|
56
|
+
by,
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
const ledger = new Corrections();
|
|
60
|
+
// Written after the last one has been checked, so a refusal leaves the
|
|
61
|
+
// ledger exactly as it was.
|
|
62
|
+
for (const correction of corrections)
|
|
63
|
+
ledger.record(correction);
|
|
64
|
+
const path = ledger.fileFor(target.root);
|
|
65
|
+
// After the ledger, and unable to affect it. The file is the record; a
|
|
66
|
+
// claim is what the next review is told, and a store that is down must not
|
|
67
|
+
// cost someone the ruling they just typed.
|
|
68
|
+
const promoted = await this._promote(corrections, target.root, review);
|
|
69
|
+
if (this._options.quiet)
|
|
70
|
+
return 0;
|
|
71
|
+
if (this._options.json) {
|
|
72
|
+
await writeOut(JSON.stringify({
|
|
73
|
+
type: 'corrections',
|
|
74
|
+
review: review.id,
|
|
75
|
+
path,
|
|
76
|
+
recorded: corrections.map((one) => one.toJSON()),
|
|
77
|
+
promoted: promoted.map((claim) => ({ kind: claim.kind, statement: claim.statement, evidence: claim.evidence })),
|
|
78
|
+
}) + '\n');
|
|
79
|
+
return 0;
|
|
80
|
+
}
|
|
81
|
+
const count = `${corrections.length} correction${corrections.length === 1 ? '' : 's'}`;
|
|
82
|
+
await writeOut([
|
|
83
|
+
`Recorded ${count} against review ${review.id}.`,
|
|
84
|
+
'',
|
|
85
|
+
...corrections.flatMap((one) => [one.describe(), '']),
|
|
86
|
+
path,
|
|
87
|
+
...(promoted.length
|
|
88
|
+
? ['', `Promoted to what this repository is like — ${promoted.length} claim(s):`, '', ...promoted.map((claim) => ` ${claim.kind}: ${claim.statement}`), '']
|
|
89
|
+
: ['']),
|
|
90
|
+
].join('\n'));
|
|
91
|
+
return 0;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* What these rulings teach, written where the next review will read it.
|
|
95
|
+
*
|
|
96
|
+
* The ruling already works without this: the ledger is read on every review,
|
|
97
|
+
* which stops the finding being reported. What a claim adds is that the
|
|
98
|
+
* finding stops being produced — and the two are not the same, because a
|
|
99
|
+
* filter runs forever while a promotion compounds.
|
|
100
|
+
*
|
|
101
|
+
* The review's own head commit travels with the claim, so a later reader can
|
|
102
|
+
* tell how old the code behind the sentence is. `--no-promote` records the
|
|
103
|
+
* ruling and teaches nothing, for a reason that is true of this one branch
|
|
104
|
+
* and that nobody should be told about in every later review.
|
|
105
|
+
*/
|
|
106
|
+
async _promote(corrections, target, review) {
|
|
107
|
+
if (this._options.noPromote)
|
|
108
|
+
return [];
|
|
109
|
+
const knowledge = new Knowledge(createMemoryStore(this._config.memory), this._config);
|
|
110
|
+
const promotion = new Promotion(knowledge, (message) => this._warn(message));
|
|
111
|
+
// What the store has already learned is not written again — the same
|
|
112
|
+
// check `weigh corrections promote` makes. Skipped when memory is off,
|
|
113
|
+
// where `of` says so itself; a store that cannot be searched costs this
|
|
114
|
+
// answer its promotion, never the ruling, which is already in the ledger.
|
|
115
|
+
let unlearned = corrections;
|
|
116
|
+
if (promotion.enabled) {
|
|
117
|
+
try {
|
|
118
|
+
unlearned = await promotion.pending(corrections, target);
|
|
119
|
+
}
|
|
120
|
+
catch (err) {
|
|
121
|
+
this._warn(`not promoted — ${err?.message ?? err}`);
|
|
122
|
+
return [];
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
return promotion.of(unlearned, target, {
|
|
126
|
+
...(review.repo.headSha && { commit: review.repo.headSha }),
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
_warn(message) {
|
|
130
|
+
if (!this._options.quiet)
|
|
131
|
+
process.stderr.write(`Warning: ${message}\n`);
|
|
132
|
+
}
|
|
133
|
+
/** The review the numbers in the message belong to. See `ReviewStore.pick`. */
|
|
134
|
+
_review(root, branch) {
|
|
135
|
+
return new ReviewStore().pick(root, branch, this._options.review, 'with --review <id>');
|
|
136
|
+
}
|
|
137
|
+
/** `#3`, or a fingerprint, as a finding of that review. */
|
|
138
|
+
_resolve(attribution, review) {
|
|
139
|
+
const ref = attribution.ref;
|
|
140
|
+
if ('number' in ref) {
|
|
141
|
+
const finding = review.numbered(ref.number);
|
|
142
|
+
if (!finding) {
|
|
143
|
+
const total = review.findings().length;
|
|
144
|
+
throw new Error(`Review ${review.id} printed ${total} finding${total === 1 ? '' : 's'}, so there is no #${ref.number}.`);
|
|
145
|
+
}
|
|
146
|
+
return { attribution, finding };
|
|
147
|
+
}
|
|
148
|
+
const finding = review.findings().find((one) => one.id === ref.fingerprint);
|
|
149
|
+
if (!finding)
|
|
150
|
+
throw new Error(`Review ${review.id} has no finding ${ref.fingerprint}.`);
|
|
151
|
+
return { attribution, finding };
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Cite or die.
|
|
155
|
+
*
|
|
156
|
+
* A correction is the one input that can silence a real finding, so the two
|
|
157
|
+
* labels that can do it carry what the finding carried. `incorrect` says the
|
|
158
|
+
* review misread the code, which is answerable only by pointing at what the
|
|
159
|
+
* code says; `intentional` is a claim about the repository, so it needs the
|
|
160
|
+
* claim in words — its evidence is the code the person is calling deliberate,
|
|
161
|
+
* which the finding already names. The three that concede the finding is real
|
|
162
|
+
* justify nothing, because they take nothing away from a later review.
|
|
163
|
+
*
|
|
164
|
+
* Returns the citations that name a file in the tree. The parser catches any
|
|
165
|
+
* word with a slash in it, so "client/server" arrives here too: under
|
|
166
|
+
* `incorrect` a missing file is refused, because the citation is the
|
|
167
|
+
* evidence; under any other label it is dropped as prose that looked like a
|
|
168
|
+
* path, so it neither refuses the ruling nor becomes a glob a promoted claim
|
|
169
|
+
* applies to.
|
|
170
|
+
*/
|
|
171
|
+
_check(attribution, finding, root) {
|
|
172
|
+
const rule = LABEL_RULES[attribution.label];
|
|
173
|
+
const about = `${finding.path}:${finding.line}`;
|
|
174
|
+
if (rule.needs !== 'nothing' && !attribution.reason) {
|
|
175
|
+
throw new Error(`"${attribution.label}" needs ${rule.needs} — it is a ruling a refute pass may kill a finding on.\n` +
|
|
176
|
+
` weigh answer "#1 is ${attribution.label}, <why>"`);
|
|
177
|
+
}
|
|
178
|
+
if (rule.needs === 'a reason and a citation' && attribution.citations.length === 0) {
|
|
179
|
+
throw new Error(`"${attribution.label}" says the review misread ${about}, so it needs the code that says otherwise.\n` +
|
|
180
|
+
` weigh answer "#1 is incorrect, the guard is at ${finding.path}:${finding.line}"`);
|
|
181
|
+
}
|
|
182
|
+
const cited = [];
|
|
183
|
+
for (const citation of attribution.citations) {
|
|
184
|
+
// The line part comes off: a citation points at a file, and refusing a
|
|
185
|
+
// ruling because its line number is a few lines out would be pedantry
|
|
186
|
+
// about the part that is allowed to move.
|
|
187
|
+
const path = citation.replace(/:\d+(?:-\d+)?$/, '');
|
|
188
|
+
const full = resolve(root, path);
|
|
189
|
+
// Strict for every token, whatever the label: nothing recorded may point
|
|
190
|
+
// outside the repository.
|
|
191
|
+
if (!full.startsWith(root + sep)) {
|
|
192
|
+
throw new Error(`${citation} is outside the repository. Cite a path inside it.`);
|
|
193
|
+
}
|
|
194
|
+
if (!existsSync(full)) {
|
|
195
|
+
if (rule.needs === 'a reason and a citation') {
|
|
196
|
+
throw new Error(`${citation} is not in this repository, so it cannot be what the code says.`);
|
|
197
|
+
}
|
|
198
|
+
continue;
|
|
199
|
+
}
|
|
200
|
+
cited.push(citation);
|
|
201
|
+
}
|
|
202
|
+
return cited;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
export async function runFollowUpCommand(options, config) {
|
|
206
|
+
return new FollowUpCommand(options, config).run();
|
|
207
|
+
}
|
|
208
|
+
//# sourceMappingURL=follow-up-cli.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"follow-up-cli.js","sourceRoot":"","sources":["../src/follow-up-cli.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,sEAAsE;AACtE,4DAA4D;AAE5D,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAChC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAEpC,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,WAAW,EAAE,SAAS,EAAoB,MAAM,wBAAwB,CAAC;AAErH,OAAO,EAAE,SAAS,EAAc,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAqB,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAoB5C;;;;;;;;;;;;GAYG;AACH,MAAM,OAAO,eAAe;IAE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,CAAC;YAC7C,uEAAuE;YACvE,sEAAsE;YACtE,0CAA0C;YAC1C,MAAM,IAAI,GAAG,QAAQ,CAAC,OAAO,CAAC,gBAAgB,EAAE,EAAE,CAAC,CAAC;YACpD,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;YACjC,yEAAyE;YACzE,0BAA0B;YAC1B,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,GAAG,GAAG,CAAC,EAAE,CAAC;gBACjC,MAAM,IAAI,KAAK,CAAC,GAAG,QAAQ,oDAAoD,CAAC,CAAC;YACnF,CAAC;YACD,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;gBACtB,IAAI,IAAI,CAAC,KAAK,KAAK,yBAAyB,EAAE,CAAC;oBAC7C,MAAM,IAAI,KAAK,CAAC,GAAG,QAAQ,iEAAiE,CAAC,CAAC;gBAChG,CAAC;gBACD,SAAS;YACX,CAAC;YACD,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACvB,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AAED,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,OAAwB,EAAE,MAAmB;IACpF,OAAO,IAAI,eAAe,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC;AACpD,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { HookCallback, Options } from '@anthropic-ai/claude-agent-sdk';
|
|
2
|
+
/**
|
|
3
|
+
* The tool `outputFormat` submits through. Not a tool Weigh declares, and not
|
|
4
|
+
* named in either list — it is how the SDK returns a schema-constrained
|
|
5
|
+
* answer, so it must never be denied wholesale.
|
|
6
|
+
*/
|
|
7
|
+
export declare const REPORT_TOOL = "StructuredOutput";
|
|
8
|
+
import type { Effort } from './config.js';
|
|
9
|
+
import type { ToolHooks } from './tools/root.js';
|
|
10
|
+
export interface HarnessRequest {
|
|
11
|
+
/** The repository under review. Every tool is rooted here. */
|
|
12
|
+
root: string;
|
|
13
|
+
/** Standing instructions. Never the `claude_code` preset — see below. */
|
|
14
|
+
instructions: string;
|
|
15
|
+
model: string;
|
|
16
|
+
/** How deeply the model reasons before answering. */
|
|
17
|
+
effort: Effort;
|
|
18
|
+
maxSteps: number;
|
|
19
|
+
maxCost: number;
|
|
20
|
+
/** Confinement, coverage and progress. */
|
|
21
|
+
hooks?: ToolHooks;
|
|
22
|
+
/**
|
|
23
|
+
* Fires when the run is about to finish, and may send it back. The reviewer
|
|
24
|
+
* uses it for the coverage floor; the chat path passes nothing.
|
|
25
|
+
*/
|
|
26
|
+
onStop?: HookCallback;
|
|
27
|
+
/**
|
|
28
|
+
* Fires before the review is submitted, and may refuse it. Separate from
|
|
29
|
+
* `onStop` because submitting ends the turn — see CoverageGate.report.
|
|
30
|
+
*/
|
|
31
|
+
onReport?: HookCallback;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* The options every Weigh run is made of.
|
|
35
|
+
*
|
|
36
|
+
* One builder rather than two call sites, because the interesting part is not
|
|
37
|
+
* the model or the ceilings — it is the isolation, and isolation that is
|
|
38
|
+
* assembled twice is isolation that is eventually assembled once.
|
|
39
|
+
*
|
|
40
|
+
* ## The repository under review configures nothing
|
|
41
|
+
*
|
|
42
|
+
* This is the rule `config.ts` is built around, and the Agent SDK is the first
|
|
43
|
+
* runtime that can break it by default. `cwd` here is someone else's branch,
|
|
44
|
+
* and with default options the SDK loads that directory's `.claude/settings.json`,
|
|
45
|
+
* its CLAUDE.md, and its hooks — which are shell commands. Measured: a
|
|
46
|
+
* `SessionStart` hook in a reviewed repository executes on the machine running
|
|
47
|
+
* the review before the model is ever called.
|
|
48
|
+
*
|
|
49
|
+
* Two settings close it, and both have to stay:
|
|
50
|
+
*
|
|
51
|
+
* - `settingSources: []` loads no settings file from anywhere, so neither the
|
|
52
|
+
* reviewed repository nor the user's own `~/.claude` can reconfigure a
|
|
53
|
+
* review. Weigh already has three config layers; it does not need a fourth
|
|
54
|
+
* that arrives with the code under review.
|
|
55
|
+
* - a `custom` system prompt rather than `{ type: 'preset', preset:
|
|
56
|
+
* 'claude_code' }`, because the preset pulls in CLAUDE.md — which, again, is
|
|
57
|
+
* a file the branch under review can write.
|
|
58
|
+
*
|
|
59
|
+
* `test/agent.test.ts` asserts both, and asserts that the tool lists below
|
|
60
|
+
* reach the options at all. None of it is a default, so none of it is safe
|
|
61
|
+
* from a later edit that looks harmless.
|
|
62
|
+
*/
|
|
63
|
+
export declare function harnessOptions(request: HarnessRequest): Options;
|
|
64
|
+
//# sourceMappingURL=harness.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"harness.d.ts","sourceRoot":"","sources":["../src/harness.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,gCAAgC,CAAC;AAE5E;;;;GAIG;AACH,eAAO,MAAM,WAAW,qBAAqB,CAAC;AAC9C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEjD,MAAM,WAAW,cAAc;IAC7B,8DAA8D;IAC9D,IAAI,EAAE,MAAM,CAAC;IACb,yEAAyE;IACzE,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,qDAAqD;IACrD,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,0CAA0C;IAC1C,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;;OAGG;IACH,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB;;;OAGG;IACH,QAAQ,CAAC,EAAE,YAAY,CAAC;CACzB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAkC/D"}
|
package/dist/harness.js
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
// This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
|
+
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
|
+
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
4
|
+
/**
|
|
5
|
+
* The tool `outputFormat` submits through. Not a tool Weigh declares, and not
|
|
6
|
+
* named in either list — it is how the SDK returns a schema-constrained
|
|
7
|
+
* answer, so it must never be denied wholesale.
|
|
8
|
+
*/
|
|
9
|
+
export const REPORT_TOOL = 'StructuredOutput';
|
|
10
|
+
import { WITHHELD_TOOLS, READ_ONLY_TOOLS, ToolGuard } from './tools/index.js';
|
|
11
|
+
/**
|
|
12
|
+
* The options every Weigh run is made of.
|
|
13
|
+
*
|
|
14
|
+
* One builder rather than two call sites, because the interesting part is not
|
|
15
|
+
* the model or the ceilings — it is the isolation, and isolation that is
|
|
16
|
+
* assembled twice is isolation that is eventually assembled once.
|
|
17
|
+
*
|
|
18
|
+
* ## The repository under review configures nothing
|
|
19
|
+
*
|
|
20
|
+
* This is the rule `config.ts` is built around, and the Agent SDK is the first
|
|
21
|
+
* runtime that can break it by default. `cwd` here is someone else's branch,
|
|
22
|
+
* and with default options the SDK loads that directory's `.claude/settings.json`,
|
|
23
|
+
* its CLAUDE.md, and its hooks — which are shell commands. Measured: a
|
|
24
|
+
* `SessionStart` hook in a reviewed repository executes on the machine running
|
|
25
|
+
* the review before the model is ever called.
|
|
26
|
+
*
|
|
27
|
+
* Two settings close it, and both have to stay:
|
|
28
|
+
*
|
|
29
|
+
* - `settingSources: []` loads no settings file from anywhere, so neither the
|
|
30
|
+
* reviewed repository nor the user's own `~/.claude` can reconfigure a
|
|
31
|
+
* review. Weigh already has three config layers; it does not need a fourth
|
|
32
|
+
* that arrives with the code under review.
|
|
33
|
+
* - a `custom` system prompt rather than `{ type: 'preset', preset:
|
|
34
|
+
* 'claude_code' }`, because the preset pulls in CLAUDE.md — which, again, is
|
|
35
|
+
* a file the branch under review can write.
|
|
36
|
+
*
|
|
37
|
+
* `test/agent.test.ts` asserts both, and asserts that the tool lists below
|
|
38
|
+
* reach the options at all. None of it is a default, so none of it is safe
|
|
39
|
+
* from a later edit that looks harmless.
|
|
40
|
+
*/
|
|
41
|
+
export function harnessOptions(request) {
|
|
42
|
+
const guard = new ToolGuard(request.root, request.hooks ?? {});
|
|
43
|
+
return {
|
|
44
|
+
model: request.model,
|
|
45
|
+
effort: request.effort,
|
|
46
|
+
cwd: request.root,
|
|
47
|
+
settingSources: [],
|
|
48
|
+
systemPrompt: { type: 'custom', prompt: request.instructions },
|
|
49
|
+
allowedTools: [...READ_ONLY_TOOLS],
|
|
50
|
+
disallowedTools: [...WITHHELD_TOOLS],
|
|
51
|
+
// Nobody is there to answer a prompt. `dontAsk` denies what `default`
|
|
52
|
+
// would ask about, which is the difference between a headless run that
|
|
53
|
+
// stops early and one that hangs forever.
|
|
54
|
+
permissionMode: 'dontAsk',
|
|
55
|
+
hooks: {
|
|
56
|
+
PreToolUse: [
|
|
57
|
+
{ hooks: [guard.hook] },
|
|
58
|
+
// Matched by name: this one only has an opinion about the review being
|
|
59
|
+
// submitted, and running it on every read would be noise.
|
|
60
|
+
...(request.onReport ? [{ matcher: REPORT_TOOL, hooks: [request.onReport] }] : []),
|
|
61
|
+
],
|
|
62
|
+
// Coverage, counted where a read is known to have succeeded. Matched by
|
|
63
|
+
// name so the hook is not woken for every other tool as well.
|
|
64
|
+
PostToolUse: [{ matcher: 'Read', hooks: [guard.completed] }],
|
|
65
|
+
...(request.onStop && { Stop: [{ hooks: [request.onStop] }] }),
|
|
66
|
+
},
|
|
67
|
+
maxTurns: request.maxSteps,
|
|
68
|
+
maxBudgetUsd: request.maxCost,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=harness.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"harness.js","sourceRoot":"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,EAAE,CAAC;YAC5D,GAAG,CAAC,OAAO,CAAC,MAAM,IAAI,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC;SAC/D;QAED,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,YAAY,EAAE,OAAO,CAAC,OAAO;KAC9B,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** One command's line in `weigh --help`, and the whole of `weigh <command> --help`. */
|
|
2
|
+
export declare class CommandHelp {
|
|
3
|
+
readonly name: string;
|
|
4
|
+
readonly summary: string;
|
|
5
|
+
private readonly _body;
|
|
6
|
+
constructor(name: string, summary: string, _body: () => string);
|
|
7
|
+
render(): string;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=command-help.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-help.d.ts","sourceRoot":"","sources":["../../src/help/command-help.ts"],"names":[],"mappings":"AAIA,uFAAuF;AACvF,qBAAa,WAAW;IAEpB,QAAQ,CAAC,IAAI,EAAE,MAAM;IACrB,QAAQ,CAAC,OAAO,EAAE,MAAM;IAGxB,OAAO,CAAC,QAAQ,CAAC,KAAK;IALxB,YACW,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EAGP,KAAK,EAAE,MAAM,MAAM,EAClC;IAEJ,MAAM,IAAI,MAAM,CAEf;CACF"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
|
+
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
|
+
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
4
|
+
/** One command's line in `weigh --help`, and the whole of `weigh <command> --help`. */
|
|
5
|
+
export class CommandHelp {
|
|
6
|
+
name;
|
|
7
|
+
summary;
|
|
8
|
+
_body;
|
|
9
|
+
constructor(name, summary,
|
|
10
|
+
// A function, so text that reads live state (the model catalogue) is built
|
|
11
|
+
// only when that command's help is asked for.
|
|
12
|
+
_body) {
|
|
13
|
+
this.name = name;
|
|
14
|
+
this.summary = summary;
|
|
15
|
+
this._body = _body;
|
|
16
|
+
}
|
|
17
|
+
render() {
|
|
18
|
+
return this._body().trimEnd() + '\n';
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=command-help.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-help.js","sourceRoot":"","sources":["../../src/help/command-help.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,sEAAsE;AACtE,4DAA4D;AAE5D,uFAAuF;AACvF,MAAM,OAAO,WAAW;IAEX,IAAI;IACJ,OAAO;IAGC,KAAK;IALxB,YACW,IAAY,EACZ,OAAe;IACxB,2EAA2E;IAC3E,8CAA8C;IAC7B,KAAmB;oBAJ3B,IAAI;uBACJ,OAAO;qBAGC,KAAK;IACrB,CAAC;IAEJ,MAAM;QACJ,OAAO,IAAI,CAAC,KAAK,EAAE,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC;IACvC,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"answer.d.ts","sourceRoot":"","sources":["../../../src/help/commands/answer.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAGjD,eAAO,MAAM,UAAU,aAgC2C,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
|
+
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
|
+
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
4
|
+
import { CommandHelp } from '../command-help.js';
|
|
5
|
+
import { MEMORY_OPTIONS, REPO_OPTION, JSON_OPTION } from './options.js';
|
|
6
|
+
export const answerHelp = new CommandHelp('answer', 'Rule on a finding from a review', () => `Usage: weigh answer "<#n> <ruling>, <reason>" [options]
|
|
7
|
+
|
|
8
|
+
Rule on findings a review printed, against their fingerprints. Nothing is
|
|
9
|
+
re-reviewed and no model is called. Quote the message: a shell reads an
|
|
10
|
+
unquoted #3 as the start of a comment.
|
|
11
|
+
|
|
12
|
+
Rulings:
|
|
13
|
+
incorrect the review misread the code (needs a reason and a citation)
|
|
14
|
+
intentional deliberate; how the repo does it (needs a reason)
|
|
15
|
+
wont-fix a real defect, deprioritised
|
|
16
|
+
out-of-scope real, but not this change
|
|
17
|
+
confirmed the finding is right
|
|
18
|
+
|
|
19
|
+
A later review of the same code reads the ruling back: the two that concede the
|
|
20
|
+
defect stop it being reported here, and the two that dispute it are what a
|
|
21
|
+
--refute pass may stand on. The two that dispute it also teach: the reason you
|
|
22
|
+
give is written into what this repository is like, so the next review is told
|
|
23
|
+
it before it forms a view.
|
|
24
|
+
|
|
25
|
+
Options:
|
|
26
|
+
--review <id> The review the numbers belong to (default: the last
|
|
27
|
+
review of this branch)
|
|
28
|
+
--no-promote Record the ruling and teach nothing from it, for a
|
|
29
|
+
reason true of this branch only
|
|
30
|
+
${REPO_OPTION}
|
|
31
|
+
${JSON_OPTION}
|
|
32
|
+
-q, --quiet No output; exit 0 on success, 1 on error
|
|
33
|
+
|
|
34
|
+
${MEMORY_OPTIONS}
|
|
35
|
+
|
|
36
|
+
Examples:
|
|
37
|
+
weigh answer "#3 is intentional, we validate at the edge src/api/dto.ts:12"
|
|
38
|
+
weigh answer "#1 is incorrect, the guard is at src/cart.ts:40"`);
|
|
39
|
+
//# sourceMappingURL=answer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"answer.js","sourceRoot":"","sources":["../../../src/help/commands/answer.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,sEAAsE;AACtE,4DAA4D;AAE5D,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAExE,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,WAAW,CAAC,QAAQ,EAAE,iCAAiC,EAAE,GAAG,EAAE,CAAC;;;;;;;;;;;;;;;;;;;;;;;;EAwB3F,WAAW;EACX,WAAW;;;EAGX,cAAc;;;;iEAIiD,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/help/commands/config.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAGjD,eAAO,MAAM,UAAU,aAkBS,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
|
+
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
|
+
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
4
|
+
import { CommandHelp } from '../command-help.js';
|
|
5
|
+
import { REPO_OPTION, JSON_OPTION } from './options.js';
|
|
6
|
+
export const configHelp = new CommandHelp('config', 'Show or change settings, and where each comes from', () => `Usage: weigh config <list|get|set|path> [key] [value]
|
|
7
|
+
|
|
8
|
+
Every value is shown with the layer it came from: default, repo (the
|
|
9
|
+
repository's .weigh.json), file (your config file), env or flag.
|
|
10
|
+
|
|
11
|
+
list Every setting, its value and its source
|
|
12
|
+
get <key> One setting
|
|
13
|
+
set <key> <value>
|
|
14
|
+
Write a setting to your config file
|
|
15
|
+
path Where Weigh keeps its files
|
|
16
|
+
|
|
17
|
+
Options:
|
|
18
|
+
${REPO_OPTION}
|
|
19
|
+
${JSON_OPTION}
|
|
20
|
+
|
|
21
|
+
Examples:
|
|
22
|
+
weigh config list
|
|
23
|
+
weigh config get model
|
|
24
|
+
weigh config set refute true`);
|
|
25
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/help/commands/config.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,sEAAsE;AACtE,4DAA4D;AAE5D,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAExD,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,WAAW,CAAC,QAAQ,EAAE,oDAAoD,EAAE,GAAG,EAAE,CAAC;;;;;;;;;;;;EAY9G,WAAW;EACX,WAAW;;;;;+BAKkB,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/help/commands/context.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAGjD,eAAO,MAAM,WAAW,aAqCuC,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
|
+
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
|
+
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
4
|
+
import { CommandHelp } from '../command-help.js';
|
|
5
|
+
import { MEMORY_OPTIONS, REPO_OPTION, JSON_OPTION } from './options.js';
|
|
6
|
+
export const contextHelp = new CommandHelp('context', 'Read and write what Weigh knows about a repository', () => `Usage: weigh context <verb> [args] [options]
|
|
7
|
+
|
|
8
|
+
The claims a review is told about a repository before it reads the change.
|
|
9
|
+
|
|
10
|
+
add Write claims, read as JSON on stdin: one claim, or an array
|
|
11
|
+
list List the claims, with their ids
|
|
12
|
+
search Find claims that match a query
|
|
13
|
+
recall Show which claims a review of this change would be told, and why.
|
|
14
|
+
No model call
|
|
15
|
+
remove Remove claims by id, printed in the shape add reads
|
|
16
|
+
confirm Mark claims by id as still true at HEAD, so list --stale stops
|
|
17
|
+
offering them
|
|
18
|
+
clear Remove every claim about the repository (needs --yes)
|
|
19
|
+
|
|
20
|
+
Options:
|
|
21
|
+
${REPO_OPTION}
|
|
22
|
+
--limit <n> Maximum claims to list or search
|
|
23
|
+
--stale For list: only claims whose cited files changed since
|
|
24
|
+
they last held
|
|
25
|
+
--path <prefix> For list: only claims about this part of the
|
|
26
|
+
repository (relative to its root)
|
|
27
|
+
--if-new For add: skip a claim the repository already holds,
|
|
28
|
+
and hold back one that reads closely like a held
|
|
29
|
+
claim (knowledge.similar)
|
|
30
|
+
--base <ref> For recall: the ref to compare against
|
|
31
|
+
--uncommitted For recall: include uncommitted changes
|
|
32
|
+
-y, --yes Confirm clear
|
|
33
|
+
${JSON_OPTION}
|
|
34
|
+
|
|
35
|
+
${MEMORY_OPTIONS}
|
|
36
|
+
|
|
37
|
+
Examples:
|
|
38
|
+
weigh context list
|
|
39
|
+
weigh context list --stale --path apps/api --limit 30
|
|
40
|
+
echo '{"kind":"convention","statement":"...","evidence":["src/a.ts"]}' | weigh context add
|
|
41
|
+
weigh context add --if-new < claims.json
|
|
42
|
+
weigh context recall --base main
|
|
43
|
+
weigh context remove 3f2a9c1e-… (an id from context list)`);
|
|
44
|
+
//# sourceMappingURL=context.js.map
|