@brainervirus/workit-cursor 2.6.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/.cursor-plugin/plugin.json +1 -1
- package/commands/wk-bdd.md +7 -0
- package/commands/wk-test-audit.md +7 -0
- package/dist/cursor-session-start.js +608 -72
- package/dist/mcp-server.js +628 -112
- package/dist/workit-hook.js +615 -69
- package/package.json +3 -3
- package/skills/workit-bdd/SKILL.md +42 -0
- package/skills/workit-behavioral-tdd/SKILL.md +17 -9
- package/skills/workit-debug/SKILL.md +2 -1
- package/skills/workit-test-audit/SKILL.md +43 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brainervirus/workit-cursor",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.8.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Workit Cursor plugin — shared MCP transport, native hooks, and fourteen method skills",
|
|
6
6
|
"keywords": [
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
"build": "bun scripts/build.ts"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@brainervirus/workit-core": "^2.
|
|
48
|
-
"@brainervirus/workit-mcp": "^2.
|
|
47
|
+
"@brainervirus/workit-core": "^2.8.0",
|
|
48
|
+
"@brainervirus/workit-mcp": "^2.8.0"
|
|
49
49
|
},
|
|
50
50
|
"engines": {
|
|
51
51
|
"node": ">=24"
|
|
@@ -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
|
+
```
|
|
@@ -16,12 +16,16 @@ Use this method when assessment selects the `testing` dimension.
|
|
|
16
16
|
2. State one behavior and its observable result. Choose the narrowest stable
|
|
17
17
|
boundary a caller or user depends on; avoid private helpers and incidental
|
|
18
18
|
representations.
|
|
19
|
-
3. Write one vertical RED slice that fails for the missing behavior
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
19
|
+
3. Write one vertical RED slice that fails for the missing behavior and run it
|
|
20
|
+
through the CLI so the failure is observed: `workit check test` (the repo's
|
|
21
|
+
configured `test` check; `npx -y @brainervirus/workit-cli check test` when
|
|
22
|
+
`workit` is not on PATH). Implement the smallest change, then run the same
|
|
23
|
+
check GREEN. Close accepts only a fresh passing run of the configured check
|
|
24
|
+
that `workit check` observed; a recorded "tests pass" is a note, and an
|
|
25
|
+
ad-hoc `workit check -- <cmd>` never satisfies the gate. If no `test` check
|
|
26
|
+
is configured or detected, add `workit.checks.json` (committed) with it.
|
|
27
|
+
4. Add only another slice for a distinct behavior or risk. Any edit makes the
|
|
28
|
+
observed check stale: re-run `workit check test` before closing.
|
|
25
29
|
|
|
26
30
|
## Reject noisy tests
|
|
27
31
|
|
|
@@ -35,9 +39,13 @@ Use this method when assessment selects the `testing` dimension.
|
|
|
35
39
|
ghost loops (assert inside a possibly-empty loop), smoke-only renders,
|
|
36
40
|
type-only or CSS-class coupling. If the test still passes when every
|
|
37
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.
|
|
38
44
|
|
|
39
|
-
|
|
40
|
-
|
|
45
|
+
Run RED/GREEN through `workit check`, which records the observed result on the
|
|
46
|
+
current task; shared `evidence` operations are for notes and non-test evidence.
|
|
47
|
+
Do not add a second lifecycle, approval chain, or test workflow outside the
|
|
48
|
+
current task state.
|
|
41
49
|
|
|
42
50
|
## Common mistakes
|
|
43
51
|
|
|
@@ -45,4 +53,4 @@ lifecycle, approval chain, or test workflow outside the current task state.
|
|
|
45
53
|
| --- | --- |
|
|
46
54
|
| "The pin changed, so assert the new string" | Exercise the affected consumer behavior. |
|
|
47
55
|
| "The code is obvious" | A small vertical slice still proves the contract. |
|
|
48
|
-
| Keeping a passing test after the boundary moved |
|
|
56
|
+
| Keeping a passing test after the boundary moved | Re-run `workit check test` on the current tree. |
|
|
@@ -19,7 +19,8 @@ established root cause.
|
|
|
19
19
|
inferences, and unknowns with references; trace the failing value and all
|
|
20
20
|
relevant callers before editing.
|
|
21
21
|
3. State the root-cause hypothesis and the smallest in-scope fix. Write a focused
|
|
22
|
-
regression at the boundary when practical, then run RED and GREEN
|
|
22
|
+
regression at the boundary when practical, then run RED and GREEN through
|
|
23
|
+
`workit check <name>` so the results are observed, not reported.
|
|
23
24
|
4. Acquire writer authority through `writer` before mutation. Reconcile the
|
|
24
25
|
candidate, evidence, and findings after the change; investigate sibling paths
|
|
25
26
|
and stale conclusions rather than assuming the first patch worked.
|
|
@@ -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
|
+
```
|