@webappwiz/cli 0.0.7 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -8
- package/index-4xj59vmx.js +135 -0
- package/{index-3k3rtw49.js → index-fh8js68z.js} +5 -17
- package/{index-3p0t2exn.js → index-hz6bwqfy.js} +4 -0
- package/index-r14q0cmx.js +262 -0
- package/{index-6km6e845.js → index-rz4spnkb.js} +123 -32
- package/index.js +12 -15
- package/judge.d.ts +9 -37
- package/judge.js +3 -4
- package/mode.d.ts +4 -6
- package/package.json +3 -3
- package/progress.d.ts +64 -0
- package/report.d.ts +14 -30
- package/rules.js +1 -1
- package/signoff.d.ts +0 -6
- package/signoff.js +2 -2
- package/webappwiz.js +12 -15
- package/cost.d.ts +0 -45
- package/index-jbrs6gqt.js +0 -418
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
table
|
|
3
|
-
} from "./index-
|
|
3
|
+
} from "./index-4xj59vmx.js";
|
|
4
4
|
// package.json
|
|
5
|
-
var version = "0.0.
|
|
5
|
+
var version = "0.0.8";
|
|
6
6
|
|
|
7
7
|
// skills/add.ts
|
|
8
8
|
import { ConsoleLogger } from "webappwiz/log";
|
|
@@ -15,7 +15,7 @@ import { dirname } from "node:path";
|
|
|
15
15
|
var arbor_skill_default = `---
|
|
16
16
|
name: arbor
|
|
17
17
|
description: Use the @webappwiz/arbor CLI to land your work on trunk, or a base branch given as an argument, from an isolated git worktree without pull requests. Read this before making any code change in an arbor repository, since it decides where the work happens, and whenever you need to add, claim, merge, remove, list, show, locate, or escalate a task.
|
|
18
|
-
version: 0.0.
|
|
18
|
+
version: 0.0.8
|
|
19
19
|
---
|
|
20
20
|
|
|
21
21
|
# Using arbor
|
|
@@ -41,28 +41,35 @@ its changed files:
|
|
|
41
41
|
\`git -C "$(arbor path <task>)" diff --name-only main...task/<task>\`
|
|
42
42
|
(\`arbor show <task>\` for its plan; neither takes its lease).
|
|
43
43
|
|
|
44
|
-
If nothing overlaps, carry on. If something does,
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
44
|
+
If nothing overlaps, carry on. If something does, \`arbor add\` your task if you
|
|
45
|
+
have not already and record the overlap in \`ARBOR.md\` (which task, which
|
|
46
|
+
files). Some overlap is normal: work alongside and accept the rebase. Only
|
|
47
|
+
when the overlap is significant and you expect merge conflicts that would be
|
|
48
|
+
hard to resolve, \`arbor wait <task>\` on the task you overlap with instead:
|
|
49
|
+
let it land first and your rebase is onto its work rather than against it.
|
|
50
|
+
|
|
51
|
+
Waiting is caution, reserved for overlap that warrants it. Escalate
|
|
52
|
+
instead only when the other task is doing something majorly different from
|
|
53
|
+
yours, or contrary to it: rewriting what you are extending, or asked for the
|
|
54
|
+
opposite of what you were. Then \`arbor escalate\` and ask the user whether to
|
|
55
|
+
wait for it, work alongside it and accept the rebase, or drop yours.
|
|
56
|
+
|
|
57
|
+
Act on how the wait ends:
|
|
58
|
+
|
|
59
|
+
- \`removed\`: it landed or was dropped. Redo the overlap check (trunk moved)
|
|
60
|
+
and carry on.
|
|
55
61
|
- \`escalated\`: your work is blocked on a person too. Tell the human what it
|
|
56
62
|
is blocked on and wait.
|
|
57
|
-
- \`orphaned\`, \`stray\`, \`unrecorded\` or \`unknown
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
- still \`working\` or \`merging\`
|
|
61
|
-
|
|
62
|
-
picking up something else,
|
|
63
|
+
- \`orphaned\`, \`stray\`, \`unrecorded\` or \`unknown\`: that tree is broken. A tree
|
|
64
|
+
mid-merge can read as \`orphaned\` for a moment, so \`wait\` once more before
|
|
65
|
+
believing it, then say so and ask.
|
|
66
|
+
- exit 14 \`timeout\`, still \`working\` or \`merging\`: \`wait\` again (with
|
|
67
|
+
\`--timeout-secs\` if the task looks close), or offer the choice of
|
|
68
|
+
working alongside it or picking up something else, saying what you have not
|
|
69
|
+
started.
|
|
63
70
|
|
|
64
71
|
A \`stale\` lease on a \`working\` task is normal (arbor only heartbeats while a
|
|
65
|
-
command runs):
|
|
72
|
+
command runs): watch a task's status, never its lease.
|
|
66
73
|
|
|
67
74
|
## Workflow
|
|
68
75
|
|
|
@@ -126,16 +133,38 @@ Anything else worth saying goes after this block, not instead of it.
|
|
|
126
133
|
## ARBOR.md
|
|
127
134
|
|
|
128
135
|
Your session can die at any moment; \`ARBOR.md\` is what lets a stranger
|
|
129
|
-
\`arbor claim\` the task and continue. Fill in
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
136
|
+
\`arbor claim\` the task and continue. Fill in the stub \`add\` wrote to this
|
|
137
|
+
shape:
|
|
138
|
+
|
|
139
|
+
\`\`\`\`markdown
|
|
140
|
+
# <task>
|
|
141
|
+
|
|
142
|
+
## Goal
|
|
143
|
+
|
|
144
|
+
One or two lines on what done means.
|
|
145
|
+
|
|
146
|
+
## Files
|
|
147
|
+
|
|
148
|
+
- every/path/you/plan/to/touch.ts
|
|
149
|
+
|
|
150
|
+
## Done
|
|
151
|
+
|
|
152
|
+
- [x] finished steps move here: these checkboxes are the only progress the
|
|
153
|
+
task reports
|
|
154
|
+
|
|
155
|
+
## Next
|
|
156
|
+
|
|
157
|
+
- [ ] every step you can foresee, roughly one commit each
|
|
158
|
+
|
|
159
|
+
## Notes
|
|
160
|
+
|
|
161
|
+
Decisions, dead ends, and how to verify.
|
|
162
|
+
\`\`\`\`
|
|
163
|
+
|
|
164
|
+
Keep the whole file current throughout implementation, not at the end: after
|
|
165
|
+
each step lands, check it off and move it to \`## Done\`, and when the set of
|
|
166
|
+
files you are touching changes, change \`## Files\` to match. A stale plan is
|
|
167
|
+
worse than none, and a session that dies mid-task reports nothing.
|
|
139
168
|
|
|
140
169
|
\`arbor show <task>\` prints the file and every way it departs from the
|
|
141
170
|
expected shape; run it on your own task after writing the file. \`add\` excludes
|
|
@@ -151,8 +180,70 @@ fewer than 5 commits, and wanting many more means the task wants splitting,
|
|
|
151
180
|
not squashing.
|
|
152
181
|
`;
|
|
153
182
|
|
|
183
|
+
// templates/webappwiz.skill.md
|
|
184
|
+
var webappwiz_skill_default = `---
|
|
185
|
+
name: webappwiz
|
|
186
|
+
description: Check whether the webappwiz package already covers a piece of infrastructure before writing it by hand or adding a dependency for it. Read this before writing any of: time, clocks, durations or timers; logging; id generation; HTTP serving; CLI argument parsing; background tasks or queues; web workers; markdown parsing; typed event emitters; 2D geometry or spatial indexes; filesystem, env or process access; typed RPC over fetch; schema validation; AbortSignal plumbing; disposable resources; browser scroll, animation frames or visibility. Also use whenever the user says webappwiz.
|
|
187
|
+
version: 0.0.8
|
|
188
|
+
---
|
|
189
|
+
|
|
190
|
+
# Using webappwiz
|
|
191
|
+
|
|
192
|
+
\`webappwiz\` is the parts of a web app that get written again every time, behind
|
|
193
|
+
interfaces a test can replace. One package, one subpath per module. Before
|
|
194
|
+
writing any of that here, find out whether it already exists there.
|
|
195
|
+
|
|
196
|
+
Its README carries the whole catalogue, a table of every subpath and what it is
|
|
197
|
+
for. Read it from \`node_modules/webappwiz/README.md\`, or, in a project that has
|
|
198
|
+
not installed it yet, from
|
|
199
|
+
\`https://raw.githubusercontent.com/jaredjj3/webappwiz/main/packages/webappwiz/README.md\`.
|
|
200
|
+
|
|
201
|
+
Nothing in the table is close: say so in a line and write it here. Something is:
|
|
202
|
+
read that module's own README and the exports of its \`index.ts\`, and judge
|
|
203
|
+
against what is actually needed rather than the one-line blurb.
|
|
204
|
+
|
|
205
|
+
## It fits
|
|
206
|
+
|
|
207
|
+
\`bun add webappwiz\` and import the subpath. There is no package entry point, so
|
|
208
|
+
import \`webappwiz/time\`, never \`webappwiz\`. Fakes live under \`/testing\` beside
|
|
209
|
+
what they replace.
|
|
210
|
+
|
|
211
|
+
## It nearly fits
|
|
212
|
+
|
|
213
|
+
Do not vendor it, fork it, or patch \`node_modules\`. Write what this project
|
|
214
|
+
needs here so nobody is blocked, leave a \`TODO: webappwiz/<subpath> once <gap>\`
|
|
215
|
+
on it, and hand the gap over: print the block below and tell the user to give it
|
|
216
|
+
to an agent working on the webappwiz repo.
|
|
217
|
+
|
|
218
|
+
\`\`\`markdown
|
|
219
|
+
In \`packages/webappwiz/<subpath>\`: <the gap, in a sentence>.
|
|
220
|
+
|
|
221
|
+
Wanted by <this project> for <the usecase, concretely>.
|
|
222
|
+
|
|
223
|
+
What is there now: <the export that comes closest, and where it stops>.
|
|
224
|
+
What is missing: <the smallest change that closes the gap: one more method, a
|
|
225
|
+
widened parameter, another implementation of an interface>.
|
|
226
|
+
Called like: <the call site, written the way the caller wants to write it>.
|
|
227
|
+
\`\`\`
|
|
228
|
+
|
|
229
|
+
Describe the gap and stop. Do not design the API in the handoff: that repo has a
|
|
230
|
+
style guide and a judge, and neither of them is here.
|
|
231
|
+
|
|
232
|
+
## It does not fit
|
|
233
|
+
|
|
234
|
+
One line naming the subpath you read and why it is not the one, then write it
|
|
235
|
+
here. A wrong module taken up is worse than one written twice.
|
|
236
|
+
|
|
237
|
+
## Rules
|
|
238
|
+
|
|
239
|
+
- Never edit the webappwiz repository from this project's thread.
|
|
240
|
+
- Never copy its source into this project.
|
|
241
|
+
- Reading the table is the whole check, and it is cheap. Do it before adding a
|
|
242
|
+
dependency, not after.
|
|
243
|
+
`;
|
|
244
|
+
|
|
154
245
|
// skills/skill.ts
|
|
155
|
-
var bundled = { arbor: arbor_skill_default };
|
|
246
|
+
var bundled = { arbor: arbor_skill_default, webappwiz: webappwiz_skill_default };
|
|
156
247
|
function versionOf(md) {
|
|
157
248
|
const frontmatter = md.match(/^---\n([\s\S]*?)\n---/)?.[1] ?? "";
|
|
158
249
|
return frontmatter.match(/^version:\s*(.+)$/m)?.[1]?.trim() ?? null;
|
package/index.js
CHANGED
|
@@ -6,17 +6,18 @@ import {
|
|
|
6
6
|
update,
|
|
7
7
|
update1 as update2,
|
|
8
8
|
version
|
|
9
|
-
} from "./index-
|
|
9
|
+
} from "./index-rz4spnkb.js";
|
|
10
10
|
import {
|
|
11
11
|
JUDGE_RULES,
|
|
12
12
|
SIGNOFF_RULES
|
|
13
|
-
} from "./index-
|
|
14
|
-
import {
|
|
15
|
-
Signoff
|
|
16
|
-
} from "./index-3k3rtw49.js";
|
|
13
|
+
} from "./index-hz6bwqfy.js";
|
|
17
14
|
import {
|
|
18
15
|
JudgeCommands
|
|
19
|
-
} from "./index-
|
|
16
|
+
} from "./index-r14q0cmx.js";
|
|
17
|
+
import {
|
|
18
|
+
Signoff
|
|
19
|
+
} from "./index-fh8js68z.js";
|
|
20
|
+
import"./index-4xj59vmx.js";
|
|
20
21
|
|
|
21
22
|
// index.ts
|
|
22
23
|
import { NodeFs, NodeGlob } from "webappwiz/system";
|
|
@@ -52,17 +53,16 @@ webappwiz.command("judge").description("check a directory against the config, on
|
|
|
52
53
|
}).option("print", t.boolean(), {
|
|
53
54
|
default: false,
|
|
54
55
|
description: "print the prompts and run no agent at all"
|
|
55
|
-
}).option("estimate", t.boolean(), {
|
|
56
|
-
default: false,
|
|
57
|
-
description: "print what a run would read, and run nothing"
|
|
58
56
|
}).option("chunk", t.number(), {
|
|
59
57
|
default: 25,
|
|
60
58
|
description: "files per review"
|
|
61
59
|
}).option("since", t.optional(t.string()), {
|
|
62
60
|
description: "only check files added or changed since this git ref"
|
|
63
|
-
}).option("
|
|
64
|
-
|
|
65
|
-
|
|
61
|
+
}).option("concurrency-override", t.optional(t.number()), {
|
|
62
|
+
description: "agent calls in flight at once, over the config's concurrency"
|
|
63
|
+
}).option("ci", t.boolean(), {
|
|
64
|
+
default: false,
|
|
65
|
+
description: "line-by-line output with no live progress block"
|
|
66
66
|
}).action((opts, deps) => judge(deps).judge(opts));
|
|
67
67
|
webappwiz.command("signoff").description("weigh a change against the rules that ask for a person").arg("dir", t.string(), {
|
|
68
68
|
default: ".",
|
|
@@ -77,9 +77,6 @@ webappwiz.command("signoff").description("weigh a change against the rules that
|
|
|
77
77
|
}).option("since", t.string(), {
|
|
78
78
|
default: "main",
|
|
79
79
|
description: "the ref the change is measured against"
|
|
80
|
-
}).option("budget", t.number(), {
|
|
81
|
-
default: 200000,
|
|
82
|
-
description: "confirm before reading more than this many tokens"
|
|
83
80
|
}).action((opts, { log, ps, clock }) => new Signoff(SIGNOFF_RULES, JUDGE_RULES.agent, {
|
|
84
81
|
log,
|
|
85
82
|
ps,
|
package/judge.d.ts
CHANGED
|
@@ -2,10 +2,7 @@ import { type Rule, type RuleSet } from "@webappwiz/rules";
|
|
|
2
2
|
import { type Logger } from "webappwiz/log";
|
|
3
3
|
import { type Fs, type Glob, type Ps } from "webappwiz/system";
|
|
4
4
|
import { type Clock } from "webappwiz/time";
|
|
5
|
-
|
|
6
|
-
export interface Confirm {
|
|
7
|
-
confirm(question: string): boolean | Promise<boolean>;
|
|
8
|
-
}
|
|
5
|
+
import { type Screen } from "./progress.js";
|
|
9
6
|
export interface ShowOptions {
|
|
10
7
|
/** The rule to print, as `rules ls` lists it. */
|
|
11
8
|
id: string;
|
|
@@ -17,27 +14,21 @@ export interface JudgeOptions {
|
|
|
17
14
|
exec?: string;
|
|
18
15
|
/** Print the prompts to the logger and spawn nothing. */
|
|
19
16
|
print?: boolean;
|
|
20
|
-
/** Print what a run would read and stop. */
|
|
21
|
-
estimate?: boolean;
|
|
22
17
|
/** Files per review. */
|
|
23
18
|
chunk: number;
|
|
24
19
|
/** Narrows the run to what git says has changed since this ref. */
|
|
25
20
|
since?: string;
|
|
26
|
-
/**
|
|
27
|
-
|
|
21
|
+
/** Agent calls in flight at once, over the config's `concurrency`. */
|
|
22
|
+
"concurrency-override"?: number;
|
|
23
|
+
/** Line-by-line output with no live block, the way a log wants it. */
|
|
24
|
+
ci?: boolean;
|
|
28
25
|
}
|
|
29
|
-
/**
|
|
30
|
-
* Answers on the terminal, and answers no without one: a run nobody is watching
|
|
31
|
-
* should stop and say the number rather than block forever waiting to be told
|
|
32
|
-
* to go ahead.
|
|
33
|
-
*/
|
|
34
|
-
export declare const ask: Confirm;
|
|
35
26
|
/** What a `JudgeCommands` runs through, and what else it lists. */
|
|
36
27
|
export interface JudgeCommandsOptions {
|
|
37
28
|
/** Rules only a reader applies, listed beside the ones a run checks. */
|
|
38
29
|
signoffRules?: Rule[];
|
|
39
|
-
/**
|
|
40
|
-
|
|
30
|
+
/** Where live progress draws; this process's terminal by default. */
|
|
31
|
+
screen?: Screen;
|
|
41
32
|
log?: Logger;
|
|
42
33
|
fs?: Fs;
|
|
43
34
|
ps?: Ps;
|
|
@@ -47,7 +38,7 @@ export interface JudgeCommandsOptions {
|
|
|
47
38
|
export declare class JudgeCommands {
|
|
48
39
|
private rules;
|
|
49
40
|
private signoffRules;
|
|
50
|
-
private
|
|
41
|
+
private screen;
|
|
51
42
|
private log;
|
|
52
43
|
private fs;
|
|
53
44
|
private ps;
|
|
@@ -72,28 +63,9 @@ export declare class JudgeCommands {
|
|
|
72
63
|
* it spawns nothing and prints the prompts instead, for an agent that would
|
|
73
64
|
* rather hand them to subagents of its own.
|
|
74
65
|
*
|
|
75
|
-
* `since` narrows the run to what git says has changed
|
|
76
|
-
* what it may read before asking whether you meant it. Under `estimate` it
|
|
77
|
-
* prints that size and stops, which is the answer to "what would this cost"
|
|
78
|
-
* without having to guess a budget low enough to be refused.
|
|
66
|
+
* `since` narrows the run to what git says has changed.
|
|
79
67
|
*/
|
|
80
68
|
judge(opts: JudgeOptions): Promise<void>;
|
|
81
|
-
/**
|
|
82
|
-
* Measures what one call cost over the files it was handed and leaves that
|
|
83
|
-
* behind, so the next `--estimate` on this agent has something better than a
|
|
84
|
-
* floor. Per call rather than per token, because that is how the charge
|
|
85
|
-
* falls: an agent pays for its own system prompt once per spawn, whatever it
|
|
86
|
-
* was asked to read, so a figure taken from a two-call run still holds for a
|
|
87
|
-
* fifteen-call one.
|
|
88
|
-
*
|
|
89
|
-
* A run nobody priced records nothing, and a failed write is said aloud
|
|
90
|
-
* rather than thrown: the agents have already been paid for by this point,
|
|
91
|
-
* and losing the measurement costs the next estimate accuracy, not the run.
|
|
92
|
-
*/
|
|
93
|
-
private record;
|
|
94
69
|
/** The agent a command runs with: what it was told, else the config's. */
|
|
95
70
|
private agent;
|
|
96
|
-
/** The model a run asks, or undefined for an `--exec` command, which is a
|
|
97
|
-
* model nothing here can name or price. */
|
|
98
|
-
private model;
|
|
99
71
|
}
|
package/judge.js
CHANGED
package/mode.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** What a command does with the plan it has made. */
|
|
2
|
-
export type Mode = "print" | "
|
|
3
|
-
/** The flags that choose between the
|
|
2
|
+
export type Mode = "print" | "run";
|
|
3
|
+
/** The flags that choose between the two, on top of the two that name an
|
|
4
4
|
* agent. */
|
|
5
5
|
export interface ModeOptions {
|
|
6
6
|
/** A model to ask. */
|
|
@@ -9,15 +9,13 @@ export interface ModeOptions {
|
|
|
9
9
|
exec?: string;
|
|
10
10
|
/** Print to the logger and spawn nothing. */
|
|
11
11
|
print?: boolean;
|
|
12
|
-
/** Print what a run would read, and spawn nothing. */
|
|
13
|
-
estimate?: boolean;
|
|
14
12
|
}
|
|
15
13
|
/**
|
|
16
|
-
* Which of the
|
|
14
|
+
* Which of the two a caller asked for, with running the default: a command
|
|
17
15
|
* given nothing but a directory is one somebody means to run.
|
|
18
16
|
*
|
|
19
17
|
* Naming two is an error rather than a quiet winner. All of these say what to
|
|
20
18
|
* do with one plan, and letting one silently beat the other would leave a
|
|
21
19
|
* caller unsure which of the two things they asked for they got.
|
|
22
20
|
*/
|
|
23
|
-
export declare function mode({ print,
|
|
21
|
+
export declare function mode({ print, agent, exec }: ModeOptions): Mode;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webappwiz/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.8",
|
|
4
4
|
"description": "The webappwiz CLI: judge code against rules, sign off a diff, and manage agent skills",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Jared Johnson",
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
"access": "public"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@webappwiz/rules": "^0.0.
|
|
21
|
-
"webappwiz": "^0.0.
|
|
20
|
+
"@webappwiz/rules": "^0.0.8",
|
|
21
|
+
"webappwiz": "^0.0.8"
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
24
24
|
"typescript": "^7"
|
package/progress.d.ts
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { type Timer } from "webappwiz/time";
|
|
2
|
+
/**
|
|
3
|
+
* Where live progress draws. `tty` is whether a line can be redrawn in
|
|
4
|
+
* place: without one, judge stays line-by-line and never writes here.
|
|
5
|
+
*/
|
|
6
|
+
export interface Screen {
|
|
7
|
+
tty: boolean;
|
|
8
|
+
write(text: string): void;
|
|
9
|
+
}
|
|
10
|
+
/** The terminal this process writes to. */
|
|
11
|
+
export declare const terminal: () => Screen;
|
|
12
|
+
/** A run as the status line shows it: how far along, what it is on, what it
|
|
13
|
+
* has spent, and what it has found. */
|
|
14
|
+
export interface RunView {
|
|
15
|
+
/** Calls finished. */
|
|
16
|
+
done: number;
|
|
17
|
+
/** Calls the run will make in all. */
|
|
18
|
+
total: number;
|
|
19
|
+
/** Files the calls out right now are reading. Every review names at least
|
|
20
|
+
* one, so zero here is the same as nothing running. */
|
|
21
|
+
files: number;
|
|
22
|
+
/** Tokens spent so far, when any agent has reported usage. */
|
|
23
|
+
tokens?: number;
|
|
24
|
+
/** Violations found so far; said aloud once the first call is home. */
|
|
25
|
+
problems: number;
|
|
26
|
+
}
|
|
27
|
+
/** The spinner's walk, one step per tick while any call is out. */
|
|
28
|
+
export declare const FRAMES: string[];
|
|
29
|
+
/**
|
|
30
|
+
* The status line. Pure, so what it says is testable without a terminal:
|
|
31
|
+
* the `Progress` around it only draws and redraws it. `frame` indexes the
|
|
32
|
+
* spinner's walk; with nothing running there is nothing to spin.
|
|
33
|
+
*/
|
|
34
|
+
export declare function render(view: RunView, frame?: number): string;
|
|
35
|
+
/** What a `Progress` paces its spinner with; the real one by default. */
|
|
36
|
+
export interface ProgressOptions {
|
|
37
|
+
timer?: Timer;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* The live line a run draws while agents are out: progress over the calls
|
|
41
|
+
* and the tokens they have spent, redrawn on every event and spun on a
|
|
42
|
+
* tick between them. `stop` takes the line down, and whatever prints next
|
|
43
|
+
* lands where it was.
|
|
44
|
+
*/
|
|
45
|
+
export declare class Progress {
|
|
46
|
+
private screen;
|
|
47
|
+
private total;
|
|
48
|
+
private done;
|
|
49
|
+
private files;
|
|
50
|
+
private problems;
|
|
51
|
+
private tokens;
|
|
52
|
+
private drawn;
|
|
53
|
+
private frame;
|
|
54
|
+
private ticking;
|
|
55
|
+
constructor(screen: Screen, total: number, opts?: ProgressOptions);
|
|
56
|
+
/** A call went out over this many files. */
|
|
57
|
+
started(files: number): void;
|
|
58
|
+
/** A call came home: the files it read, what it spent, what it found. */
|
|
59
|
+
finished(files: number, spent?: number, problems?: number): void;
|
|
60
|
+
/** Takes the line down for good; call it before printing the report. */
|
|
61
|
+
stop(): void;
|
|
62
|
+
private erase;
|
|
63
|
+
private draw;
|
|
64
|
+
}
|
package/report.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { Violation } from "@webappwiz/rules";
|
|
2
2
|
import type { Duration } from "webappwiz/time";
|
|
3
|
-
import { type Overheads } from "./cost.js";
|
|
4
3
|
export declare const count: (total: number, word: string) => string;
|
|
5
4
|
/**
|
|
6
5
|
* Where one printed document stops and the next starts, named so a reader
|
|
@@ -11,7 +10,8 @@ export declare const count: (total: number, word: string) => string;
|
|
|
11
10
|
* the last document wants as much as the others want an opening one.
|
|
12
11
|
*/
|
|
13
12
|
export declare const divider: (name?: string) => string;
|
|
14
|
-
|
|
13
|
+
/** How every token figure prints: "14K", not "14,000". */
|
|
14
|
+
export declare const compact: Intl.NumberFormat;
|
|
15
15
|
/**
|
|
16
16
|
* What a plan costs to read, at the four-bytes-a-token rule of thumb. Rough on
|
|
17
17
|
* purpose: an estimate that needed a tokenizer, or an API call to count, would
|
|
@@ -19,28 +19,10 @@ export declare const usd: (amount: number) => string;
|
|
|
19
19
|
* decision it informs is only ever "is this the order of magnitude I meant".
|
|
20
20
|
*/
|
|
21
21
|
export declare const tokens: (bytes: number) => number;
|
|
22
|
-
/**
|
|
23
|
-
* Why the estimate is a floor: each call pays for the agent's own system
|
|
24
|
-
* prompt and for whatever it re-reads as it works, none of which is knowable
|
|
25
|
-
* from here.
|
|
26
|
-
*/
|
|
27
|
-
export declare function overBudget(estimate: number, budget: number, cost?: number): string;
|
|
28
|
-
/**
|
|
29
|
-
* The whole of what `--estimate` prints: the plan, then what it costs on each
|
|
30
|
-
* agent that has a price.
|
|
31
|
-
*
|
|
32
|
-
* Two columns, because the floor alone is misleading. It prices the files a
|
|
33
|
-
* plan can see, and a call also pays for the agent's own system prompt every
|
|
34
|
-
* time, which on a small repo is most of the bill. `overheads` carries what
|
|
35
|
-
* past runs measured that per-call charge to be, so an agent that has been run
|
|
36
|
-
* here gets a second figure worth trusting.
|
|
37
|
-
*/
|
|
38
|
-
export declare function estimate(files: number, rules: number, calls: number, tokens: number, overheads: Overheads): string[];
|
|
39
22
|
/**
|
|
40
23
|
* The plan, before the first agent starts. Counts calls rather than reviews
|
|
41
|
-
* because a call is what a run
|
|
42
|
-
* `[n/total]` headings below.
|
|
43
|
-
* `--estimate` prints, so it names no command it is not going to run.
|
|
24
|
+
* because a call is what a run spawns, and it is the denominator of the
|
|
25
|
+
* `[n/total]` headings below.
|
|
44
26
|
*/
|
|
45
27
|
export interface Planned {
|
|
46
28
|
files: number;
|
|
@@ -50,14 +32,12 @@ export interface Planned {
|
|
|
50
32
|
estimate: number;
|
|
51
33
|
/** Agent calls in flight at once, which is what the wall clock turns on. */
|
|
52
34
|
concurrency?: number;
|
|
53
|
-
/** What those calls are predicted to cost, when the agent has a price. */
|
|
54
|
-
cost?: number;
|
|
55
35
|
/** The command the run will spawn. */
|
|
56
36
|
agent?: string;
|
|
57
37
|
}
|
|
58
|
-
export declare function planned({ files, rules, calls, estimate, concurrency,
|
|
38
|
+
export declare function planned({ files, rules, calls, estimate, concurrency, agent, }: Planned): string[];
|
|
59
39
|
/** A finished review as the report prints it: what the call covered, what it
|
|
60
|
-
* found, and what it
|
|
40
|
+
* found, and what it read. */
|
|
61
41
|
export interface Finished {
|
|
62
42
|
/** The ids of the rules the review checked. */
|
|
63
43
|
rules: string[];
|
|
@@ -66,8 +46,12 @@ export interface Finished {
|
|
|
66
46
|
violations: Violation[];
|
|
67
47
|
/** How long this review's agent took. */
|
|
68
48
|
took: Duration;
|
|
69
|
-
/**
|
|
70
|
-
|
|
49
|
+
/** Tokens this review's call touched, when the agent reported usage. */
|
|
50
|
+
tokens?: number;
|
|
51
|
+
/** Which worker ran the call, 0-based. */
|
|
52
|
+
worker: number;
|
|
53
|
+
/** Tokens that worker has touched so far, this review included. */
|
|
54
|
+
workerTokens?: number;
|
|
71
55
|
done: number;
|
|
72
56
|
total: number;
|
|
73
57
|
}
|
|
@@ -75,11 +59,11 @@ export interface Finished {
|
|
|
75
59
|
* A finished review, as it should print the moment its agent returns: a status
|
|
76
60
|
* line sizing the call, then one finding per violation.
|
|
77
61
|
*/
|
|
78
|
-
export declare function finished({ rules, files, violations, took,
|
|
62
|
+
export declare function finished({ rules, files, violations, took, tokens, worker, workerTokens, done, total, }: Finished): string[];
|
|
79
63
|
/**
|
|
80
64
|
* One violation: a location a reader can click, what the code does that the
|
|
81
65
|
* rule forbids, and the line it happens on. The heading above names only the
|
|
82
66
|
* glob, so the finding says which of its rules this one breaks.
|
|
83
67
|
*/
|
|
84
68
|
export declare function finding(violation: Violation): string[];
|
|
85
|
-
export declare function summary(violations: Violation[], took: Duration,
|
|
69
|
+
export declare function summary(violations: Violation[], took: Duration, tokens?: number): string;
|
package/rules.js
CHANGED
package/signoff.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ import { type Rule } from "@webappwiz/rules";
|
|
|
2
2
|
import { type Logger } from "webappwiz/log";
|
|
3
3
|
import { type Ps } from "webappwiz/system";
|
|
4
4
|
import { type Clock } from "webappwiz/time";
|
|
5
|
-
import { type Confirm } from "./judge.js";
|
|
6
5
|
export interface SignoffRunOptions {
|
|
7
6
|
/** The directory whose change is being weighed. */
|
|
8
7
|
dir: string;
|
|
@@ -14,8 +13,6 @@ export interface SignoffRunOptions {
|
|
|
14
13
|
/** The ref the change is measured against: everything since it is the
|
|
15
14
|
* change. */
|
|
16
15
|
since: string;
|
|
17
|
-
/** Tokens a run may read before it asks whether you meant it. */
|
|
18
|
-
budget: number;
|
|
19
16
|
}
|
|
20
17
|
/**
|
|
21
18
|
* Weighs a change against the rules that decide whether it can merge on its
|
|
@@ -28,8 +25,6 @@ export interface SignoffRunOptions {
|
|
|
28
25
|
*/
|
|
29
26
|
/** What a `Signoff` runs through. */
|
|
30
27
|
export interface SignoffOptions {
|
|
31
|
-
/** Who is asked before a run goes over budget; the terminal by default. */
|
|
32
|
-
confirmer?: Confirm;
|
|
33
28
|
log?: Logger;
|
|
34
29
|
ps?: Ps;
|
|
35
30
|
clock?: Clock;
|
|
@@ -37,7 +32,6 @@ export interface SignoffOptions {
|
|
|
37
32
|
export declare class Signoff {
|
|
38
33
|
private rules;
|
|
39
34
|
private defaultAgent;
|
|
40
|
-
private confirmer;
|
|
41
35
|
private log;
|
|
42
36
|
private ps;
|
|
43
37
|
private clock;
|