@webappwiz/cli 0.0.7 → 0.0.9

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 CHANGED
@@ -9,49 +9,24 @@ bunx @webappwiz/cli skills add arbor # install an agent skill
9
9
  bunx @webappwiz/cli skills update # refresh the ones already installed
10
10
  bunx @webappwiz/cli rules ls # every rule there is
11
11
  bunx @webappwiz/cli judge . # check a directory against them
12
- bunx @webappwiz/cli signoff # does this change need a person?
13
12
  ```
14
13
 
15
14
  ## rules
16
15
 
17
16
  Every rule webappwiz judges itself by is named in [`rules.ts`](./rules.ts), as
18
- `JUDGE_RULES` and `SIGNOFF_RULES`, off the classes
19
- [`@webappwiz/rules`](../rules/rules) ships. There is no config file and no
20
- preset: a rule is in one of those lists or it does not exist.
17
+ `JUDGE_RULES`, off the classes [`@webappwiz/rules`](../rules/rules) ships.
18
+ There is no config file and no preset: a rule is in that list or it does not
19
+ exist.
21
20
 
22
21
  ```
23
- ID RULE SET LEVEL FILES
24
- no-em-dashes No em dashes judge error **/*.ts
25
- one-class-per-file One class per file judge error **/*.ts
26
- visual-work-tested Visual work is tested signoff
22
+ ID RULE LEVEL FILES
23
+ no-em-dashes No em dashes error **/*.ts
24
+ one-class-per-file One class per file error **/*.ts
27
25
  ```
28
26
 
29
27
  `rules show <id>` prints one in full: its glob, its level, and the document an
30
28
  agent is handed verbatim.
31
29
 
32
- The `SET` column is which of the two lists a rule is in. `judge` rules are what
33
- `judge` checks files against, file by file. `signoff` rules have no glob and no
34
- level because they are about a change rather than a file: `signoff` weighs them,
35
- and what they answer is whether it needs a person rather than where the code is
36
- wrong.
37
-
38
- ## signoff
39
-
40
- Weighs a change against the signoff rules and exits 1 with a reason when one of
41
- them wants a person to look before it merges. One agent call over the whole
42
- diff, since that is what these rules are about.
43
-
44
- ```bash
45
- bunx @webappwiz/cli signoff # everything since main
46
- bunx @webappwiz/cli signoff --since HEAD~3 # measured against another ref
47
- bunx @webappwiz/cli signoff --print # the rules, to apply yourself
48
- ```
49
-
50
- `--print` is the cheapest signoff there is: the agent about to merge reads the
51
- rules and weighs its own change, spawning nothing. A project points its agent
52
- instructions at that rather than at a list of rule ids, which goes stale the
53
- next time a rule is added.
54
-
55
30
  ## judge
56
31
 
57
32
  Runs the rules over a directory, one agent call per set of rules sharing a set
@@ -59,16 +34,17 @@ of files.
59
34
 
60
35
  ```bash
61
36
  bunx @webappwiz/cli judge . --agent haiku
62
- bunx @webappwiz/cli judge . --estimate # what would this read, and cost
63
37
  bunx @webappwiz/cli judge . --print # print the prompts, spawn nothing
64
38
  bunx @webappwiz/cli judge . --since main # only what changed
39
+ bunx @webappwiz/cli judge . --ci # plain lines, no live block
65
40
  ```
66
41
 
67
42
  Each rule's code half runs first, free, and only what it escalates reaches an
68
- agent. `--budget` caps what a run may read before it asks whether you meant it;
69
- `--estimate` answers that without having to guess a budget low enough to be
70
- refused. `--print`, `--estimate` and running are three things to do with one
71
- plan, so passing two of them is an error rather than one quietly winning. Code excuses itself from a rule with a `rule-ignore <id>: <reason>`
43
+ agent. On a terminal a run draws a live status line (a bar over the calls,
44
+ how many are out, and the tokens spent so far), then dumps the report in one
45
+ block; `--ci`, or any output that is not a terminal, prints line by line as
46
+ reviews finish instead. `--print` and running are two things to do with one
47
+ plan, so passing both is an error rather than one quietly winning. Code excuses itself from a rule with a `rule-ignore <id>: <reason>`
72
48
  comment above the line, or `rule-ignore-file <id>: <reason>` for the file.
73
49
 
74
50
  ## update
@@ -100,11 +76,15 @@ bunx @webappwiz/cli skills update ./project
100
76
  ```
