tewip-ai 0.4.0 → 0.6.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/QUICKSTART.md +2 -1
- package/README.md +85 -5
- package/TEAM-GUIDE.md +250 -234
- package/dist/ci/gate.js +37 -0
- package/dist/cli/tewip.js +161 -3
- package/dist/engine/autofix/code-command.js +109 -0
- package/dist/engine/autofix/code-fix.js +216 -0
- package/dist/engine/autofix/code-propose.js +39 -0
- package/dist/engine/autofix/code-target.js +193 -0
- package/dist/engine/autofix/data.js +73 -0
- package/dist/engine/autofix/fix-data.js +70 -0
- package/dist/engine/autofix/fix-wait.js +68 -0
- package/dist/engine/autofix/line-diff.js +110 -0
- package/dist/engine/autofix/waits.js +83 -0
- package/dist/engine/ci/gitlab.js +63 -0
- package/dist/engine/ci/platform.js +140 -0
- package/dist/engine/ci/report-command.js +96 -0
- package/dist/engine/design/design-command.js +83 -0
- package/dist/engine/design/drift.js +141 -0
- package/dist/engine/design/figma.js +83 -0
- package/dist/engine/design/frame.js +157 -0
- package/dist/engine/import/log.js +66 -0
- package/dist/engine/infra-errors.js +62 -0
- package/dist/engine/notify/chat.js +85 -0
- package/dist/engine/notify/note-command.js +76 -0
- package/dist/engine/quality/frameworks.js +10 -9
- package/dist/engine/quality/mutation.js +158 -0
- package/dist/engine/quality/write-command.js +3 -2
- package/dist/engine/quality/write-verify.js +27 -1
- package/dist/engine/rules.js +21 -1
- package/dist/engine/spec/spec-command.js +85 -0
- package/dist/engine/spec/spec-render.js +65 -0
- package/dist/engine/spec/spec.js +114 -0
- package/dist/engine/watch/watch-command.js +160 -0
- package/dist/engine/work/jira-command.js +93 -0
- package/dist/engine/work/jira.js +105 -0
- package/dist/scripts/explain.js +11 -4
- package/package.json +1 -1
package/QUICKSTART.md
CHANGED
|
@@ -27,7 +27,8 @@ If your config already uses a reporter list in CI, add `['blob']` to it.
|
|
|
27
27
|
```yaml
|
|
28
28
|
permissions:
|
|
29
29
|
pull-requests: write # the diagnosis comment
|
|
30
|
-
issues: write
|
|
30
|
+
issues: write
|
|
31
|
+
actions: read # so it can read a failed job's log when no report was written # the grouped environment issue
|
|
31
32
|
contents: write # only if you turn autofix on
|
|
32
33
|
|
|
33
34
|
steps:
|
package/README.md
CHANGED
|
@@ -6,10 +6,10 @@ It works for every stack: Node.js (node:test, Jest, Vitest, Mocha), Python (pyte
|
|
|
6
6
|
|
|
7
7
|
| Where | How |
|
|
8
8
|
|---|---|
|
|
9
|
-
| **Terminal** | `npm install -g tewip
|
|
9
|
+
| **Terminal** | `npm install -g tewip-ai`, then `tewip explain report.xml`, `tewip ci owner/repo --pr 12`, `tewip mcp` |
|
|
10
10
|
| **VS Code, Cursor, Windsurf, VSCodium** | the Tewip extension: registers Tewip with the editor's AI assistant and adds *Explain a test report* and *Why did CI fail on this branch?* |
|
|
11
11
|
| **JetBrains, Claude, other AI assistants** | add the MCP server `tewip mcp` (see [editor setup](#use-it-from-your-editor-any-ide-that-speaks-mcp)) |
|
|
12
|
-
| **Any model** | OpenAI, Claude, Gemini, Azure, or a model on your own machine with Ollama (no account, nothing leaves the computer): `TEWIP_PROVIDER` |
|
|
12
|
+
| **Any model** | OpenAI, Claude, Gemini, Azure, or a model on your own machine with Ollama (no account, nothing leaves the computer): `TEWIP_PROVIDER` |
|
|
13
13
|
| **GitHub CI** | the Tewip Action: a comment on every pull request, an optional merge gate, verified fix PRs ([QUICKSTART](QUICKSTART.md)) |
|
|
14
14
|
|
|
15
15
|
Formerly *triage-agent*: the repository moved to `hmamut39/tewip`, and GitHub redirects the old address. See [ROADMAP.md](ROADMAP.md) for the plan.
|
|
@@ -18,8 +18,8 @@ Formerly *triage-agent*: the repository moved to `hmamut39/tewip`, and GitHub re
|
|
|
18
18
|
|
|
19
19
|
## Use it in your project
|
|
20
20
|
|
|
21
|
-
**Giving it to your team (or another company): [TEAM-GUIDE.md](TEAM-GUIDE.md)** — what to install, what each role uses it for, and what it never does.
|
|
22
|
-
|
|
21
|
+
**Giving it to your team (or another company): [TEAM-GUIDE.md](TEAM-GUIDE.md)** — what to install, what each role uses it for, and what it never does.
|
|
22
|
+
|
|
23
23
|
**Putting it on a real repository: [QUICKSTART.md](QUICKSTART.md)** — ten minutes, copy-paste, and what to check on the first failing run.
|
|
24
24
|
|
|
25
25
|
### 1. In GitHub CI (developers, SDETs, DevOps)
|
|
@@ -39,6 +39,7 @@ permissions:
|
|
|
39
39
|
contents: write # only needed for autofix
|
|
40
40
|
pull-requests: write
|
|
41
41
|
issues: write
|
|
42
|
+
actions: read # lets it read the failed job's log when no test report was written
|
|
42
43
|
|
|
43
44
|
steps:
|
|
44
45
|
# ... checkout, install, npx playwright test ...
|
|
@@ -56,6 +57,7 @@ On every run, the action:
|
|
|
56
57
|
- **DevOps:** collects environment failures (server errors, connection resets, outages) in **one** GitHub issue, and each new run adds a single grouped comment to it.
|
|
57
58
|
- **Fixes (`autofix: true`):** for drifted locators that the deterministic rule matched to a renamed element, it rewrites the locator, re-runs that test, and opens a separate pull request with the changes that passed. It never merges and never edits application code.
|
|
58
59
|
- **Every role:** uploads all role views as the `tewip-report` artifact.
|
|
60
|
+
- **When the job dies before any test runs** (an image that would not pull, a runner out of disk, a service container that never came up): it reads the failed job's log and names the cause, instead of leaving a red X with no explanation.
|
|
59
61
|
- **History:** keeps the run history in the Actions cache, never in git.
|
|
60
62
|
- **Corrections:** reply to the agent's comment with `/triage CATEGORY #n reason` (e.g. `/triage TIMING #2 flaky on CI`). It stores that with the history and, next time that test fails the same way, gives the person's answer instead of its own, naming them and their reason. A corrected failure also costs nothing: it never goes to the model again.
|
|
61
63
|
|
|
@@ -89,7 +91,7 @@ The repository needs "Allow GitHub Actions to create and approve pull requests"
|
|
|
89
91
|
| "What should I fix first from the last run?" | `triage_board` (SDET) · `pr_impact` (developer) |
|
|
90
92
|
| "Is the test environment broken?" | `environment_report` (DevOps / SRE) |
|
|
91
93
|
| "Can we release?" | `release_readiness` (business / UAT) |
|
|
92
|
-
| "Where is our test suite fragile?" | `quality_report` (senior / principal) · `architecture_report` (architect) · `risk_digest` (lead) |
|
|
94
|
+
| "Where is our test suite fragile?" | `quality_report` (senior / principal) · `architecture_report` (architect) · `risk_digest` (lead) |
|
|
93
95
|
| "Write a test plan for the checkout feature in C:\work\shop" | `test_plan`: risks and scenarios grounded in that project's tests, code and pages; saved in its `.tewip` folder |
|
|
94
96
|
|
|
95
97
|
Setup, after `npm install`:
|
|
@@ -143,6 +145,84 @@ tewip write --only CO-002,CO-004 --framework pytest
|
|
|
143
145
|
- **`tewip plan`** reads what is really there: the tests you already have (in any language), the change (`--diff main...HEAD`), the live pages (what a user sees on each page, via Playwright), and the failures Tewip has diagnosed in this project before. The plan lists risks and scenarios by priority. A claim that a scenario is "already covered" is checked against your real test names, and dropped if no such test exists. Saved to `.tewip/plans/` as Markdown to review and JSON for `write`.
|
|
144
146
|
- **`tewip write`** writes each scenario as a test in **your** framework and style: Playwright, Cypress, WebdriverIO, Angular, Jest, Vitest, pytest (with Selenium or Playwright), JUnit on Maven or Gradle (Selenium, Spring Boot), .NET or Go. It copies the style of an existing test and uses only elements seen on the real page. Front-end apps get component tests the way their own tests are written: React, Vue or Svelte with Testing Library under Jest or Vitest, and Angular through `ng test` (Karma and Jasmine, or Vitest). A project with both e2e and unit tests gets browser tests when the plan read pages, and unit or component tests when it did not. Then it runs the test. A draft is **kept only if** it passes every run (3 by default) **and** fails once its main check is broken on purpose, because a test that cannot fail is worse than no test. A failing draft is repaired from the real error, twice at most. If the test looks right and the app does something else, Tewip reports a **possible bug** instead of weakening the test until it passes. Kept tests are new files beside yours, for you to review and commit; nothing is committed, and no application code is touched.
|
|
145
147
|
|
|
148
|
+
## Check the page against the design (Phase 11, new)
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
tewip design "https://www.figma.com/design/KEY/Checkout?node-id=12-34" --url http://localhost:3000/checkout
|
|
152
|
+
tewip design frame.json --frame "Sign in" # a saved frame, no Figma token needed
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
Tewip reads the frame (Figma's REST API, read only, `TEWIP_FIGMA_TOKEN`) and the running page
|
|
156
|
+
(its accessibility snapshot, which is what a screen reader and a test both see), and says where they
|
|
157
|
+
disagree: `the design says button "Sign in", the page says button "Log in"`. It checks the words the
|
|
158
|
+
design specifies, the controls its layer names imply, and the regions its sections imply - never
|
|
159
|
+
pixels, colours or spacing, because a design tool and a browser do not measure those the same way.
|
|
160
|
+
No model is called, so it costs nothing and answers the same way every time.
|
|
161
|
+
|
|
162
|
+
Measured on four real design/page pairs (a public repository's Figma exports and the pages built
|
|
163
|
+
from them): 38 checks, **0 differences reported on pages that match their design**, and **8 of 8
|
|
164
|
+
injected drifts caught** - a renamed button, a dropped sentence, a region that stopped being marked
|
|
165
|
+
up. No designer has judged the output yet, so the roadmap's own metric is still open.
|
|
166
|
+
|
|
167
|
+
## Epics, stories and acceptance criteria (Phase 14, new)
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
tewip spec "Readers can search the library and open a result"
|
|
171
|
+
tewip spec "..." --project PROJ # shows what it would file in Jira
|
|
172
|
+
tewip spec "..." --project PROJ --create # files the epic and its stories
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
An epic, user stories and Given / When / Then acceptance criteria, written from your code, your
|
|
176
|
+
tests and your failure history. Anything it says the system **already** does carries a quote from a
|
|
177
|
+
file it read, and Tewip checks that quote word by word; what it cannot quote becomes an open
|
|
178
|
+
question instead of a confident sentence. It writes no estimates, dates or business cases, because
|
|
179
|
+
it cannot check them.
|
|
180
|
+
|
|
181
|
+
Measured on three real projects: 15 stories, 49 acceptance criteria, and of 46 claims about existing
|
|
182
|
+
behaviour, **22 were kept with a checkable quote and 24 were turned into open questions**.
|
|
183
|
+
|
|
184
|
+
## Any CI, your chat, and your own machine (Phase 13, new)
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
tewip report report.xml --gate # GitLab CI, Jenkins, CircleCI, Azure, Bitbucket, Travis, Drone
|
|
188
|
+
tewip watch --cmd "npm test" # beside your editor: explains each failure as it happens
|
|
189
|
+
tewip note --days 7 # the weekly quality note for a lead - free, no model calls
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
`tewip report` reads which CI it is in from that platform's own variables, prints the triage board,
|
|
193
|
+
writes it to a file, appends it to the job summary, and with `--gate` fails the build **only** on
|
|
194
|
+
failures that are not known flaky or environment noise. On GitLab it posts the diagnosis as one
|
|
195
|
+
merge-request note and edits that same note next run instead of piling up. With
|
|
196
|
+
`TEWIP_SLACK_WEBHOOK` or `TEWIP_TEAMS_WEBHOOK` it tells the team's chat - and says nothing at all
|
|
197
|
+
when no failure needs a person, so nobody mutes it.
|
|
198
|
+
|
|
199
|
+
## Fix the code, but only when the tests prove it (Phase 12, new, opt-in)
|
|
200
|
+
|
|
201
|
+
```bash
|
|
202
|
+
tewip fix --code report.xml # shows the patch; your files are left as they were
|
|
203
|
+
tewip fix --code report.xml --apply # leaves the proved change in your working tree
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
Tewip has refused to touch application code since day one. This is the one exception, and it only
|
|
207
|
+
runs when you type `--code`. It takes a failure **it** diagnosed as a real bug (0.85 confidence or
|
|
208
|
+
more), finds the file the failure points at, asks for the smallest change, and then proves it: the
|
|
209
|
+
failing test must pass **and** the whole suite must still pass. It will not edit tests,
|
|
210
|
+
configuration, CI files, lockfiles, migrations or anything with secrets in it, because a test going
|
|
211
|
+
green after changing those proves nothing. If it cannot prove a change, it explains the bug instead
|
|
212
|
+
and puts your file back byte for byte. It never commits and never merges.
|
|
213
|
+
|
|
214
|
+
Measured by replaying **16 real bug fixes** from two public repositories, in two languages: the
|
|
215
|
+
commit before each fix, with only that fix's tests, so the real bug really reproduces.
|
|
216
|
+
|
|
217
|
+
| Project | Language | Bugs | Proved by the tests | Right file |
|
|
218
|
+
|---|---|---|---|---|
|
|
219
|
+
| unjs/ufo | TypeScript, Vitest | 8 | **8** | 8 of 8 |
|
|
220
|
+
| python-humanize/humanize | Python, pytest | 8 | **8** | 8 of 8 |
|
|
221
|
+
|
|
222
|
+
Every change is small (1 to 16 lines, median 4) and most are what the developers themselves wrote.
|
|
223
|
+
**No wrong fix was offered**: anything that could not be proved was thrown away and the file put
|
|
224
|
+
back byte for byte.
|
|
225
|
+
|
|
146
226
|
## Where it has been tried
|
|
147
227
|
|
|
148
228
|
| Project | How | Result |
|