@webappwiz/cli 0.0.9 → 0.0.11

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
@@ -1,51 +1,71 @@
1
1
  # @webappwiz/cli
2
2
 
3
- Keeps a project in step with a webappwiz release.
3
+ Keeps a project in step with a webappwiz release, and divides a review of its
4
+ rules up for an agent to run.
4
5
 
5
6
  ```bash
6
- bunx @webappwiz/cli update # pin webappwiz deps, like bun update
7
- bunx @webappwiz/cli skills ls # what there is, and what you have
8
- bunx @webappwiz/cli skills add arbor # install an agent skill
9
- bunx @webappwiz/cli skills update # refresh the ones already installed
10
- bunx @webappwiz/cli rules ls # every rule there is
11
- bunx @webappwiz/cli judge . # check a directory against them
7
+ bunx @webappwiz/cli update # pin webappwiz deps, like bun update
8
+ bunx @webappwiz/cli skills ls # what there is, and what you have
9
+ bunx @webappwiz/cli skills add review # install an agent skill
10
+ bunx @webappwiz/cli skills update # refresh the ones already installed
11
+ bunx @webappwiz/cli rules ls # every rule there is, and what you have
12
+ bunx @webappwiz/cli rules new <name> # scaffold a rule of your own
13
+ bunx @webappwiz/cli rules add <id> # copy a shipped rule in
14
+ bunx @webappwiz/cli rules update # refresh the copies
15
+ bunx @webappwiz/cli rules review --since main # divide a review up
12
16
  ```
13
17
 
14
18
  ## rules
15
19
 
16
- Every rule webappwiz judges itself by is named in [`rules.ts`](./rules.ts), as
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.
20
+ A project's rules live in `.wiz/rules`, one directory per rule holding a
21
+ `RULE.md`: markdown with a little frontmatter, and no code. A rule is there or
22
+ it does not run. The ones that ship come from
23
+ [`@webappwiz/rules`](../rules)'s catalog, and a project's own sit beside them
24
+ in the same shape.
20
25
 
21
26
  ```
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
+ rule level complexity files ships installed description
28
+ no-em-dashes error low **/*.{ts,md} 0.1.0 0.1.0 No em dashes, and no en dashes between words.
29
+ one-class-per-file error low **/*.ts 0.1.0 - A file declares one top-level class.
30
+ mine error medium **/*.ts - local What this project wants.
25
31
  ```
26
32
 
27
- `rules show <id>` prints one in full: its glob, its level, and the document an
28
- agent is handed verbatim.
33
+ `ls` validates the frontmatter of every rule the project has and refuses to
34
+ list a broken one, naming the file and line instead. The body is the author's,
35
+ as a skill's is. `new` writes a `RULE.md` to fill in, with a comment saying
36
+ what goes where. `add` copies a shipped rule in, where it runs
37
+ and can be edited; `update` refreshes those copies and leaves the project's
38
+ own alone. Both replace what is there, as `skills` does.
29
39
 
30
- ## judge
40
+ ### review
31
41
 
32
- Runs the rules over a directory, one agent call per set of rules sharing a set
33
- of files.
42
+ Nothing here spawns an agent. `review` asks git what changed since a ref,
43
+ matches each rule's glob against it, and prints one block of work per rule
44
+ that matched, cut into several when a rule matched more than `--chunk` files:
34
45
 
35
- ```bash
36
- bunx @webappwiz/cli judge . --agent haiku
37
- bunx @webappwiz/cli judge . --print # print the prompts, spawn nothing
38
- bunx @webappwiz/cli judge . --since main # only what changed
39
- bunx @webappwiz/cli judge . --ci # plain lines, no live block
40
46
  ```
47
+ 2 files changed since main; 2 rules matched, 2 blocks to review
48
+
49
+ ## no-em-dashes (2 files, complexity low)
50
+
51
+ Read `.wiz/rules/no-em-dashes/RULE.md` and apply that rule, and only that
52
+ rule, to the files listed below. ...
53
+
54
+ - src/a.ts
55
+ - src/b.ts (new)
56
+
57
+ Reply with only a JSON array, one element per violation, or [] when there
58
+ is none: [{"file": ..., "line": ..., "message": ...}]
59
+ ```
60
+
61
+ A block is the whole prompt for one subagent. It names the rule's file rather
62
+ than quoting it, so the agent that prints the blocks and spawns the subagents
63
+ never reads a rule, and the rules stay out of its context. The heading
64
+ carries the rule's complexity, for choosing a model. The `review` skill teaches
65
+ an agent the loop.
41
66
 
42
- Each rule's code half runs first, free, and only what it escalates reaches an
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>`
48
- comment above the line, or `rule-ignore-file <id>: <reason>` for the file.
67
+ Code excuses itself from a rule with a `rule-ignore <id>: <reason>` comment
68
+ above the line, or `rule-ignore-file <id>: <reason>` for the file.
49
69
 
