@konductro/codex-plugin 2.4.0 → 2.5.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 +20 -0
- package/package.json +1 -1
- package/servers/konductro-api.js +124 -1
- package/skills/test-pack/SKILL.md +69 -0
package/README.md
CHANGED
|
@@ -69,6 +69,7 @@ Skills are guided, multi-step workflows invoked by asking Codex naturally:
|
|
|
69
69
|
| `konductro-start-ticket` | Pick up an assigned ticket and start work |
|
|
70
70
|
| `konductro-bug-enrich` | Enrich a bug ticket with technical analysis — explores codebase and submits structured context |
|
|
71
71
|
| `konductro-demand-analysis` | Size a demand against the real code and propose the phases the forum will commit to |
|
|
72
|
+
| `konductro-test-pack` | Turn a story's acceptance criteria into Test Library cases, checked against the library, added once you approve the plan |
|
|
72
73
|
|
|
73
74
|
## Tools
|
|
74
75
|
|
|
@@ -199,6 +200,16 @@ lands in is part of the job.
|
|
|
199
200
|
| `get_bug_for_enrichment` | Load a bug ticket and project context for enrichment |
|
|
200
201
|
| `submit_bug_enrichment` | Submit structured technical enrichment for a bug ticket |
|
|
201
202
|
|
|
203
|
+
### Test Library
|
|
204
|
+
|
|
205
|
+
Writing needs the tester or SDM role on the project. Cases and steps go live in the library straight away.
|
|
206
|
+
|
|
207
|
+
| Tool | What it does |
|
|
208
|
+
|---|---|
|
|
209
|
+
| `get_story_test_context` | Load a story's acceptance criteria with the project's areas and live cases, and whether you can write |
|
|
210
|
+
| `create_test_area` | Create a functional area (refused with AREA_EXISTS if the name is taken) |
|
|
211
|
+
| `add_test_case` | Add a new case to an area, or add steps to the end of an existing case |
|
|
212
|
+
|
|
202
213
|
## Updating
|
|
203
214
|
|
|
204
215
|
Update to the latest version the same way you installed:
|
|
@@ -210,6 +221,15 @@ konductro-codex-setup --url https://platform.konductro.com --token <your-cli-tok
|
|
|
210
221
|
|
|
211
222
|
Restart Codex after updating.
|
|
212
223
|
|
|
224
|
+
Codex runs a copy of the whole plugin that setup makes, so `npm install` alone does not upgrade it: always run `konductro-codex-setup` again after installing.
|
|
225
|
+
|
|
226
|
+
To try a prerelease (for example 2.5.0-rc.1, which adds the Test Library tools and the `konductro-test-pack` skill and needs a Konductro environment with the KON-894 API), install from `next` and run setup again:
|
|
227
|
+
|
|
228
|
+
```bash
|
|
229
|
+
npm install -g @konductro/codex-plugin@next
|
|
230
|
+
konductro-codex-setup --url <your-konductro-url> --token <your-cli-token>
|
|
231
|
+
```
|
|
232
|
+
|
|
213
233
|
## Troubleshooting
|
|
214
234
|
|
|
215
235
|
| Problem | Solution |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@konductro/codex-plugin",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.0",
|
|
4
4
|
"description": "Codex plugin for the Konductro platform: technical analysis, delivery tasks, repository profiling, and prototype workflows.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"type": "module",
|
package/servers/konductro-api.js
CHANGED
|
@@ -92,6 +92,8 @@ async function konductroFetch(path, options = {}) {
|
|
|
92
92
|
// Zod's flatten() on a validation failure. Kept so a refusal can name the offending
|
|
93
93
|
// field instead of saying "Validation failed" and leaving the agent to guess.
|
|
94
94
|
err.details = parsed?.details ?? null;
|
|
95
|
+
// KON-897: AREA_EXISTS names the area that already has the name.
|
|
96
|
+
err.areaId = parsed?.areaId ?? null;
|
|
95
97
|
throw err;
|
|
96
98
|
}
|
|
97
99
|
|
|
@@ -1082,7 +1084,7 @@ server.tool(
|
|
|
1082
1084
|
// Tool: Delete a work item
|
|
1083
1085
|
server.tool(
|
|
1084
1086
|
'delete_work_item',
|
|
1085
|
-
"Delete a task or a bug from Konductro that has not been started. Bugs count: Konductro stores a bug as a task, so a developer's own unstarted bug can be deleted here. Stories cannot — deleting one takes its tasks with it and there is no restore, so archive a story in Konductro instead. Neither can a bug QA filed against a failed test criterion, which is part of that test record rather than yours. Nothing that has started can be deleted by anyone: that means anything carrying a branch, or anything past sprint planning, since only draft, approved and in_sprint items still qualify. Close those out in Konductro instead. Beyond that you may delete an item you are assigned to, are the developer on, or created; an SDM
|
|
1087
|
+
"Delete a task or a bug from Konductro that has not been started. Bugs count: Konductro stores a bug as a task, so a developer's own unstarted bug can be deleted here. Stories cannot — deleting one takes its tasks with it and there is no restore, so archive a story in Konductro instead. Neither can a bug QA filed against a failed test criterion, which is part of that test record rather than yours. Nothing that has started can be deleted by anyone: that means anything carrying a branch, or anything past sprint planning, since only draft, approved and in_sprint items still qualify. Close those out in Konductro instead. Beyond that you may delete an item you are assigned to, are the developer on, or created; an SDM or architect on the project may delete any item that qualifies. This is permanent and there is no undo, so be sure the developer asked for it.",
|
|
1086
1088
|
{
|
|
1087
1089
|
key: z.string().describe('The task or bug key (e.g. KON-452) or UUID'),
|
|
1088
1090
|
},
|
|
@@ -1543,6 +1545,127 @@ server.tool(
|
|
|
1543
1545
|
}
|
|
1544
1546
|
);
|
|
1545
1547
|
|
|
1548
|
+
// ─── KON-897: Test Library ──────────────────────────────────────────────────
|
|
1549
|
+
//
|
|
1550
|
+
// A tester turns a story's acceptance criteria into Test Library cases from the CLI. Cases,
|
|
1551
|
+
// added steps and areas go straight into the library: the tester's approval of the plan in
|
|
1552
|
+
// /test-pack is the review. Writes need the tester or SDM role on the project.
|
|
1553
|
+
|
|
1554
|
+
/**
|
|
1555
|
+
* Like workItemCall, except that a refusal is passed through EXACTLY as the backend wrote
|
|
1556
|
+
* it. These routes answer 403 INSUFFICIENT_ROLE for a missing PROJECT role (tester or SDM),
|
|
1557
|
+
* which refusalText would turn into a sentence about viewer seats, and 409 CASE_ARCHIVED or
|
|
1558
|
+
* AREA_EXISTS whose own sentences already say what to do.
|
|
1559
|
+
*/
|
|
1560
|
+
async function testLibraryCall(fn) {
|
|
1561
|
+
try {
|
|
1562
|
+
assertAuthConfigured();
|
|
1563
|
+
return { content: [{ type: 'text', text: await fn() }] };
|
|
1564
|
+
} catch (err) {
|
|
1565
|
+
if (err.status === 401) {
|
|
1566
|
+
return {
|
|
1567
|
+
content: [{ type: 'text', text: 'Not authenticated: Konductro rejected the CLI token. It may be expired or revoked. Create a new one in Konductro under your profile and update KONDUCTRO_CLI_TOKEN. This is a setup problem, not a permissions one.' }],
|
|
1568
|
+
isError: true,
|
|
1569
|
+
};
|
|
1570
|
+
}
|
|
1571
|
+
if (err.status === 403 || err.status === 404 || err.status === 409 || (err.status === 400 && err.code !== 'INVALID_BODY')) {
|
|
1572
|
+
const extra = err.code === 'AREA_EXISTS' && err.areaId ? ` Existing area id: ${err.areaId}.` : '';
|
|
1573
|
+
const sentence = /[.!?]$/.test(err.message) ? err.message : `${err.message}.`;
|
|
1574
|
+
return { content: [{ type: 'text', text: `Refused (${err.code ?? err.status}): ${sentence}${extra}` }] };
|
|
1575
|
+
}
|
|
1576
|
+
const text = err.setup
|
|
1577
|
+
? err.message
|
|
1578
|
+
: `Failed: ${err.code === 'INVALID_BODY' ? validationText(err) : err.message}`;
|
|
1579
|
+
return { content: [{ type: 'text', text }], isError: true };
|
|
1580
|
+
}
|
|
1581
|
+
}
|
|
1582
|
+
|
|
1583
|
+
function renderStoryTestContext(ctx) {
|
|
1584
|
+
const lines = [];
|
|
1585
|
+
lines.push(`## ${ctx.story.key}: ${ctx.story.title}`, '');
|
|
1586
|
+
lines.push(`Project id: ${ctx.projectId}`);
|
|
1587
|
+
lines.push(`You can write to this Test Library: ${ctx.canWrite ? 'yes' : 'NO (needs the tester or SDM role on the project)'}`, '');
|
|
1588
|
+
lines.push('### Acceptance criteria', '');
|
|
1589
|
+
const acs = ctx.story.acceptanceCriteria ?? [];
|
|
1590
|
+
if (acs.length === 0) lines.push('(none recorded on the story)');
|
|
1591
|
+
acs.forEach((ac, i) => lines.push(`${i + 1}. ${ac}`));
|
|
1592
|
+
lines.push('', '### Test Library', '');
|
|
1593
|
+
if (ctx.areas.length === 0) lines.push('No functional areas yet.');
|
|
1594
|
+
for (const area of ctx.areas) {
|
|
1595
|
+
lines.push(`#### ${area.name} (area id ${area.id}, ${area.cases.length} case${area.cases.length === 1 ? '' : 's'})`);
|
|
1596
|
+
if (area.description) lines.push(area.description);
|
|
1597
|
+
for (const c of area.cases) {
|
|
1598
|
+
lines.push(`- **${c.name}** (case id ${c.id})${c.description ? `: ${c.description}` : ''}`);
|
|
1599
|
+
for (const s of c.steps) lines.push(` ${s.index + 1}. ${s.description}`);
|
|
1600
|
+
}
|
|
1601
|
+
lines.push('');
|
|
1602
|
+
}
|
|
1603
|
+
return lines.join('\n');
|
|
1604
|
+
}
|
|
1605
|
+
|
|
1606
|
+
server.tool(
|
|
1607
|
+
'get_story_test_context',
|
|
1608
|
+
"Load a story by key (e.g. KON-784) with its acceptance criteria, plus its project's Test Library: functional areas and their live cases with steps (archived cases are left out). Also says whether you may write to the library (tester or SDM on the project). Call this first when building test cases for a story.",
|
|
1609
|
+
{
|
|
1610
|
+
storyKey: z.string().describe('The story key, e.g. KON-784'),
|
|
1611
|
+
},
|
|
1612
|
+
async ({ storyKey }) => testLibraryCall(async () => {
|
|
1613
|
+
const ctx = await konductroFetch(`/api/cli/stories/${encodeURIComponent(storyKey.trim())}/test-context`);
|
|
1614
|
+
return renderStoryTestContext(ctx);
|
|
1615
|
+
}),
|
|
1616
|
+
);
|
|
1617
|
+
|
|
1618
|
+
server.tool(
|
|
1619
|
+
'create_test_area',
|
|
1620
|
+
"Create a functional area in a project's Test Library when no existing area fits. Tester or SDM only. An area with the same name (ignoring case) is refused with AREA_EXISTS and that area's id. Only call this after the user has agreed the new area.",
|
|
1621
|
+
{
|
|
1622
|
+
projectId: z.string().describe('The project id from get_story_test_context'),
|
|
1623
|
+
name: z.string().describe('A short domain name, e.g. "Refunds" (2 to 100 characters)'),
|
|
1624
|
+
description: z.string().optional().describe('One line on what the area covers'),
|
|
1625
|
+
sourceStoryKey: z.string().optional().describe('The story this area is for, e.g. KON-784'),
|
|
1626
|
+
},
|
|
1627
|
+
async ({ projectId, name, description, sourceStoryKey }) => testLibraryCall(async () => {
|
|
1628
|
+
const area = await konductroFetch(`/api/cli/projects/${encodeURIComponent(projectId)}/test-library/areas`, {
|
|
1629
|
+
method: 'POST',
|
|
1630
|
+
body: JSON.stringify({ name, description, sourceStoryKey }),
|
|
1631
|
+
});
|
|
1632
|
+
return `Created area **${area.name}** (area id ${area.id}).`;
|
|
1633
|
+
}),
|
|
1634
|
+
);
|
|
1635
|
+
|
|
1636
|
+
server.tool(
|
|
1637
|
+
'add_test_case',
|
|
1638
|
+
"Add ONE test case to a project's Test Library, live straight away. mode new_case adds a case to an area (needs areaId and name); mode extend_case adds steps to the end of an existing case (needs caseId). Steps are 1 to 50, each an action followed by its expected result. Tester or SDM only. An archived case is refused with CASE_ARCHIVED. Only call this after the user has approved the plan.",
|
|
1639
|
+
{
|
|
1640
|
+
projectId: z.string().describe('The project id from get_story_test_context'),
|
|
1641
|
+
mode: z.enum(['new_case', 'extend_case']).describe('new_case adds a case; extend_case adds steps to an existing case'),
|
|
1642
|
+
areaId: z.string().optional().describe('For new_case: the area id'),
|
|
1643
|
+
caseId: z.string().optional().describe('For extend_case: the existing case id'),
|
|
1644
|
+
name: z.string().optional().describe('For new_case: a short, scenario-style name (3 to 200 characters)'),
|
|
1645
|
+
description: z.string().optional().describe('For new_case: optional context for whoever runs it'),
|
|
1646
|
+
steps: z.array(z.string()).describe('Ordered steps, each up to 500 characters, e.g. "Submit a R100,00 payment. Expected: one retry is logged."'),
|
|
1647
|
+
sourceStoryKey: z.string().describe('The story these steps come from, e.g. KON-784'),
|
|
1648
|
+
},
|
|
1649
|
+
async ({ projectId, mode, areaId, caseId, name, description, steps, sourceStoryKey }) => testLibraryCall(async () => {
|
|
1650
|
+
if (mode === 'new_case' && (!areaId || !name)) {
|
|
1651
|
+
return 'Refused: new_case needs areaId and name. NOTHING WAS ADDED.';
|
|
1652
|
+
}
|
|
1653
|
+
if (mode === 'extend_case' && !caseId) {
|
|
1654
|
+
return 'Refused: extend_case needs caseId. NOTHING WAS ADDED.';
|
|
1655
|
+
}
|
|
1656
|
+
const body = mode === 'new_case'
|
|
1657
|
+
? { mode, areaId, name, description, steps: steps.map((d) => ({ description: d })), sourceStoryKey }
|
|
1658
|
+
: { mode, caseId, steps: steps.map((d) => ({ description: d })), sourceStoryKey };
|
|
1659
|
+
const res = await konductroFetch(`/api/cli/projects/${encodeURIComponent(projectId)}/test-library/cases`, {
|
|
1660
|
+
method: 'POST',
|
|
1661
|
+
body: JSON.stringify(body),
|
|
1662
|
+
});
|
|
1663
|
+
const verb = mode === 'new_case' ? `Added case **${res.case.name}**` : `Added ${steps.length} step${steps.length === 1 ? '' : 's'} to **${res.case.name}**`;
|
|
1664
|
+
const list = res.case.steps.map((s) => `${s.index + 1}. ${s.description}`).join('\n');
|
|
1665
|
+
return `${verb} (case id ${res.case.id}). It now has ${res.case.steps.length} steps:\n${list}`;
|
|
1666
|
+
}),
|
|
1667
|
+
);
|
|
1668
|
+
|
|
1546
1669
|
// Start the server
|
|
1547
1670
|
async function main() {
|
|
1548
1671
|
const transport = new StdioServerTransport();
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: konductro-test-pack
|
|
3
|
+
description: Turn a story's acceptance criteria into Test Library cases, checked against the existing library, and add them straight into the library once the tester approves the plan. Use when asked to build a test pack or test cases for a story key such as KON-784.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Test Pack
|
|
7
|
+
|
|
8
|
+
Build manual regression test cases for one story and add them to the project's Test Library.
|
|
9
|
+
A test case is a checklist a person runs: a name, an optional description and ordered steps.
|
|
10
|
+
Nothing here is automated testing.
|
|
11
|
+
|
|
12
|
+
Cases you add go live in the library straight away, both new cases and extra steps on an
|
|
13
|
+
existing case. There is no review step in Konductro: the tester's approval of your plan in
|
|
14
|
+
Step 4 IS the review, so never add anything they have not approved.
|
|
15
|
+
|
|
16
|
+
## Step 1: Load the story and the library
|
|
17
|
+
|
|
18
|
+
Call `get_story_test_context` with the story key from the request (ask for it if it is
|
|
19
|
+
missing). Summarise in a few lines:
|
|
20
|
+
|
|
21
|
+
- the story title and its acceptance criteria, numbered
|
|
22
|
+
- the project's functional areas, with how many cases each holds
|
|
23
|
+
|
|
24
|
+
If it says you cannot write to this Test Library, stop and say so: adding cases needs the
|
|
25
|
+
tester or SDM role on the project. Ask the project's SDM for the role.
|
|
26
|
+
|
|
27
|
+
## Step 2: Look at the code, if it is here
|
|
28
|
+
|
|
29
|
+
If the current directory is the story's repository, read the code the story touches, enough
|
|
30
|
+
to know what changed and what it affects. If it is not, say the cases come from the
|
|
31
|
+
acceptance criteria alone. Do not guess at code you have not read.
|
|
32
|
+
|
|
33
|
+
## Step 3: Plan the cases
|
|
34
|
+
|
|
35
|
+
For each acceptance criterion decide:
|
|
36
|
+
|
|
37
|
+
- **Which area.** Use an existing area. If none fits, say so and suggest one new area (a
|
|
38
|
+
short domain name and a one-line description) for the tester to agree. Check it is not a
|
|
39
|
+
near-duplicate of an existing area first.
|
|
40
|
+
- **New case or extend an existing one.** Compare with the existing cases. If one already
|
|
41
|
+
covers the same scenario, plan `extend_case` with only the missing steps. Never add a
|
|
42
|
+
duplicate. An extension changes a case other testers already run, so name the case it
|
|
43
|
+
changes and quote its current last step.
|
|
44
|
+
- **Whether it is worth keeping as regression.** A criterion about a one-off migration or
|
|
45
|
+
wording does not need a permanent test. Say which criteria you are leaving out and why.
|
|
46
|
+
|
|
47
|
+
Group criteria that are one scenario into one case. Write each step as an action followed by
|
|
48
|
+
"Expected:" and the result, for example "Submit a R100,00 card payment while the bank stub
|
|
49
|
+
delays 31 seconds. Expected: one retry is logged, then the payment completes." Use obviously
|
|
50
|
+
fake test data only: test card 4111 1111 1111 1111, "Test Merchant 001", example.com
|
|
51
|
+
addresses. Never realistic ID numbers, phone numbers or addresses.
|
|
52
|
+
|
|
53
|
+
## Step 4: Show the plan and wait
|
|
54
|
+
|
|
55
|
+
Present the plan as a table (area, new or extend, case name, step count), then each case's
|
|
56
|
+
steps. Say plainly that approving adds them to the library straight away. Ask the tester to
|
|
57
|
+
approve, change or drop cases. Do not add anything before they approve.
|
|
58
|
+
|
|
59
|
+
## Step 5: Add
|
|
60
|
+
|
|
61
|
+
1. If the tester agreed a new area, call `create_test_area` and use the area id it returns.
|
|
62
|
+
If it answers AREA_EXISTS, use the existing area it names instead.
|
|
63
|
+
2. Call `add_test_case` once per approved case, with `sourceStoryKey` set to the story key.
|
|
64
|
+
3. Report what was written: how many cases were added and how many steps were added to
|
|
65
|
+
existing cases, by area. The tester finds them under Test Library, Cases in the project.
|
|
66
|
+
|
|
67
|
+
If a call is refused, show the refusal exactly as it came back (for example CASE_ARCHIVED, or
|
|
68
|
+
the message about the tester or SDM role) and carry on with the remaining approved cases.
|
|
69
|
+
Do not retry a refusal or work around it.
|