101
77
 
102
78
  ```
103
- SKILL SHIPS INSTALLED
104
- arbor 1.4.0 1.3.0
105
- other 1.4.0 -
79
+ SKILL SHIPS INSTALLED
80
+ arbor 1.4.0 1.3.0
81
+ webappwiz 1.4.0 -
106
82
  ```
107
83
 
84
+ Two ship: `arbor`, which lands an agent's work from its own worktree, and
85
+ `webappwiz`, which sends an agent to the package's catalogue before it writes
86
+ infrastructure by hand.
87
+
108
88
  `add` installs one skill by name. `update` refreshes the ones a project already
109
89
  has and never installs a new one: which skills a project uses is its own
110
90
  business, and a skill nobody chose should not arrive by way of an update. `ls`
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  table
3
- } from "./index-jbrs6gqt.js";
3
+ } from "./index-pyjg1rtk.js";
4
4
  // package.json
5
- var version = "0.0.7";
5
+ var version = "0.0.9";
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.7
18
+ version: 0.0.9
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, do not pick a side
45
- yourself: \`arbor add\` your task if you have not already, record the overlap
46
- in \`ARBOR.md\` (which task, which files), then \`arbor escalate\` and ask the
47
- user whether to wait for the other task, work alongside it and accept the
48
- rebase, or drop yours. If they choose to wait, re-check periodically. A
49
- status is only true for the moment you read it,
50
- so re-run \`arbor ls\` every time you are about to repeat one. Act on what it
51
- becomes:
52
-
53
- - gone from \`arbor ls\`: it landed. Redo the overlap check (trunk moved) and
54
- carry on.
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\` with nobody driving it: that
58
- tree is broken. Say so and ask. (A tree mid-merge can read as \`orphaned\`
59
- for a moment, so trust a broken status only if it survives a second look.)
60
- - still \`working\` or \`merging\` after however long the human would tolerate
61
- hearing nothing: offer the choice of waiting longer, working alongside, or
62
- picking up something else, and say what you have not started.
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): when waiting, watch a task's status, never its lease.
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 \`## Goal\` (one or two lines on
130
- what done means), list the file paths you plan to touch under \`## Files\`,
131
- and list every step you can foresee under \`## Next\` as \`- [ ]\` items,
132
- roughly one commit each. Move items to \`## Done\` as you finish them: those
133
- checkboxes are the only progress the task reports. Decisions, dead ends and
134
- how to verify go under \`## Notes\`. Keep the whole file current throughout
135
- implementation, not at the end: after each step lands, check it off, and
136
- when the set of files you are touching changes, change \`## Files\` to match.
137
- A stale plan is worse than none, and a session that dies mid-task reports
138
- nothing.
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.9
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;
@@ -5,6 +5,7 @@ import {
5
5
  CommentsSayWhyNotWhat,
6
6
  DevServersFindAPort,
7
7
  DocCommentsAddressUsers,
8
+ ExportLeadsTheFile,
8
9
  FakesOverMocks,
9
10
  MatchersOverTestLogic,
10
11
  NamedOptionsLast,
@@ -16,18 +17,19 @@ import {
16
17
  ReactiveOverUseState,
17
18
  ResourcesAreDisposable,
18
19
  SimpleTestSetup,
19
- TestsNotWeakened,
20
- VisualWorkTested
20
+ TestsOwnTheirState
21
21
  } from "@webappwiz/rules/catalog";
22
22
  var JUDGE_RULES = defineRules({
23
23
  rules: [
24
24
  new NoEmDashes,
25
25
  new OneClassPerFile,
26
+ new ExportLeadsTheFile,
26
27
  new ParametersDeclareFields,
27
28
  new ClassesOverFunctionExports,
28
29
  new ObjectsOverCallbacks,
29
30
  new NamedOptionsLast,
30
31
  new SimpleTestSetup,
32
+ new TestsOwnTheirState,
31
33
  new FakesOverMocks,
32
34
  new MatchersOverTestLogic,
33
35
  new CommentsSayWhyNotWhat,
@@ -38,9 +40,5 @@ var JUDGE_RULES = defineRules({
38
40
  new ResourcesAreDisposable
39
41
  ]
40
42
  });
41
- var SIGNOFF_RULES = [
42
- new TestsNotWeakened,
43
- new VisualWorkTested
44
- ];
45
43
 
46
- export { JUDGE_RULES, SIGNOFF_RULES };
44
+ export { JUDGE_RULES };