50
70
  ## update
51
71
 
@@ -57,7 +77,7 @@ combination nobody tested.
57
77
  The default version is this package's own, which is the point of `bunx`: the
58
78
  release you invoke is the release you get. `--version` pins something else.
59
79
  `workspace:` ranges are left alone; inside a monorepo they already track each
60
- other.
80
+ other. Installed skills and copied rules are refreshed too.
61
81
 
62
82
  ```bash
63
83
  bunx @webappwiz/cli update ./apps --version 1.4.0
@@ -71,17 +91,19 @@ visible rather than merely wrong.
71
91
 
72
92
  ```bash
73
93
  bunx @webappwiz/cli skills ls ./project
74
- bunx @webappwiz/cli skills add arbor ./project
94
+ bunx @webappwiz/cli skills add review ./project
75
95
  bunx @webappwiz/cli skills update ./project
76
96
  ```
77
97
 
78
98
  ```
79
99
  SKILL SHIPS INSTALLED
80
100
  arbor 1.4.0 1.3.0
101
+ review 1.4.0 -
81
102
  webappwiz 1.4.0 -
82
103
  ```
83
104
 
84
- Two ship: `arbor`, which lands an agent's work from its own worktree, and
105
+ Three ship: `arbor`, which lands an agent's work from its own worktree;
106
+ `review`, which runs the rules through subagents without reading one; and
85
107
  `webappwiz`, which sends an agent to the package's catalogue before it writes
86
108
  infrastructure by hand.
87
109
 
package/documents.d.ts ADDED
@@ -0,0 +1,51 @@
1
+ import { type Logger } from "webappwiz/log";
2
+ import { type Fs } from "webappwiz/system";
3
+ /** Where one kind of document lives in a project. */
4
+ export interface Layout {
5
+ /** Under the project root: one directory per document, named after it. */
6
+ root: string;
7
+ /** The file each of those directories holds. */
8
+ file: string;
9
+ /** What a message calls one of them. */
10
+ noun: string;
11
+ }
12
+ /** What `Documents` reads and writes through; the real ones by default. */
13
+ export interface DocumentsOptions {
14
+ log?: Logger;
15
+ fs?: Fs;
16
+ }
17
+ /** The `version:` in a document's frontmatter, or null when it has none. */
18
+ export declare function versionOf(md: string): string | null;
19
+ /**
20
+ * Documents a package bundles and a project installs copies of: skills under
21
+ * `.agents/skills`, rules under `.wiz/rules`. Each copy's frontmatter carries
22
+ * the version it came from, so a stale copy is visible rather than merely
23
+ * wrong, and refreshing is copying again.
24
+ */
25
+ export declare class Documents {
26
+ /** Name to document, as bundled. */
27
+ private docs;
28
+ private layout;
29
+ private log;
30
+ private fs;
31
+ constructor(
32
+ /** Name to document, as bundled. */
33
+ docs: Record<string, string>, layout: Layout, opts?: DocumentsOptions);
34
+ /** Every document on offer, name and text, in name order. */
35
+ available(): Array<[string, string]>;
36
+ /** Where a project keeps its copy of `name`. */
37
+ path(dir: string, name: string): string;
38
+ /** The names a project has a copy of, ours or not, in name order. */
39
+ installed(dir: string): Promise<string[]>;
40
+ /** The version a project's copy came from; null when there is no copy. */
41
+ installedVersion(dir: string, name: string): Promise<string | null>;
42
+ /** Installs one bundled document, or throws naming what there is. */
43
+ add(name: string, dir: string): Promise<void>;
44
+ /**
45
+ * Refreshes the bundled documents a project already has and returns their
46
+ * names. Never adds one: a document someone chose not to install should
47
+ * not arrive by way of an update.
48
+ */
49
+ update(dir: string): Promise<string[]>;
50
+ private copy;
51
+ }