@isummation/kasauti-cli 0.2.0 → 0.4.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/README.md +151 -6
- package/kasauti.mjs +45 -3
- package/package.json +7 -3
- package/plugin/.claude-plugin/marketplace.json +15 -0
- package/plugin/kasauti/.claude-plugin/plugin.json +8 -0
- package/plugin/kasauti/.mcp.json +9 -0
- package/plugin/kasauti/AGENTS.md +19 -0
- package/plugin/kasauti/skills/explore-screen/SKILL.md +53 -0
- package/plugin/kasauti/skills/fix-defects/SKILL.md +37 -0
- package/plugin/kasauti/skills/run-tests/SKILL.md +41 -0
package/README.md
CHANGED
|
@@ -1,12 +1,157 @@
|
|
|
1
1
|
# @isummation/kasauti-cli
|
|
2
2
|
|
|
3
|
-
Command line for
|
|
3
|
+
Command line for **Kasauti** test management, and the **Kasauti plugin for Claude Code**.
|
|
4
|
+
|
|
5
|
+
- People and scripts use the `kasauti` command to explore, write and run test cases and to report and fix defects.
|
|
6
|
+
- Claude Code gets the Kasauti tools (MCP) and three playbooks: explore a screen into test cases, run tests, fix defects.
|
|
7
|
+
|
|
8
|
+
Output is Markdown, which people and AI agents both read easily; add `--json` for scripts. Needs Node.js 20 or later; no dependencies.
|
|
9
|
+
|
|
10
|
+
## Install
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm install -g @isummation/kasauti-cli
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Or run it once without installing: `npx @isummation/kasauti-cli --help`.
|
|
17
|
+
|
|
18
|
+
## What you need from Kasauti
|
|
19
|
+
|
|
20
|
+
- **The API URL**, for example `https://kasauti-api.your-company.com`. It's the API's address, not the web app's; your Kasauti admin can tell you, and the web app shows it under **Settings → API tokens & agents**.
|
|
21
|
+
- **A token**, created in the web app under **Settings → API tokens & agents**. It is shown once, so copy it then.
|
|
22
|
+
- **Personal** token: for the `kasauti` command as yourself, and for CI.
|
|
23
|
+
- **Agent** token: for Claude Code. Everything it writes is marked as the agent, its test cases start as drafts for a person to approve, and it can't verify fixes.
|
|
24
|
+
- A token works only on the Kasauti server it was created on, and has your role there (tester or developer).
|
|
25
|
+
|
|
26
|
+
## Use the CLI
|
|
4
27
|
|
|
5
28
|
```bash
|
|
6
|
-
|
|
7
|
-
kasauti
|
|
8
|
-
kasauti
|
|
9
|
-
kasauti
|
|
29
|
+
kasauti login https://kasauti-api.your-company.com --token <personal token> # saved to ~/.kasauti.json, readable only by you
|
|
30
|
+
kasauti whoami
|
|
31
|
+
kasauti projects
|
|
32
|
+
kasauti map SHOP # screens / endpoints with coverage and open defects
|
|
33
|
+
kasauti get SHOP-D7 # anything by key, with full context
|
|
34
|
+
kasauti defects SHOP --mine
|
|
35
|
+
kasauti result SHOP-R5 SHOP-12 failed -m "Total shows twice" --attach shot.png
|
|
36
|
+
kasauti --help # every command
|
|
10
37
|
```
|
|
11
38
|
|
|
12
|
-
|
|
39
|
+
Keys name everything. The letter after the project code says what a key is:
|
|
40
|
+
|
|
41
|
+
| Key | What it is |
|
|
42
|
+
|---|---|
|
|
43
|
+
| `SHOP-12` | test case (no letter) |
|
|
44
|
+
| `SHOP-A3` | area: a screen, endpoint or module |
|
|
45
|
+
| `SHOP-SC4` | scenario: a user goal |
|
|
46
|
+
| `SHOP-R5` | run: cases being executed |
|
|
47
|
+
| `SHOP-P2` | plan: a saved set of cases |
|
|
48
|
+
| `SHOP-M1` | milestone |
|
|
49
|
+
| `SHOP-D7` | defect |
|
|
50
|
+
|
|
51
|
+
`KASAUTI_URL` and `KASAUTI_TOKEN` in the environment take precedence over the saved login. CI uses them: store both as secret CI variables and no login step is needed.
|
|
52
|
+
|
|
53
|
+
## Connect Claude Code
|
|
54
|
+
|
|
55
|
+
**1. Install the plugin**
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
kasauti plugin install # for all your projects; --scope local for the current project only
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
This runs `claude plugin marketplace add` and `claude plugin install` for the copy of the plugin inside this package. If the `claude` command isn't on your PATH, it prints the two commands to run yourself.
|
|
62
|
+
|
|
63
|
+
**2. Give Claude Code the URL and an agent token.** The plugin reads them from two environment variables, `KASAUTI_URL` and `KASAUTI_TOKEN`. `kasauti login` does **not** set them: it only configures the `kasauti` command. Without them, the plugin calls `http://localhost:3001` with no token.
|
|
64
|
+
|
|
65
|
+
Set them where Claude Code starts. The commands below ask for the token without showing it, so it stays out of your shell history.
|
|
66
|
+
|
|
67
|
+
- **Linux, WSL, macOS with bash**: add them to `~/.bashrc`:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
read -rsp "Kasauti agent token: " T && printf '\nexport KASAUTI_URL=https://kasauti-api.your-company.com\nexport KASAUTI_TOKEN=%s\n' "$T" >> ~/.bashrc && unset T && echo
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
- **macOS with zsh (the default)**: the same command with `~/.zshrc` instead of `~/.bashrc`.
|
|
74
|
+
|
|
75
|
+
- **fish**:
|
|
76
|
+
|
|
77
|
+
```fish
|
|
78
|
+
set -Ux KASAUTI_URL https://kasauti-api.your-company.com
|
|
79
|
+
read -s -P "Kasauti agent token: " T; and set -Ux KASAUTI_TOKEN $T; and set -e T
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
- **Windows (Claude Code running on Windows itself, in PowerShell)**:
|
|
83
|
+
|
|
84
|
+
```powershell
|
|
85
|
+
[Environment]::SetEnvironmentVariable('KASAUTI_URL', 'https://kasauti-api.your-company.com', 'User')
|
|
86
|
+
$t = Read-Host 'Kasauti agent token' -AsSecureString
|
|
87
|
+
[Environment]::SetEnvironmentVariable('KASAUTI_TOKEN', [Net.NetworkCredential]::new('', $t).Password, 'User'); Remove-Variable t
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
If you use Claude Code inside **WSL** (including VS Code connected to WSL), use the bash setup above instead: Windows variables don't reach it.
|
|
91
|
+
|
|
92
|
+
To change a value later, edit the line in that file rather than running the command again, which would add a second copy.
|
|
93
|
+
|
|
94
|
+
**3. Restart Claude Code.** It reads the variables only when it starts. In a terminal, open a new one. In **VS Code** (and other editors), close every window and reopen the editor; reloading a window isn't enough. For VS Code with WSL, if it still shows the old state, run `wsl --shutdown` in Windows and reopen.
|
|
95
|
+
|
|
96
|
+
**4. Check.** In Claude Code, run `/mcp`: `kasauti` should show as connected. Then ask *"List my Kasauti projects"*. In a terminal, `echo $KASAUTI_URL` should print your URL.
|
|
97
|
+
|
|
98
|
+
### Keep an agent to one project
|
|
99
|
+
|
|
100
|
+
If you're on several projects, give each repository its own token **limited to that project**. The agent then can't read or change any other project, even by mistake: other projects don't exist for that token, and it can't create tokens or do admin work.
|
|
101
|
+
|
|
102
|
+
1. Create the token in the web app (**Settings → API tokens & agents**, pick the project), or with the CLI:
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
kasauti token claude-code-shop --agent claude-code --project SHOP
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
2. Put it in the repository's `.claude/settings.local.json`. Claude Code applies its `env` only in this repository, over the variables from your shell, so your other repositories keep their own tokens:
|
|
109
|
+
|
|
110
|
+
```json
|
|
111
|
+
{
|
|
112
|
+
"env": {
|
|
113
|
+
"KASAUTI_URL": "https://kasauti-api.your-company.com",
|
|
114
|
+
"KASAUTI_TOKEN": "kst_…"
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
`settings.local.json` is for you alone: Claude Code adds it to the repository's `.gitignore` when it creates the file. Check it is ignored before you save a token in it; never put a token in the shared `.claude/settings.json`.
|
|
120
|
+
|
|
121
|
+
3. Restart Claude Code in that repository and run `/mcp`. Asking *"List my Kasauti projects"* should show only that project.
|
|
122
|
+
|
|
123
|
+
Deleting the project deletes its tokens. Revoke a token under **Settings → API tokens & agents**.
|
|
124
|
+
|
|
125
|
+
### Update
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
npm update -g @isummation/kasauti-cli
|
|
129
|
+
kasauti plugin update
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
Claude Code loads the plugin from the npm install folder, so the next session uses the new version. Switching Node.js versions (nvm, fnm, volta) moves that folder: install the CLI for the new version and run `kasauti plugin install` again.
|
|
133
|
+
|
|
134
|
+
### Remove
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
claude plugin uninstall kasauti@kasauti
|
|
138
|
+
claude plugin marketplace remove kasauti
|
|
139
|
+
npm uninstall -g @isummation/kasauti-cli
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### Without the plugin (Cursor and other MCP clients)
|
|
143
|
+
|
|
144
|
+
Kasauti is a standard MCP server over HTTP: URL `<KASAUTI_URL>/mcp`, header `Authorization: Bearer <agent token>`. `kasauti mcp-config` prints the Claude Code command for your settings. You get the tools, without the playbooks.
|
|
145
|
+
|
|
146
|
+
## Troubleshooting
|
|
147
|
+
|
|
148
|
+
| What you see | Fix |
|
|
149
|
+
|---|---|
|
|
150
|
+
| `/mcp`: kasauti failed, `HTTP 401` or `Invalid or expired token` | `KASAUTI_TOKEN` isn't set where Claude Code started, was created on a different Kasauti server, or was revoked. Set it (step 2) and restart Claude Code fully. |
|
|
151
|
+
| `/mcp` shows `http://localhost:3001/mcp` | `KASAUTI_URL` isn't set where Claude Code started. Set it and restart Claude Code fully. |
|
|
152
|
+
| `Error 401` from `kasauti` | Log in again with a valid token, or check the `KASAUTI_TOKEN` you exported. |
|
|
153
|
+
| `Error 404` for a project that exists | You aren't assigned to it; ask a Kasauti admin. |
|
|
154
|
+
| `Error 403 … needs the tester role` or `needs a human` | Your role can't do that; agent tokens can't verify fixes or approve drafts. |
|
|
155
|
+
| `Cannot reach …` | Wrong `KASAUTI_URL` (use the API address), or no network route to it. |
|
|
156
|
+
| `kasauti plugin install`: `No bundled plugin here` | The `kasauti` on your PATH isn't this npm package. Run `npm install -g @isummation/kasauti-cli`. |
|
|
157
|
+
| The plugin vanished after switching Node.js versions | Run `kasauti plugin install` again. |
|
package/kasauti.mjs
CHANGED
|
@@ -5,14 +5,18 @@ import { parseArgs } from 'node:util';
|
|
|
5
5
|
import { readFileSync, writeFileSync, existsSync } from 'node:fs';
|
|
6
6
|
import { homedir } from 'node:os';
|
|
7
7
|
import { basename, join, extname } from 'node:path';
|
|
8
|
+
import { spawnSync } from 'node:child_process';
|
|
9
|
+
import { fileURLToPath } from 'node:url';
|
|
8
10
|
|
|
9
11
|
const CONFIG = process.env.KASAUTI_CONFIG ?? join(homedir(), '.kasauti.json');
|
|
10
12
|
const HELP = `kasauti <command> [args] [--json]
|
|
11
13
|
|
|
12
14
|
Setup
|
|
13
15
|
login <url> --token T save URL + a personal token (Settings → API tokens) to ~/.kasauti.json
|
|
14
|
-
token <name> [--agent NAME]
|
|
16
|
+
token <name> [--agent NAME] [--project CODE] create a personal (or agent) API token, optionally limited to one project
|
|
15
17
|
whoami | projects | mcp-config
|
|
18
|
+
plugin install|update [--scope user|local] add the bundled Claude Code plugin (skills + MCP) to Claude Code
|
|
19
|
+
plugin path where the bundled plugin is, for manual setup
|
|
16
20
|
|
|
17
21
|
Explore
|
|
18
22
|
map <PROJECT> area tree with coverage and open defects
|
|
@@ -51,13 +55,14 @@ const { values: o, positionals: args } = parseArgs({
|
|
|
51
55
|
allowPositionals: true,
|
|
52
56
|
options: {
|
|
53
57
|
json: { type: 'boolean' }, help: { type: 'boolean', short: 'h' },
|
|
54
|
-
token: { type: 'string' }, agent: { type: 'string' },
|
|
58
|
+
token: { type: 'string' }, agent: { type: 'string' }, project: { type: 'string' },
|
|
55
59
|
title: { type: 'string' }, route: { type: 'string' }, kind: { type: 'string' }, parent: { type: 'string' }, notes: { type: 'string' },
|
|
56
60
|
ref: { type: 'string' }, key: { type: 'string' }, area: { type: 'string' }, scenario: { type: 'string' }, narrative: { type: 'string' },
|
|
57
61
|
type: { type: 'string' }, status: { type: 'string' }, tag: { type: 'string' }, plan: { type: 'string' }, cases: { type: 'string' },
|
|
58
62
|
env: { type: 'string' }, message: { type: 'string', short: 'm' }, attach: { type: 'string', multiple: true }, duration: { type: 'string' },
|
|
59
63
|
case: { type: 'string' }, run: { type: 'string' }, url: { type: 'string' }, actual: { type: 'string' }, expected: { type: 'string' },
|
|
60
64
|
steps: { type: 'string' }, severity: { type: 'string' }, commit: { type: 'string' }, pr: { type: 'string' }, mine: { type: 'boolean' }, force: { type: 'boolean' },
|
|
65
|
+
scope: { type: 'string' },
|
|
61
66
|
},
|
|
62
67
|
});
|
|
63
68
|
|
|
@@ -122,7 +127,7 @@ switch (cmd) {
|
|
|
122
127
|
break;
|
|
123
128
|
}
|
|
124
129
|
case 'token': {
|
|
125
|
-
const r = await api('POST', '/tokens', clean({ name: need(sub, '<name>'), kind: o.agent ? 'agent' : 'user', agentName: o.agent }), { md: false });
|
|
130
|
+
const r = await api('POST', '/tokens', clean({ name: need(sub, '<name>'), kind: o.agent ? 'agent' : 'user', agentName: o.agent, project: o.project }), { md: false });
|
|
126
131
|
print(o.json ? r : `Token (shown once): ${r.token}\nUse: export KASAUTI_TOKEN=${r.token}`);
|
|
127
132
|
break;
|
|
128
133
|
}
|
|
@@ -133,6 +138,43 @@ switch (cmd) {
|
|
|
133
138
|
print(`claude mcp add --transport http kasauti ${url}/mcp --header "Authorization: Bearer <agent token>"\n\nCreate an agent token with: kasauti token claude-code --agent claude-code`);
|
|
134
139
|
break;
|
|
135
140
|
}
|
|
141
|
+
case 'plugin': {
|
|
142
|
+
// The npm package ships the plugin as a one-plugin marketplace (see bundle-plugin.mjs), so installing it
|
|
143
|
+
// needs no access to the Kasauti git repository.
|
|
144
|
+
const dir = fileURLToPath(new URL('./plugin', import.meta.url));
|
|
145
|
+
if (!existsSync(join(dir, '.claude-plugin', 'marketplace.json'))) die('No bundled plugin here (running from a git checkout?). Install the CLI from npm: npm install -g @isummation/kasauti-cli');
|
|
146
|
+
if (sub === 'path') { print(dir); break; }
|
|
147
|
+
if (sub !== 'install' && sub !== 'update') die('Usage: kasauti plugin install|update|path [--scope user|local]');
|
|
148
|
+
// Not 'project': that would commit this machine's npm path into the repo's .claude/settings.json.
|
|
149
|
+
const scope = o.scope ?? 'user';
|
|
150
|
+
if (!['user', 'local'].includes(scope)) die('--scope must be user (all your projects) or local (this project, not committed)');
|
|
151
|
+
const steps = sub === 'install'
|
|
152
|
+
? [['plugin', 'marketplace', 'add', dir, '--scope', scope], ['plugin', 'install', 'kasauti@kasauti', '--scope', scope]]
|
|
153
|
+
: [['plugin', 'marketplace', 'update', 'kasauti'], ['plugin', 'update', 'kasauti@kasauti']];
|
|
154
|
+
const quote = (x) => (/\s/.test(x) ? `"${x}"` : x);
|
|
155
|
+
const show = (a) => `claude ${a.map(quote).join(' ')}`;
|
|
156
|
+
// claude is a .cmd shim on Windows, which only runs through a shell (so paths with spaces get quoted)
|
|
157
|
+
const win = process.platform === 'win32';
|
|
158
|
+
const claude = (a) => spawnSync('claude', win ? a.map(quote) : a, { stdio: 'inherit', shell: win });
|
|
159
|
+
const probe = spawnSync('claude', ['--version'], { stdio: 'ignore', shell: win });
|
|
160
|
+
if (probe.error || probe.status) die(`Claude Code isn't on the PATH. Install it, or run these yourself:\n${steps.map(show).join('\n')}`);
|
|
161
|
+
for (const [i, a] of steps.entries()) {
|
|
162
|
+
console.log(`$ ${show(a)}`);
|
|
163
|
+
let r = claude(a);
|
|
164
|
+
// already added (e.g. a reinstall): refresh it from the folder instead
|
|
165
|
+
if (r.status && i === 0 && sub === 'install') r = claude(['plugin', 'marketplace', 'update', 'kasauti']);
|
|
166
|
+
if (r.status) die(`Failed: ${show(a)}`);
|
|
167
|
+
}
|
|
168
|
+
// The plugin's MCP server only sees environment variables, not ~/.kasauti.json: say so when they're missing.
|
|
169
|
+
const missing = ['KASAUTI_URL', 'KASAUTI_TOKEN'].filter((v) => !process.env[v]);
|
|
170
|
+
if (missing.length)
|
|
171
|
+
console.log(`\nNot set yet: ${missing.join(', ')}. The plugin reads both from the environment (kasauti login only configures this CLI),\n` +
|
|
172
|
+
`so until then it calls http://localhost:3001 without a token. Set them, e.g. in ~/.bashrc:\n` +
|
|
173
|
+
` export KASAUTI_URL=${config().url}\n export KASAUTI_TOKEN=<an agent token from Settings → API tokens & agents>\n` +
|
|
174
|
+
`Details: https://www.npmjs.com/package/@isummation/kasauti-cli#connect-claude-code`);
|
|
175
|
+
print(`\nDone. Restart Claude Code (in VS Code: close every window), then check /mcp lists kasauti as connected.\nAfter upgrading the CLI (npm update -g @isummation/kasauti-cli), run: kasauti plugin update`);
|
|
176
|
+
break;
|
|
177
|
+
}
|
|
136
178
|
case 'map': print(await api('GET', `/projects/${need(sub, '<PROJECT>')}/map`)); break;
|
|
137
179
|
case 'get': print(await api('GET', `/k/${need(sub, '<KEY>')}`)); break;
|
|
138
180
|
case 'activity': print(await api('GET', `/projects/${need(sub, '<PROJECT>')}/activity`)); break;
|
package/package.json
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@isummation/kasauti-cli",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Kasauti test management CLI for humans, CI and AI agents",
|
|
3
|
+
"version": "0.4.0",
|
|
4
|
+
"description": "Kasauti test management CLI for humans, CI and AI agents, with the Claude Code plugin",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
7
|
"kasauti": "./kasauti.mjs"
|
|
8
8
|
},
|
|
9
9
|
"files": [
|
|
10
10
|
"kasauti.mjs",
|
|
11
|
+
"plugin",
|
|
11
12
|
"README.md"
|
|
12
13
|
],
|
|
14
|
+
"scripts": {
|
|
15
|
+
"prepack": "node bundle-plugin.mjs"
|
|
16
|
+
},
|
|
13
17
|
"engines": {
|
|
14
18
|
"node": ">=20"
|
|
15
19
|
},
|
|
@@ -19,7 +23,7 @@
|
|
|
19
23
|
"directory": "packages/cli"
|
|
20
24
|
},
|
|
21
25
|
"publishConfig": {
|
|
22
|
-
"access": "
|
|
26
|
+
"access": "public",
|
|
23
27
|
"registry": "https://registry.npmjs.org/"
|
|
24
28
|
}
|
|
25
29
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "kasauti",
|
|
3
|
+
"owner": {
|
|
4
|
+
"name": "iSummation"
|
|
5
|
+
},
|
|
6
|
+
"plugins": [
|
|
7
|
+
{
|
|
8
|
+
"name": "kasauti",
|
|
9
|
+
"source": "./kasauti",
|
|
10
|
+
"description": "Kasauti test management for AI agents",
|
|
11
|
+
"version": "0.4.0"
|
|
12
|
+
}
|
|
13
|
+
],
|
|
14
|
+
"description": "Kasauti test management plugin for Claude Code"
|
|
15
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Kasauti (test management) — instructions for AI agents
|
|
2
|
+
|
|
3
|
+
Copy this section into a product repo's `AGENTS.md` / `CLAUDE.md` / Cursor rules so any agent harness can use Kasauti.
|
|
4
|
+
|
|
5
|
+
Kasauti tracks this project's test cases, runs and defects. Use the `kasauti` MCP server (`$KASAUTI_URL/mcp`, bearer `$KASAUTI_TOKEN`)
|
|
6
|
+
or the `kasauti` CLI (`npm install -g @isummation/kasauti-cli`, then `kasauti --help`; output is Markdown, add `--json` for JSON). The project code is **DEMO** <!-- change me -->.
|
|
7
|
+
|
|
8
|
+
Keys: `DEMO-12` case · `DEMO-A3` area (screen/endpoint) · `DEMO-SC4` scenario · `DEMO-R5` run · `DEMO-D7` defect.
|
|
9
|
+
|
|
10
|
+
- **Start** with `kasauti map DEMO` (MCP `project_map`), then `kasauti get <KEY>`.
|
|
11
|
+
- **Fixing bugs:** `kasauti defects DEMO` → `kasauti defect claim DEMO-D7` → `kasauti get DEMO-D7` (repro steps, evidence, linked case)
|
|
12
|
+
→ reproduce → fix + test → commit mentioning the key → `kasauti defect resolve DEMO-D7 -m "<root cause and change>" --commit <sha>`.
|
|
13
|
+
Reopened defects first; read their comments. Can't reproduce? Comment and `kasauti defect release DEMO-D7`.
|
|
14
|
+
- **Testing a screen:** create or update the area (`kasauti area DEMO --title … --route /path`), scenarios and cases (use stable `ref`s),
|
|
15
|
+
`kasauti run start DEMO --title … --area DEMO-A3`, then `kasauti run next DEMO-R5` / `kasauti result DEMO-R5 DEMO-12 failed -m "…" --attach shot.png`,
|
|
16
|
+
and `kasauti defect report DEMO --title … --case DEMO-12 --run DEMO-R5` for failures.
|
|
17
|
+
- Long text fields are **Markdown**: numbered repro steps, `code` for values, fenced blocks for logs and stack traces. Raw HTML is not rendered. Screenshots testers paste appear as ``: download them with your token to see what they saw.
|
|
18
|
+
- **Never** mark results you didn't observe. You can't verify fixes or approve draft cases; humans do that.
|
|
19
|
+
- Your token carries its owner's role. A developer's token can claim, resolve and comment on defects; exploring and running tests needs a tester's token.
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: explore-screen
|
|
3
|
+
description: Explore a web app screen in a browser, record its scenarios and test cases in Kasauti, execute them, and report results and defects with evidence. Use when asked to "explore", "test", "find scenarios for" or "write test cases for" a page/screen/URL, or to run exploratory testing on a frontend project.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Explore a screen into Kasauti
|
|
7
|
+
|
|
8
|
+
You need two tools: a **browser** (Claude in Chrome, Playwright MCP, or `playwright-cli`) and **Kasauti** (the `kasauti` MCP tools, or the `kasauti` CLI with the same verbs). Keys look like `DEMO-A3` (area), `DEMO-SC4` (scenario), `DEMO-12` (case), `DEMO-R5` (run), `DEMO-D7` (defect).
|
|
9
|
+
|
|
10
|
+
## 1. Orient
|
|
11
|
+
1. `project_map` for the project. It returns the base URL and the areas that already exist, with their coverage. Don't re-create what's there.
|
|
12
|
+
2. If the target screen is already an area, `get` it. Read the **Agent notes** (login, test data, selectors) and the existing scenarios and cases.
|
|
13
|
+
|
|
14
|
+
## 2. Map the screen
|
|
15
|
+
3. Open the screen in the browser. If you're redirected to login, follow the area notes or ask the user.
|
|
16
|
+
4. `upsert_area` with:
|
|
17
|
+
- `title`: a human name.
|
|
18
|
+
- `route`: the URL pattern with params generalized, e.g. `/orders/:id`.
|
|
19
|
+
- `kind: screen`.
|
|
20
|
+
- `parent`: set it for nested screens.
|
|
21
|
+
- `notes`: anything the next agent needs (how to get there, required data, flaky bits).
|
|
22
|
+
5. Identify the **user goals** the screen supports, not individual widgets. Typical set: the happy path, validation and errors, empty and loading states, permissions, and navigation out. `upsert_scenario` once per goal, with a short Given/When/Then `narrative`.
|
|
23
|
+
|
|
24
|
+
## 3. Write concrete cases
|
|
25
|
+
6. `upsert_cases` in one batch per scenario. Each case should have:
|
|
26
|
+
- a `ref` that's stable across sessions, e.g. `orders-detail/cancel-confirm`;
|
|
27
|
+
- a specific `title` that states the expected behaviour;
|
|
28
|
+
- `steps` with `action`, optional `data`, and an `expected` on every step that checks something;
|
|
29
|
+
- `behavior` (positive/negative), `severity` and `layer: e2e`.
|
|
30
|
+
|
|
31
|
+
Keep cases independent and repeatable. Put setup in `preconditions`.
|
|
32
|
+
7. Your cases land as **drafts**. That's expected: a human approves them. Don't try to set `status: actual`.
|
|
33
|
+
|
|
34
|
+
## 4. Execute
|
|
35
|
+
8. `start_run` with `area` set to this screen (or `scenario`) and a descriptive title, e.g. "Exploratory: Orders detail (Chrome)".
|
|
36
|
+
9. Loop: `next_case` → do the steps in the browser → `report_result` with:
|
|
37
|
+
- `status`: passed / failed / blocked (blocked when you can't reach the precondition);
|
|
38
|
+
- `steps`: the 1-based step results, at least for the failing step;
|
|
39
|
+
- `comment`: actual vs expected, the exact error text, the URL;
|
|
40
|
+
- `attachments`: for failures, a screenshot (base64 PNG) plus console errors and failing network calls as text files.
|
|
41
|
+
10. For each failure, `report_defect` with:
|
|
42
|
+
- `case` and `run`, so the failing result and its evidence are linked;
|
|
43
|
+
- a symptom-style `title`;
|
|
44
|
+
- `actualResult`, `expected`, numbered `reproSteps`, `url`, and `environment` (browser and build).
|
|
45
|
+
|
|
46
|
+
Re-reporting the same problem is safe: it adds an occurrence, and it reopens the defect if it had been marked fixed.
|
|
47
|
+
11. Bugs you notice outside any case (console errors, broken links): file them as defects with `area` set.
|
|
48
|
+
12. `complete_run`, then summarise for the user: the area key, the scenarios and cases created, pass/fail counts, the defect keys, and anything you couldn't test.
|
|
49
|
+
|
|
50
|
+
## Rules
|
|
51
|
+
- Never guess results. If you didn't observe it, mark the case `blocked` and explain why.
|
|
52
|
+
- Don't create accounts, payments or other irreversible actions on shared environments unless the area notes say it's safe.
|
|
53
|
+
- Prefer updating existing areas, scenarios and cases (same `ref` or `key`) over creating near-duplicates.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: fix-defects
|
|
3
|
+
description: Pick up open defects from Kasauti, reproduce them, fix the code in this repository, and mark them fixed for tester verification. Use when asked to "fix open bugs/defects/issues", "work the Kasauti queue", fix a specific defect key like DEMO-D7, or handle reopened defects.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Fix Kasauti defects
|
|
7
|
+
|
|
8
|
+
Kasauti holds the bug; this repo holds the code. You move a defect from `open` to `in_progress` (claimed), then to `fixed`. A **human tester** moves it to `verified`, or reopens it. You can't verify.
|
|
9
|
+
|
|
10
|
+
## 1. Choose work
|
|
11
|
+
1. `list_defects` for the project (the default is unresolved). If the user named a key, use that one.
|
|
12
|
+
- Do reopened defects first (`reopened > 0`). Their comments say why the last fix wasn't enough.
|
|
13
|
+
- Then go by severity (blocker → critical → major).
|
|
14
|
+
2. `claim_defect` before you touch code. If it says someone else is working on it, pick another. Don't use `force` unless the user tells you to.
|
|
15
|
+
|
|
16
|
+
## 2. Understand
|
|
17
|
+
3. `get <defect key>` returns the full bundle: actual vs expected, repro steps, URL, environment, the linked case's steps, failing results with stack traces, evidence links (screenshots and logs, fetch them with the same token), and the comment thread.
|
|
18
|
+
4. Find the code behind the area/route: `get <area key>` gives the route or endpoint. Search the repo for it.
|
|
19
|
+
|
|
20
|
+
## 3. Reproduce, then fix
|
|
21
|
+
5. Reproduce first. Use a browser (Playwright MCP / `playwright-cli`) for UI bugs, or a request or failing test for APIs. If it doesn't reproduce, `comment` with what you tried and `release_defect` it. Don't mark it fixed.
|
|
22
|
+
6. Fix the root cause. Add or adjust an automated test that fails before the fix and passes after.
|
|
23
|
+
- If the project uses the Kasauti Playwright reporter, tag the test with the case key, e.g. `test('… @DEMO-12')`.
|
|
24
|
+
7. Run the relevant tests. Commit with the defect key in the message, e.g. `fix(profile): persist display name (DEMO-D7)`.
|
|
25
|
+
|
|
26
|
+
## 4. Hand back
|
|
27
|
+
8. `resolve_defect` with:
|
|
28
|
+
- `notes`: the root cause, what changed, and how to check it (one short paragraph a tester can follow);
|
|
29
|
+
- `commit`: the SHA; `prUrl` if you opened a PR.
|
|
30
|
+
|
|
31
|
+
This queues a retest of the linked case in the project's **Defect verification** run.
|
|
32
|
+
9. Tell the user which defects you moved to fixed and which you released, and why.
|
|
33
|
+
|
|
34
|
+
## Rules
|
|
35
|
+
- One defect, one focused change. Don't bundle unrelated fixes under one defect.
|
|
36
|
+
- If the "defect" is actually expected behaviour, `comment` your reasoning and leave the status for a human (they can mark it invalid).
|
|
37
|
+
- Never mark a defect fixed without running the code path.
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: run-tests
|
|
3
|
+
description: Report automated test results (Playwright, or any framework, or API checks) into Kasauti, and design API test cases from endpoints. Use for backend/API projects, CI reporting, importing an OpenAPI spec, or "run the suite and record results in Kasauti".
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Automated and API testing with Kasauti
|
|
7
|
+
|
|
8
|
+
## Playwright projects
|
|
9
|
+
Add the reporter once:
|
|
10
|
+
```ts
|
|
11
|
+
// playwright.config.ts
|
|
12
|
+
reporter: [['list'], ['@isummation/kasauti-playwright-reporter', { project: 'DEMO' }]],
|
|
13
|
+
```
|
|
14
|
+
Then run with `KASAUTI_URL` and `KASAUTI_TOKEN` set (in CI, use an agent token stored as a secret).
|
|
15
|
+
- Tests tagged with a case key (`test('login works @DEMO-12', …)`) report into that case.
|
|
16
|
+
- Untagged tests are matched by file/describe path + title. The first time they run, they're created as **draft automated cases**.
|
|
17
|
+
- Each run creates a run (`source: automation`) and completes it. Set `KASAUTI_RUN=DEMO-R5` to report into an existing run instead.
|
|
18
|
+
|
|
19
|
+
## Other frameworks
|
|
20
|
+
Post results directly, in batches of up to 1000:
|
|
21
|
+
```
|
|
22
|
+
POST /runs {"project":"DEMO","title":"CI #123","source":"automation"}
|
|
23
|
+
POST /k/DEMO-R5/results/bulk {"results":[{"case":"DEMO-12","status":"passed","durationMs":120},
|
|
24
|
+
{"title":"refund > partial","suite":"API/Refunds","status":"failed","stacktrace":"..."}]}
|
|
25
|
+
POST /k/DEMO-R5/complete
|
|
26
|
+
```
|
|
27
|
+
Statuses: passed, failed, blocked, skipped, invalid.
|
|
28
|
+
|
|
29
|
+
## Backend / API projects
|
|
30
|
+
1. Import the API surface once, and re-import when it changes (it's idempotent):
|
|
31
|
+
- `kasauti import openapi DEMO openapi.yaml`
|
|
32
|
+
|
|
33
|
+
This creates one **endpoint area** per operation (`route: "POST /orders"`), grouped under a module area per tag.
|
|
34
|
+
2. `project_map` to see the endpoints with no cases.
|
|
35
|
+
3. Per endpoint, `upsert_scenario` for the behaviours (create succeeds, validation, auth, not found, idempotency, pagination…). Then `upsert_cases` with `layer: api`. Steps are the request (`action: "POST /orders"`, `data`: the body) and `expected` is the status and key fields.
|
|
36
|
+
4. Execute with an agent run:
|
|
37
|
+
- `start_run` with `area` set to the module area;
|
|
38
|
+
- for each case, call the API (curl/fetch against the project base URL);
|
|
39
|
+
- `report_result` with the response status/body excerpt in `comment`;
|
|
40
|
+
- `report_defect` on failure (put the request/response in `actualResult`).
|
|
41
|
+
5. If you write automated tests for these cases, tag them with the case keys so CI results land on the same cases.
|