@brainervirus/workit-core 2.7.0 → 2.8.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/package.json
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
],
|
|
13
13
|
"workit-cli": [
|
|
14
14
|
"@alcalzone/ansi-tokenize",
|
|
15
|
+
"@babel/parser",
|
|
15
16
|
"@inkjs/ui",
|
|
16
17
|
"@openclaw/fs-safe",
|
|
17
18
|
"ansi-escapes",
|
|
@@ -87,6 +88,7 @@
|
|
|
87
88
|
"workit-pi": ["@openclaw/fs-safe", "zod"],
|
|
88
89
|
"workit-claude-code": [
|
|
89
90
|
"@alcalzone/ansi-tokenize",
|
|
91
|
+
"@babel/parser",
|
|
90
92
|
"@inkjs/ui",
|
|
91
93
|
"@openclaw/fs-safe",
|
|
92
94
|
"ansi-escapes",
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: workit-bdd
|
|
3
|
+
description: Use when turning a requirement, issue or acceptance criterion into tests, or when tests should read as behavior (Given/When/Then, BDD, scenarios, acceptance tests, test names and seams)
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Behavior first: Given/When/Then
|
|
7
|
+
|
|
8
|
+
Write each acceptance criterion as Given/When/Then before any code, then let
|
|
9
|
+
it name the test and pick the seam. This skill shapes the scenarios; the
|
|
10
|
+
RED/GREEN loop itself is workit-behavioral-tdd.
|
|
11
|
+
|
|
12
|
+
## Method
|
|
13
|
+
|
|
14
|
+
1. Write the scenarios. One behavior per scenario, in the user's or caller's
|
|
15
|
+
words: `Given <state>, When <action>, Then <observable result>`. Include the
|
|
16
|
+
unhappy paths a caller depends on (denied, empty, invalid, timeout).
|
|
17
|
+
2. Agree the seams. Pick the highest stable interface the scenario can be
|
|
18
|
+
observed through: a CLI verb, a public function, an HTTP route. Ideally one
|
|
19
|
+
seam per feature. Write the seams down; do not test at an unagreed seam.
|
|
20
|
+
3. Name the tests after the scenarios. The test name is the Given/When/Then
|
|
21
|
+
sentence; the body is arrange (Given), act (When), assert (Then). Expected
|
|
22
|
+
values come from the scenario (a literal from a worked example or the
|
|
23
|
+
spec), never from the code.
|
|
24
|
+
4. Use Gherkin only where the repo already does (`.feature` files with
|
|
25
|
+
playwright-bdd, cucumber, jest-cucumber). Otherwise plain test names carry
|
|
26
|
+
the scenario; do not add a BDD framework.
|
|
27
|
+
5. Build in vertical slices, one scenario at a time, with
|
|
28
|
+
workit-behavioral-tdd: run `workit check test` RED for the new scenario,
|
|
29
|
+
make the smallest change, run `workit check test` GREEN, then the next.
|
|
30
|
+
6. Mock only at system boundaries: network, clock, randomness, other
|
|
31
|
+
processes, sometimes the filesystem. Never the unit or its internal
|
|
32
|
+
collaborators; use the real thing or an in-memory adapter behind a port.
|
|
33
|
+
|
|
34
|
+
## Completion
|
|
35
|
+
|
|
36
|
+
Every acceptance criterion maps to a named test at an agreed seam, each was
|
|
37
|
+
seen RED then GREEN through `workit check test`, and the new tests have no
|
|
38
|
+
tautologies:
|
|
39
|
+
|
|
40
|
+
```sh
|
|
41
|
+
workit test-audit --diff && workit check test
|
|
42
|
+
```
|
|
@@ -39,6 +39,8 @@ Use this method when assessment selects the `testing` dimension.
|
|
|
39
39
|
ghost loops (assert inside a possibly-empty loop), smoke-only renders,
|
|
40
40
|
type-only or CSS-class coupling. If the test still passes when every
|
|
41
41
|
imported function returns undefined, rewrite the assertion or delete it.
|
|
42
|
+
`workit test-audit --diff` flags these; triage them with workit-test-audit.
|
|
43
|
+
Turning acceptance criteria into scenarios and seams is workit-bdd.
|
|
42
44
|
|
|
43
45
|
Run RED/GREEN through `workit check`, which records the observed result on the
|
|
44
46
|
current task; shared `evidence` operations are for notes and non-test evidence.
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: workit-test-audit
|
|
3
|
+
description: Use when tests may be tautological, low-value or noisy, before trusting a green suite, when reviewing tests an agent wrote, or when asked to clean up, prune or strengthen tests
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Audit tests for tautologies
|
|
7
|
+
|
|
8
|
+
A tautological test recomputes its expected value the way the code does, so it
|
|
9
|
+
passes by construction and can never disagree with the code. Find those and
|
|
10
|
+
other low-value tests and triage each one. The audit is advice: never delete
|
|
11
|
+
or weaken a test to make it quiet.
|
|
12
|
+
|
|
13
|
+
## Method
|
|
14
|
+
|
|
15
|
+
1. Run the audit on the change (or the paths you were asked about):
|
|
16
|
+
`workit test-audit --diff --json` or `workit test-audit <paths> --json`.
|
|
17
|
+
Each finding has file:line, rule, severity, confidence, why and a fix.
|
|
18
|
+
Prose checks are `info`; add `--min-severity info` to see them.
|
|
19
|
+
2. Triage every finding with "Name the Break": which wrong production change
|
|
20
|
+
should make this test fail? Then choose one, and say which:
|
|
21
|
+
- Replace: keep the behavior, fix the oracle. Assert the public result
|
|
22
|
+
against an independent expected value (a literal from a worked example,
|
|
23
|
+
the spec, an external contract). Plant the bug you named, watch the new
|
|
24
|
+
test fail, then revert the plant.
|
|
25
|
+
- Keep with a reason: the value is an external contract or the finding is
|
|
26
|
+
wrong. Mark it `// workit-test-audit-ignore <rule> -- <reason>`.
|
|
27
|
+
- Remove: only `assertion-free` or `duplicate-body` tests, and only after
|
|
28
|
+
checking that no other test loses unique behavior with it.
|
|
29
|
+
3. Check the replacements catch real breaks: `workit test-audit --mutate --diff`
|
|
30
|
+
(pass `--test-cmd "<runner> {files}"` to run only the related tests). A
|
|
31
|
+
surviving mutant names a change no test notices; add the missing case.
|
|
32
|
+
4. Leave untouched tests outside the diff alone; propose that cleanup as its
|
|
33
|
+
own change.
|
|
34
|
+
|
|
35
|
+
## Completion
|
|
36
|
+
|
|
37
|
+
Every finding is triaged (replaced with a test that failed on a planted bug,
|
|
38
|
+
kept with an ignore comment and reason, or removed as above) and the configured
|
|
39
|
+
tests are green:
|
|
40
|
+
|
|
41
|
+
```sh
|
|
42
|
+
workit check test
|
|
43
|
+
```
|
package/src/core/methods.ts
CHANGED
|
@@ -171,7 +171,8 @@ target result; a local commit alone is not evidence of a requested remote push.
|
|
|
171
171
|
Skill routing: slash aliases /wk-* load on demand. Use workit-steer for a
|
|
172
172
|
substantial interruption or change of direction, workit-deslop when relevant
|
|
173
173
|
to a PR-ready endpoint, workit-green-run for failing CI, workit-blast-radius
|
|
174
|
-
when impact is uncertain,
|
|
175
|
-
choices
|
|
174
|
+
when impact is uncertain, workit-challenge for genuinely open consequential
|
|
175
|
+
choices, workit-bdd to turn acceptance criteria into Given/When/Then tests, and
|
|
176
|
+
workit-test-audit to check tests for tautologies. Load workit-plan when dependencies or handoff need durable next actions.
|
|
176
177
|
Load the skill; never act from memory of it.
|
|
177
178
|
`.trim();
|
|
@@ -16,6 +16,8 @@ export const WORKIT_METHOD_SKILLS = [
|
|
|
16
16
|
"workit-mockup",
|
|
17
17
|
"workit-green-run",
|
|
18
18
|
"workit-steer",
|
|
19
|
+
"workit-bdd",
|
|
20
|
+
"workit-test-audit",
|
|
19
21
|
] as const;
|
|
20
22
|
|
|
21
23
|
/** wk- slash aliases (one per skill): alias → method skill. An alias routes
|
|
@@ -35,6 +37,8 @@ export const WORKIT_SKILL_ALIASES = {
|
|
|
35
37
|
"wk-mockup": "workit-mockup",
|
|
36
38
|
"wk-green-run": "workit-green-run",
|
|
37
39
|
"wk-steer": "workit-steer",
|
|
40
|
+
"wk-bdd": "workit-bdd",
|
|
41
|
+
"wk-test-audit": "workit-test-audit",
|
|
38
42
|
} as const;
|
|
39
43
|
|
|
40
44
|
export const skillManifestNames = (root: string): string[] =>
|