testeiya 0.4.4 → 0.4.5
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 +21 -1
- package/dist/prompt/clis.js +38 -0
- package/dist/prompt/clis.js.map +1 -0
- package/dist/prompt/comment-thread.js +56 -44
- package/dist/prompt/comment-thread.js.map +1 -1
- package/dist/prompt/system-prompt.js +154 -174
- package/dist/prompt/system-prompt.js.map +1 -1
- package/dist/src/doctor.js +9 -1
- package/dist/src/doctor.js.map +1 -1
- package/dist/src/langfuse-extension.js +135 -0
- package/dist/src/langfuse-extension.js.map +1 -0
- package/dist/src/langfuse.js +143 -0
- package/dist/src/langfuse.js.map +1 -0
- package/dist/src/output.js +48 -3
- package/dist/src/output.js.map +1 -1
- package/dist/src/run.js +36 -12
- package/dist/src/run.js.map +1 -1
- package/dist/src/session.js +22 -8
- package/dist/src/session.js.map +1 -1
- package/package.json +1 -1
- package/prompt/clis.ts +45 -0
- package/prompt/comment-thread.ts +65 -47
- package/prompt/system-prompt.ts +182 -184
- package/skills/playwright/playwright-cli/SKILL.md +49 -0
- package/skills/playwright/playwright-cli/references/pr-attachments.md +60 -0
- package/skills/playwright/playwright-cli/references/session-management.md +2 -0
- package/skills/playwright/playwright-cli/references/video-recording.md +12 -0
- package/skills/skills.lock.json +2 -2
- package/skills/testomatio/requirements/write-user-story/SKILL.md +7 -10
- package/skills/testomatio/test-management/scan-automation-project/SKILL.md +103 -26
- package/dist/prompt/context.js +0 -87
- package/dist/prompt/context.js.map +0 -1
- package/dist/prompt/index.js +0 -60
- package/dist/prompt/index.js.map +0 -1
- package/dist/prompt/print.js +0 -30
- package/dist/prompt/print.js.map +0 -1
- package/dist/prompt/project-info.js +0 -2
- package/dist/prompt/project-info.js.map +0 -1
- package/dist/prompt/testomatio.js +0 -264
- package/dist/prompt/testomatio.js.map +0 -1
- package/dist/prompt/tools.js +0 -70
- package/dist/prompt/tools.js.map +0 -1
- package/dist/prompt/vocab.js +0 -8
- package/dist/prompt/vocab.js.map +0 -1
- package/prompt/context.ts +0 -108
- package/prompt/index.ts +0 -102
- package/prompt/print.ts +0 -32
- package/prompt/project-info.ts +0 -30
- package/prompt/testomatio.ts +0 -281
- package/prompt/tools.ts +0 -72
- package/prompt/vocab.ts +0 -7
|
@@ -1,264 +0,0 @@
|
|
|
1
|
-
import dedent from "dedent";
|
|
2
|
-
const MAX_PROMPT_LABELS = 20;
|
|
3
|
-
const MAX_PROMPT_TAGS = 30;
|
|
4
|
-
const MAX_PROMPT_ENVS = 15;
|
|
5
|
-
const tmsViaDirectTools = dedent `
|
|
6
|
-
# Testomat.io-first operating rules (highest priority)
|
|
7
|
-
|
|
8
|
-
This agent works on Testomat.io projects. You have TWO sources of truth and they answer different kinds of questions:
|
|
9
|
-
|
|
10
|
-
1. **The pulled markdown workspace (\`cwd\`)** — for **tests** and **suites**. Each project's tests and suite structure are already pulled as markdown files into the working directory (one directory per project slug). This is the canonical source for test content, suite hierarchy, test bodies, tags, gherkin scenarios, file layout. Use \`read\`, \`find\`, \`grep\`, \`ls\` — they're instant and don't hit the network.
|
|
11
|
-
2. **MCP tools under \`testomatio-<slug>\`** — for **dynamic Testomat.io data**: runs, testruns, plans, labels, linked issues, ims config, ci config, analytics. These things don't live as files and MUST come from MCP.
|
|
12
|
-
|
|
13
|
-
**Prefer the filesystem for test/suite queries.** Only fall back to \`testomatio-*_tests_list\` / \`testomatio-*_suites_list\` if the user's question genuinely needs cross-tree metadata (e.g. priority, labels, status) that isn't in the markdown, or if the workspace looks stale. Reading test files is faster, cheaper, and gives you the actual code/gherkin.
|
|
14
|
-
|
|
15
|
-
**Never** ask the user for the **Testomat.io** API token — it's configured. (This does NOT cover secrets the *app under test* needs to run — its own env vars/tokens. If a test run is blocked by one of those, ask for it.)
|
|
16
|
-
|
|
17
|
-
**Statuses and counts are live** — runs change them at any time. Fresh query results supersede numbers from earlier in the conversation; when they differ, the data changed — report the new snapshot.
|
|
18
|
-
|
|
19
|
-
## Banned moves
|
|
20
|
-
|
|
21
|
-
- Do NOT call an MCP \`*_tests_list\` or \`*_suites_list\` as your first action for a test/suite question — **read the filesystem first** (\`find\`, \`ls\`, \`grep\`, \`read\`). Fall back to MCP only if the metadata you need isn't in the markdown.
|
|
22
|
-
- Do NOT ask the user for the **Testomat.io** API token — it's already configured. (Secrets the app under test needs to run are a different thing — ask for those if a run is blocked.)
|
|
23
|
-
- Do NOT call \`bash\` / \`find\` / \`grep\` to answer questions about **runs, testruns, plans, labels, linked issues, analytics** — those don't exist as files. Use MCP.
|
|
24
|
-
|
|
25
|
-
## Filesystem vs. MCP cheat sheet
|
|
26
|
-
|
|
27
|
-
| Question is about… | First action |
|
|
28
|
-
|---|---|
|
|
29
|
-
| Test content (code, steps, gherkin, description, file path, tags) | \`read\` / \`find\` / \`grep\` in \`cwd\` |
|
|
30
|
-
| Suite hierarchy / structure / which files exist | \`ls\` / \`find\` |
|
|
31
|
-
| Individual test metadata (priority, status flag, labels) | try filesystem; if missing, \`testomatio-*_tests_get\` |
|
|
32
|
-
| Runs, testruns, plans, labels, issues, analytics | MCP \`testomatio-*\` tools |
|
|
33
|
-
| Creating/updating tests or suites | edit the markdown file, then \`npx check-tests push\` |
|
|
34
|
-
| Creating/updating runs, linking issues | MCP create/update tools |
|
|
35
|
-
| Launching automated or mixed Run remotely on CI | Use npx -y @testomatio/reporter@latest run --remote <profile>, raise error if no CI profiles configured
|
|
36
|
-
| Running automated Run | Use local test runner with testomatio reporter attached to report to current project
|
|
37
|
-
|
|
38
|
-
---
|
|
39
|
-
`;
|
|
40
|
-
const tmsViaProxy = dedent `
|
|
41
|
-
# Testomat.io-first operating rules (highest priority)
|
|
42
|
-
|
|
43
|
-
This agent works on a Testomat.io project. You have TWO sources of truth and they answer different kinds of questions:
|
|
44
|
-
|
|
45
|
-
1. **The pulled markdown workspace (\`cwd\`)** — for **tests** and **suites**. Test content, suite hierarchy, bodies, tags and gherkin scenarios are files. Use \`read\`, \`find\`, \`grep\`, \`ls\` — they are instant and hit no network.
|
|
46
|
-
2. **The \`mcp\` tool** — for **dynamic Testomat.io data**: runs, testruns, plans, labels, linked issues, ims config, ci config, analytics. These do not live as files and MUST come from there.
|
|
47
|
-
|
|
48
|
-
Testomat.io is reached through **one \`mcp\` tool**, not a tool per operation. Call \`mcp({ search: "<what you need>" })\` to find the right operation, then \`mcp({ tool: "<name>", ... })\` to run it. The handful of reads used most often are also registered as their own tools — use those directly when they fit.
|
|
49
|
-
|
|
50
|
-
**Prefer the filesystem for test/suite queries.** Reach for a listing only when the question needs cross-tree metadata (priority, labels, status) the markdown does not carry, or when the workspace looks stale.
|
|
51
|
-
|
|
52
|
-
**Never** ask the user for the **Testomat.io** API token — it's configured. (This does NOT cover secrets the *app under test* needs to run — its own env vars/tokens. If a test run is blocked by one of those, report it.)
|
|
53
|
-
|
|
54
|
-
**Statuses and counts are live** — runs change them at any time. Fresh query results supersede numbers from earlier in the conversation; when they differ, the data changed — report the new snapshot.
|
|
55
|
-
|
|
56
|
-
## Banned moves
|
|
57
|
-
|
|
58
|
-
- Do NOT search for an operation as your first action for a test/suite question — **read the filesystem first** (\`find\`, \`ls\`, \`grep\`, \`read\`). Fall back to a listing only if the metadata you need isn't in the markdown.
|
|
59
|
-
- Do NOT ask the user for the **Testomat.io** API token — it's already configured. (Secrets the app under test needs to run are a different thing — report those if a run is blocked.)
|
|
60
|
-
- Do NOT call \`bash\` / \`find\` / \`grep\` to answer questions about **runs, testruns, plans, labels, linked issues, analytics** — those don't exist as files.
|
|
61
|
-
|
|
62
|
-
## Filesystem vs. Testomat.io cheat sheet
|
|
63
|
-
|
|
64
|
-
| Question is about… | First action |
|
|
65
|
-
|---|---|
|
|
66
|
-
| Test content (code, steps, gherkin, description, file path, tags) | \`read\` / \`find\` / \`grep\` in \`cwd\` |
|
|
67
|
-
| Suite hierarchy / structure / which files exist | \`ls\` / \`find\` |
|
|
68
|
-
| Individual test metadata (priority, status flag, labels) | try filesystem; if missing, \`mcp({ search: "get test" })\` |
|
|
69
|
-
| Runs, testruns, plans, labels, issues, analytics | \`mcp({ search: … })\`, then \`mcp({ tool: … })\` |
|
|
70
|
-
| Creating/updating tests or suites | edit the markdown file, then \`npx check-tests push\` |
|
|
71
|
-
| Creating/updating runs, linking issues | the matching \`mcp\` create/update operation |
|
|
72
|
-
| Launching automated or mixed Run remotely on CI | Use npx -y @testomatio/reporter@latest run --remote <profile>, raise error if no CI profiles configured |
|
|
73
|
-
| Running automated Run | Use local test runner with testomatio reporter attached to report to current project |
|
|
74
|
-
|
|
75
|
-
---
|
|
76
|
-
`;
|
|
77
|
-
const tmsViaCli = dedent `
|
|
78
|
-
# Testomat.io-first operating rules (highest priority)
|
|
79
|
-
|
|
80
|
-
This agent works on a Testomat.io project through the **shell only** — there are no Testomat.io tools in this session.
|
|
81
|
-
|
|
82
|
-
1. **The pulled markdown workspace (\`cwd\`)** — the canonical source for **tests** and **suites**: content, hierarchy, bodies, tags, gherkin scenarios. Use \`read\`, \`find\`, \`grep\`, \`ls\`.
|
|
83
|
-
2. **\`npx check-tests\`** — moves test cases between the markdown and Testomat.io (\`pull\`, \`push\`). It reads its credentials from the environment.
|
|
84
|
-
3. **The REST API through \`bash\`** — for dynamic data (runs, testruns, plans, labels, linked issues, analytics): \`curl -H "Authorization: $TESTOMATIO" "$TESTOMATIO_URL/api/v2/..."\`.
|
|
85
|
-
|
|
86
|
-
**Never** ask the user for the **Testomat.io** API token — it's configured as \`TESTOMATIO\`. (This does NOT cover secrets the *app under test* needs to run — its own env vars/tokens. If a test run is blocked by one of those, report it.)
|
|
87
|
-
|
|
88
|
-
**Statuses and counts are live** — runs change them at any time. Fresh query results supersede numbers from earlier in the conversation.
|
|
89
|
-
|
|
90
|
-
## Banned moves
|
|
91
|
-
|
|
92
|
-
- Do NOT shell out for test content that is already a file in \`cwd\` — read the file.
|
|
93
|
-
- Do NOT invent REST paths or parameters. Read the workspace first; when a call is genuinely needed, keep to documented \`/api/v2\` endpoints.
|
|
94
|
-
- Do NOT ask the user for the **Testomat.io** API token.
|
|
95
|
-
|
|
96
|
-
## Filesystem vs. shell cheat sheet
|
|
97
|
-
|
|
98
|
-
| Question is about… | First action |
|
|
99
|
-
|---|---|
|
|
100
|
-
| Test content (code, steps, gherkin, description, file path, tags) | \`read\` / \`find\` / \`grep\` in \`cwd\` |
|
|
101
|
-
| Suite hierarchy / structure / which files exist | \`ls\` / \`find\` |
|
|
102
|
-
| Runs, testruns, plans, labels, issues, analytics | \`curl\` against \`/api/v2\` |
|
|
103
|
-
| Creating/updating tests or suites | edit the markdown file, then \`npx check-tests push\` |
|
|
104
|
-
| Launching automated or mixed Run remotely on CI | Use npx -y @testomatio/reporter@latest run --remote <profile>, raise error if no CI profiles configured |
|
|
105
|
-
| Running automated Run | Use local test runner with testomatio reporter attached to report to current project |
|
|
106
|
-
|
|
107
|
-
---
|
|
108
|
-
`;
|
|
109
|
-
/**
|
|
110
|
-
* How the agent reaches Testomat.io in this session. The rules are the same;
|
|
111
|
-
* the way to act on them is not, so the harness picks the matching wording.
|
|
112
|
-
*/
|
|
113
|
-
export function testomatioTms(access) {
|
|
114
|
-
if (access === "mcp-proxy")
|
|
115
|
-
return tmsViaProxy;
|
|
116
|
-
if (access === "cli-only")
|
|
117
|
-
return tmsViaCli;
|
|
118
|
-
return tmsViaDirectTools;
|
|
119
|
-
}
|
|
120
|
-
export function testomatioConnection(tokenSlugs, backendUrl, connection, access = "mcp-direct") {
|
|
121
|
-
let urlSuffix = "";
|
|
122
|
-
if (backendUrl)
|
|
123
|
-
urlSuffix = ` (\`${backendUrl}\`)`;
|
|
124
|
-
if (tokenSlugs.length === 0) {
|
|
125
|
-
let project = "";
|
|
126
|
-
if (connection?.projectId)
|
|
127
|
-
project = ` \`${connection.projectId}\``;
|
|
128
|
-
if (connection?.title)
|
|
129
|
-
project += ` ("${connection.title}")`;
|
|
130
|
-
return dedent `
|
|
131
|
-
## Testomat.io Connection (pre-configured)
|
|
132
|
-
|
|
133
|
-
This workspace is linked to the Testomat.io project${project}.
|
|
134
|
-
|
|
135
|
-
The project API key is **already set** as \`TESTOMATIO\` in the environment of every \`bash\` command you run, along with \`TESTOMATIO_URL\`${urlSuffix}. **Never ask the user for a Testomat.io token or API key** — it is already in scope.
|
|
136
|
-
|
|
137
|
-
Push or pull manual test cases with \`npx check-tests\` (or other \`npx @testomatio/*\` commands) — they pick the credentials up from the environment. ${envTokenActions(access)}
|
|
138
|
-
|
|
139
|
-
`;
|
|
140
|
-
}
|
|
141
|
-
if (tokenSlugs.length > 1) {
|
|
142
|
-
const projects = tokenSlugs.map((s) => `- ${s}`).join("\n");
|
|
143
|
-
return dedent `
|
|
144
|
-
## Testomat.io Connection (pre-configured)
|
|
145
|
-
|
|
146
|
-
This session spans several Testomat.io projects, so no single \`TESTOMATIO\` env var is exported — only \`TESTOMATIO_URL\`${urlSuffix}. Each project's **MCP server** carries its own credentials (tool prefix: \`testomatio-<slug>\`) — use those for structured actions. **Never ask the user for a Testomat.io token or API key.** Do not guess tokens for \`check-tests\`; use the app's Sync (Pull/Push in the Workspace panel) to move test cases.
|
|
147
|
-
|
|
148
|
-
Projects pulled into this working directory (one dir per project):
|
|
149
|
-
${projects}
|
|
150
|
-
|
|
151
|
-
`;
|
|
152
|
-
}
|
|
153
|
-
const projects = tokenSlugs.map((s) => `- ${s}`).join("\n");
|
|
154
|
-
return dedent `
|
|
155
|
-
## Testomat.io Connection (pre-configured)
|
|
156
|
-
|
|
157
|
-
The Testomat.io API key is **already set** in the environment as \`TESTOMATIO\`, and the backend URL is set as \`TESTOMATIO_URL\`${urlSuffix}.
|
|
158
|
-
|
|
159
|
-
**Do not ask the user for a Testomat.io token** — it is available to every \`bash\` command you run as the \`TESTOMATIO\` env var.
|
|
160
|
-
|
|
161
|
-
Projects pulled into this working directory (one dir per project):
|
|
162
|
-
${projects}
|
|
163
|
-
|
|
164
|
-
${perProjectActions(access)}
|
|
165
|
-
|
|
166
|
-
When you need to push changes back, run \`npx check-tests push\` (or similar \`npx @testomatio/*\` commands) directly — credentials are already in scope.
|
|
167
|
-
|
|
168
|
-
`;
|
|
169
|
-
}
|
|
170
|
-
export function testomatioNotConnected() {
|
|
171
|
-
return dedent `
|
|
172
|
-
## Testomat.io Connection (not connected)
|
|
173
|
-
|
|
174
|
-
This workspace is not linked to a Testomat.io project and no API key is available in the environment.
|
|
175
|
-
|
|
176
|
-
**Never ask the user to paste a Testomat.io API key or token into the chat.** If a task needs Testomat.io access (pulling or pushing test cases, runs, analytics), tell the user to connect the project first — open **Settings → Testomat.io connection** and link this workspace — then continue once connected. Parts of the task that only touch local files can proceed right away.
|
|
177
|
-
`;
|
|
178
|
-
}
|
|
179
|
-
/**
|
|
180
|
-
* Compact project-settings block for the system prompt, built from the cached
|
|
181
|
-
* `GET /api/v2/{id}/info` payload (`.testeiya/project-info.json`). Only present
|
|
182
|
-
* fields are rendered; labels/tags are capped with a pointer to the full file.
|
|
183
|
-
*/
|
|
184
|
-
export function projectSettings(info) {
|
|
185
|
-
let heading = `**${info.title}** (\`${info.project_id}\`)`;
|
|
186
|
-
if (info.subscription)
|
|
187
|
-
heading += ` — ${info.subscription} plan`;
|
|
188
|
-
const lines = [];
|
|
189
|
-
const stack = [];
|
|
190
|
-
if (info.framework)
|
|
191
|
-
stack.push(`framework: ${info.framework}`);
|
|
192
|
-
if (info.language)
|
|
193
|
-
stack.push(`language: ${info.language}`);
|
|
194
|
-
if (stack.length > 0)
|
|
195
|
-
lines.push(`- Test stack — ${stack.join(", ")}`);
|
|
196
|
-
if (info.repository_url)
|
|
197
|
-
lines.push(`- Repository: ${info.repository_url}`);
|
|
198
|
-
if (info.artifacts_storage_enabled) {
|
|
199
|
-
lines.push("- Artifacts storage is enabled (test runs can attach screenshots/videos/logs)");
|
|
200
|
-
}
|
|
201
|
-
if (info.environments?.length > 0) {
|
|
202
|
-
const shown = info.environments.slice(0, MAX_PROMPT_ENVS);
|
|
203
|
-
lines.push(`- Environments: ${capped(shown, info.environments.length)}`);
|
|
204
|
-
}
|
|
205
|
-
if (info.features?.length > 0) {
|
|
206
|
-
lines.push(`- Enabled features: ${info.features.join(", ")}`);
|
|
207
|
-
}
|
|
208
|
-
if (info.labels?.length > 0) {
|
|
209
|
-
const shown = info.labels
|
|
210
|
-
.slice(0, MAX_PROMPT_LABELS)
|
|
211
|
-
.map((l) => `${l.title} (\`${l.slug}\`)`);
|
|
212
|
-
lines.push(`- Labels defined in this project: ${capped(shown, info.labels.length)}`);
|
|
213
|
-
}
|
|
214
|
-
if (info.tags?.length > 0) {
|
|
215
|
-
const shown = info.tags.slice(0, MAX_PROMPT_TAGS).map((t) => `@${t}`);
|
|
216
|
-
lines.push(`- Tags in use: ${capped(shown, info.tags.length)}`);
|
|
217
|
-
}
|
|
218
|
-
if (info.ci_profiles?.length > 0) {
|
|
219
|
-
const profiles = info.ci_profiles.map((p) => {
|
|
220
|
-
if (p.service)
|
|
221
|
-
return `"${p.profile_name}" (${p.service})`;
|
|
222
|
-
return `"${p.profile_name}"`;
|
|
223
|
-
});
|
|
224
|
-
lines.push(`- CI profiles configured (runs can be triggered through them): ${profiles.join(", ")}`);
|
|
225
|
-
}
|
|
226
|
-
let body = heading;
|
|
227
|
-
if (lines.length > 0)
|
|
228
|
-
body += `\n\n${lines.join("\n")}`;
|
|
229
|
-
return dedent `
|
|
230
|
-
## Project Settings (Testomat.io)
|
|
231
|
-
|
|
232
|
-
${body}
|
|
233
|
-
|
|
234
|
-
Use these when creating or editing tests: assign only labels that exist here, reuse the existing tags/environments before inventing new ones, and match the project's framework/language when generating automated tests. The full configuration JSON (every label, tag, and CI profile config) is cached at \`.testeiya/project-info.json\` — read that file when you need the complete lists.
|
|
235
|
-
`;
|
|
236
|
-
}
|
|
237
|
-
// How to act on a connection whose token comes from the environment.
|
|
238
|
-
function envTokenActions(access) {
|
|
239
|
-
if (access === "mcp-proxy") {
|
|
240
|
-
return "For structured actions (list/create/update tests, runs, labels, suites, etc.) prefer the `mcp` tool: `mcp({ search })` to find an operation, `mcp({ tool })` to run it.";
|
|
241
|
-
}
|
|
242
|
-
if (access === "cli-only") {
|
|
243
|
-
return "For runs, plans, labels and analytics use `curl` against `/api/v2` — there are no Testomat.io tools in this session.";
|
|
244
|
-
}
|
|
245
|
-
return "If `testomatio-*` MCP tools are available, prefer them for structured actions (list/create/update tests, runs, labels, suites, etc.).";
|
|
246
|
-
}
|
|
247
|
-
// The same, where the harness runs one MCP server per pulled project.
|
|
248
|
-
function perProjectActions(access) {
|
|
249
|
-
if (access === "mcp-proxy") {
|
|
250
|
-
return "The **Testomat.io MCP server** is also connected, reached through the `mcp` tool (`mcp({ search })` to find an operation, `mcp({ tool })` to run it). Prefer it for structured actions (list/create/update tests, runs, labels, suites, etc.) — those are typed, safer, and faster than shell calls. Fall back to `bash` + `check-tests` only for things it does not cover (e.g. pulling full markdown files).";
|
|
251
|
-
}
|
|
252
|
-
if (access === "cli-only") {
|
|
253
|
-
return "There are no Testomat.io tools in this session: use `npx check-tests` for test cases and `curl` against `/api/v2` for runs, plans and labels.";
|
|
254
|
-
}
|
|
255
|
-
return "The **Testomat.io MCP server** is also auto-connected, one instance per project (tool prefix: `testomatio-<slug>`). Prefer MCP tools for structured actions (list/create/update tests, runs, labels, suites, etc.) — they are typed, safer, and faster than shell calls. Fall back to `bash` + `check-tests` only for things the MCP does not cover (e.g. pulling full markdown files).";
|
|
256
|
-
}
|
|
257
|
-
function capped(shown, total) {
|
|
258
|
-
let suffix = "";
|
|
259
|
-
if (total > shown.length) {
|
|
260
|
-
suffix = ` … and ${total - shown.length} more (see \`.testeiya/project-info.json\`)`;
|
|
261
|
-
}
|
|
262
|
-
return shown.join(", ") + suffix;
|
|
263
|
-
}
|
|
264
|
-
//# sourceMappingURL=testomatio.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"testomatio.js","sourceRoot":"","sources":["../../prompt/testomatio.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAG5B,MAAM,iB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C;IACzJ,CAAC;IACD,OAAO,yXAAyX,CAAC;AACnY,CAAC;AAED,SAAS,MAAM,CAAC,KAAe,EAAE,KAAa;IAC5C,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,IAAI,KAAK,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC;QACzB,MAAM,GAAG,UAAU,KAAK,GAAG,KAAK,CAAC,MAAM,6CAA6C,CAAC;IACvF,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACnC,CAAC"}
|
package/dist/prompt/tools.js
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { existsSync } from 'node:fs';
|
|
2
|
-
import { delimiter, join } from 'node:path';
|
|
3
|
-
import dedent from 'dedent';
|
|
4
|
-
/**
|
|
5
|
-
* The tools every harness gives the agent. Anything a particular harness adds —
|
|
6
|
-
* a question tool, a browser it can drive for a watching user — arrives as an
|
|
7
|
-
* extra bullet from that harness, since the agent must not be told about a tool
|
|
8
|
-
* it does not have.
|
|
9
|
-
*/
|
|
10
|
-
export function tools(options) {
|
|
11
|
-
const extra = (options?.extra ?? []).join('');
|
|
12
|
-
let routing = ' - GitHub: issues and projects through MCP.';
|
|
13
|
-
if (onPath('gh')) {
|
|
14
|
-
routing +=
|
|
15
|
-
'\n - Pull requests and repositories: `gh` in `bash`. When a PR question needs issue detail, query the issue through MCP — never infer it from a PR title.';
|
|
16
|
-
}
|
|
17
|
-
if (onPath('acli')) {
|
|
18
|
-
routing +=
|
|
19
|
-
'\n - Jira in bulk (many issues at once), boards, sprints and filters: `acli` in `bash`, per the `atlassian` skill. Confluence and attachments have no `acli` command and stay on MCP.';
|
|
20
|
-
}
|
|
21
|
-
if (onPath('glab')) {
|
|
22
|
-
routing +=
|
|
23
|
-
'\n - GitLab releases, labels, milestones, snippets, CI artifacts, and any endpoint with no MCP tool: `glab` in `bash`. Issues, merge requests, pipelines and code search stay on MCP, which covers them well.';
|
|
24
|
-
}
|
|
25
|
-
return dedent `
|
|
26
|
-
<available-tools>
|
|
27
|
-
You have these tools available:
|
|
28
|
-
* **Read operations (use freely):** \`read\`, \`grep\`, \`ls\`.
|
|
29
|
-
- Use these aggressively to understand the system under test before proposing changes.
|
|
30
|
-
* **Write operations (restricted):** \`write\`, \`edit\`, \`bash\`.
|
|
31
|
-
- Requires explicit user confirmation for destructive or shared-state actions.
|
|
32
|
-
${extra} * **Internal Skills:** For QA-related tasks, check available skills first and prefer using them when applicable.
|
|
33
|
-
* **External Integrations:** Use MCP tools when they provide superior data or specialized integrations.
|
|
34
|
-
- Primary MCP (Testomat.io): Use Testomat.io MCP tools to extend functionality.
|
|
35
|
-
- Secondary MCP (Jira, GitHub, etc.): Invoke only when user explicitly asks or when remote context exploration is required.
|
|
36
|
-
${routing}
|
|
37
|
-
|
|
38
|
-
<tool-governance>
|
|
39
|
-
* **Prioritize Specificity:** Use \`read\` instead of \`cat\`, and \`edit\` instead of \`sed\`. Dedicated tools provide better error tracking and safety.
|
|
40
|
-
* **Parallel Execution:** Call independent tools in parallel to minimize latency. Sequential calls are reserved for operations with data dependencies.
|
|
41
|
-
* **Atomic Updates:** Mark tasks as complete in your internal state immediately upon execution. Do not batch status updates.
|
|
42
|
-
* **Analysis-First:** Use your own reasoning to guide tool selection. Do not wait for step-by-step instructions if discovery tools can provide the answer.
|
|
43
|
-
</tool-governance>
|
|
44
|
-
</available-tools>
|
|
45
|
-
`;
|
|
46
|
-
}
|
|
47
|
-
/** Is this CLI on PATH? Never tell the agent to use a binary this machine lacks. */
|
|
48
|
-
function onPath(bin) {
|
|
49
|
-
for (const dir of (process.env.PATH ?? '').split(delimiter)) {
|
|
50
|
-
if (!dir)
|
|
51
|
-
continue;
|
|
52
|
-
if (existsSync(join(dir, bin)) || existsSync(join(dir, `${bin}.exe`)))
|
|
53
|
-
return true;
|
|
54
|
-
}
|
|
55
|
-
return false;
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* CLIs Testeiya knows how to connect, probed on PATH — the same trio routed in
|
|
59
|
-
* `<available-tools>` above. Shared with the prompt's connections section so
|
|
60
|
-
* the two can never disagree about whether `gh` etc. exist.
|
|
61
|
-
*/
|
|
62
|
-
export const KNOWN_CLIS = [
|
|
63
|
-
{ bin: 'gh', label: 'gh (GitHub CLI)' },
|
|
64
|
-
{ bin: 'acli', label: 'acli (Atlassian CLI)' },
|
|
65
|
-
{ bin: 'glab', label: 'glab (GitLab CLI)' },
|
|
66
|
-
];
|
|
67
|
-
export function pathClis() {
|
|
68
|
-
return KNOWN_CLIS.filter((c) => onPath(c.bin)).map((c) => c.label);
|
|
69
|
-
}
|
|
70
|
-
//# sourceMappingURL=tools.js.map
|
package/dist/prompt/tools.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tools.js","sourceRoot":"","sources":["../../prompt/tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAE5C,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B;;;;;GAKG;AACH,MAAM,UAAU,KAAK,CAAC,OAA8B;IAClD,MAAM,KAAK,GAAG,CAAC,OAAO,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC9C,IAAI,OAAO,GAAG,gDAAgD,CAAC;IAC/D,IAAI,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;QACjB,OAAO;YACL,8JAA8J,CAAC;IACnK,CAAC;IACD,IAAI,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;QACnB,OAAO;YACL,0LAA0L,CAAC;IAC/L,CAAC;IACD,IAAI,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;QACnB,OAAO;YACL,kNAAkN,CAAC;IACvN,CAAC;IACD,OAAO,MAAM,CAAA;;;;;;;EAOb,KAAK;;;;EAIL,OAAO;;;;;;;;;CASR,CAAC;AACF,CAAC;AAED,oFAAoF;AACpF,SAAS,MAAM,CAAC,GAAW;IACzB,KAAK,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,CAAC;QAC5D,IAAI,CAAC,GAAG;YAAE,SAAS;QACnB,IAAI,UAAU,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,IAAI,UAAU,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,GAAG,MAAM,CAAC,CAAC;YAAE,OAAO,IAAI,CAAC;IACrF,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,UAAU,GAAqC;IAC1D,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,iBAAiB,EAAE;IACvC,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,sBAAsB,EAAE;IAC9C,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,mBAAmB,EAAE;CAC5C,CAAC;AAEF,MAAM,UAAU,QAAQ;IACtB,OAAO,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;AACrE,CAAC"}
|
package/dist/prompt/vocab.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The per-project config directory name, as the agent knows it. Part of the
|
|
3
|
-
* vocabulary the system prompt teaches — every path the prompt names below it
|
|
4
|
-
* (`.testeiya/manual-tests`, `.testeiya/project-info.json`, …) is built from
|
|
5
|
-
* this constant, so the prompt and the harness can never disagree about it.
|
|
6
|
-
*/
|
|
7
|
-
export const TESTEIYA_DIR_NAME = ".testeiya";
|
|
8
|
-
//# sourceMappingURL=vocab.js.map
|
package/dist/prompt/vocab.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"vocab.js","sourceRoot":"","sources":["../../prompt/vocab.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,WAAW,CAAC"}
|
package/prompt/context.ts
DELETED
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import dedent from "dedent";
|
|
2
|
-
import { TESTEIYA_DIR_NAME } from "./vocab.js";
|
|
3
|
-
|
|
4
|
-
/** System-prompt section describing the workspace context; "" when none. */
|
|
5
|
-
export function contextPromptSection(
|
|
6
|
-
entries: ContextEntry[],
|
|
7
|
-
folders: ContextFolder[] = []
|
|
8
|
-
): string {
|
|
9
|
-
if (entries.length === 0 && folders.length === 0) return "";
|
|
10
|
-
return dedent`
|
|
11
|
-
<workspace-context>
|
|
12
|
-
This workspace has context attached — the user (or you, earlier) put it there for a purpose. Consult it before answering, and prefer it over assumptions about the project.
|
|
13
|
-
|
|
14
|
-
${contextLines(entries, folders)}
|
|
15
|
-
|
|
16
|
-
Everything whose path starts with \`${TESTEIYA_DIR_NAME}/\` is in a hidden dir: file-search tools skip hidden dirs by default, so search those explicitly (pass hidden:true, or prefix the path with \`${TESTEIYA_DIR_NAME}/\`). Any other path above is an ordinary workspace path the user attached — read it where it is. Linked folders and cloned repositories are reference material: read them, never modify them. A linked folder is a symlink — wildcard searches do not descend into it; search it with its own path prefix (e.g. \`${TESTEIYA_DIR_NAME}/<name>/\`). Documents under \`${TESTEIYA_DIR_NAME}/requirements\` and \`${TESTEIYA_DIR_NAME}/docs\` are specs and plans — use them when writing or reviewing tests.
|
|
17
|
-
</workspace-context>
|
|
18
|
-
`;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/** Per-prompt notice when the context changed mid-session; appended to the next prompt. */
|
|
22
|
-
export function contextUpdateNotice(
|
|
23
|
-
entries: ContextEntry[],
|
|
24
|
-
folders: ContextFolder[] = []
|
|
25
|
-
): string {
|
|
26
|
-
if (entries.length === 0 && folders.length === 0) {
|
|
27
|
-
return dedent`
|
|
28
|
-
<workspace-context-update>
|
|
29
|
-
All extra workspace context was removed. Do not rely on it anymore.
|
|
30
|
-
</workspace-context-update>
|
|
31
|
-
`;
|
|
32
|
-
}
|
|
33
|
-
return dedent`
|
|
34
|
-
<workspace-context-update>
|
|
35
|
-
The workspace context just changed. It now contains:
|
|
36
|
-
|
|
37
|
-
${contextLines(entries, folders)}
|
|
38
|
-
|
|
39
|
-
This was done for a purpose — take it into account for this and future requests. Remember \`${TESTEIYA_DIR_NAME}/\` is hidden: search it with hidden:true or an explicit path prefix.
|
|
40
|
-
</workspace-context-update>
|
|
41
|
-
`;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
function contextLines(entries: ContextEntry[], folders: ContextFolder[]): string {
|
|
45
|
-
const lines: string[] = [];
|
|
46
|
-
const covered = new Set(entries.map((e) => parentDir(e.path)));
|
|
47
|
-
for (const f of folders) {
|
|
48
|
-
if (covered.has(f.path)) continue;
|
|
49
|
-
lines.push(`- \`${f.path}/\` — ${folderPurpose(f.name)}`);
|
|
50
|
-
}
|
|
51
|
-
for (const e of entries) lines.push(`- ${describeEntry(e)}`);
|
|
52
|
-
return lines.join("\n");
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
function folderPurpose(name: string): string {
|
|
56
|
-
if (name === "manual-tests") {
|
|
57
|
-
return "the project's manual test suites pulled from Testomat.io (*.test.md — THE manual tests of this project)";
|
|
58
|
-
}
|
|
59
|
-
if (name === "code") return "reference code added as context";
|
|
60
|
-
if (name === "requirements") return "requirements and specs";
|
|
61
|
-
if (name === "docs") return "test planning and strategy documents";
|
|
62
|
-
if (name === "auto-tests") return "automated test references";
|
|
63
|
-
return "exploratory testing setup";
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
function parentDir(rel: string): string {
|
|
67
|
-
const idx = rel.lastIndexOf("/");
|
|
68
|
-
if (idx < 0) return "";
|
|
69
|
-
return rel.slice(0, idx);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
function describeEntry(e: ContextEntry): string {
|
|
73
|
-
const date = e.addedAt?.split("T")[0] ?? "";
|
|
74
|
-
// A path outside the hidden dir is one the user attached where it already
|
|
75
|
-
// lives — it is part of the project, not reference material dropped beside it.
|
|
76
|
-
if (!e.path.startsWith(`${TESTEIYA_DIR_NAME}/`)) {
|
|
77
|
-
let what = "folder";
|
|
78
|
-
if (e.kind === "file") what = "file";
|
|
79
|
-
return `\`${e.path}\` — workspace ${what}, attached by the user (${date})`;
|
|
80
|
-
}
|
|
81
|
-
let from = "";
|
|
82
|
-
if (e.origin && e.origin !== e.name) from = ` from ${e.origin}`;
|
|
83
|
-
if (e.kind === "repo") return `\`${e.path}\` — git repository${from} (${date})`;
|
|
84
|
-
if (e.kind === "folder") return `\`${e.path}\` — local folder${from} (${date})`;
|
|
85
|
-
return `\`${e.path}\` — document${from} (${date})`;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
export type ContextKind = "folder" | "repo" | "file";
|
|
89
|
-
|
|
90
|
-
/** A top-level `.testeiya` folder shown as a status-bar section. */
|
|
91
|
-
export interface ContextFolder {
|
|
92
|
-
name: string;
|
|
93
|
-
/** Relative to cwd (`.testeiya/<name>`). */
|
|
94
|
-
path: string;
|
|
95
|
-
/** Direct children (files + dirs, dot entries excluded). */
|
|
96
|
-
count: number;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
export interface ContextEntry {
|
|
100
|
-
id: string;
|
|
101
|
-
kind: ContextKind;
|
|
102
|
-
name: string;
|
|
103
|
-
/** Location inside the workspace, relative to cwd (always under `.testeiya/`). */
|
|
104
|
-
path: string;
|
|
105
|
-
/** Where it came from: an absolute local path, a git URL, or the uploaded filename. */
|
|
106
|
-
origin: string;
|
|
107
|
-
addedAt: string;
|
|
108
|
-
}
|
package/prompt/index.ts
DELETED
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import { getSystemPrompt } from "./system-prompt.js";
|
|
2
|
-
import {
|
|
3
|
-
testomatioTms,
|
|
4
|
-
testomatioConnection,
|
|
5
|
-
testomatioNotConnected,
|
|
6
|
-
projectSettings,
|
|
7
|
-
type TmsAccess,
|
|
8
|
-
} from "./testomatio.js";
|
|
9
|
-
import { briefAnswer, nonInteractive, reportOutput } from "./print.js";
|
|
10
|
-
import {
|
|
11
|
-
contextPromptSection,
|
|
12
|
-
type ContextEntry,
|
|
13
|
-
type ContextFolder,
|
|
14
|
-
} from "./context.js";
|
|
15
|
-
import type { TestomatioProjectInfo } from "./project-info.js";
|
|
16
|
-
|
|
17
|
-
export function buildSystemPrompt(options?: SystemPromptOptions): string {
|
|
18
|
-
const mode = options?.mode ?? "tui";
|
|
19
|
-
const interactive = mode !== "print";
|
|
20
|
-
|
|
21
|
-
// The base prompt (role, workspace, tools, goals) comes first — it defines who
|
|
22
|
-
// the agent is. Specialized rules layer on after it, dynamic context goes last.
|
|
23
|
-
// Anything only one harness can do — its own question tool, a browser it can
|
|
24
|
-
// open for a watching user — reaches the prompt through `sections`,
|
|
25
|
-
// `toolBullets` and `rules`, never from here.
|
|
26
|
-
const parts: string[] = [
|
|
27
|
-
getSystemPrompt(options?.cwd, {
|
|
28
|
-
interactive,
|
|
29
|
-
toolBullets: options?.toolBullets,
|
|
30
|
-
rules: options?.rules,
|
|
31
|
-
connectedClis: options?.connectedClis,
|
|
32
|
-
connectedMcps: options?.connectedMcps,
|
|
33
|
-
}),
|
|
34
|
-
];
|
|
35
|
-
|
|
36
|
-
const tokenSlugs = options?.tokens ? Object.keys(options.tokens) : [];
|
|
37
|
-
// The TUI passes no `connection`, so it keeps the managed-tokens gating.
|
|
38
|
-
const tokenAvailable = options?.connection?.tokenAvailable ?? tokenSlugs.length > 0;
|
|
39
|
-
const tms = options?.tms ?? "mcp-direct";
|
|
40
|
-
// Gated on the same condition as the connection section below: both describe
|
|
41
|
-
// the same connection, and the rules are just as needed when the token comes
|
|
42
|
-
// from the environment rather than from a per-project session token.
|
|
43
|
-
if (tokenAvailable || tokenSlugs.length > 0) parts.push(testomatioTms(tms));
|
|
44
|
-
if (mode === "print") parts.push(nonInteractive);
|
|
45
|
-
// Whatever this harness alone can offer — its chat-app UI tools, a browser it
|
|
46
|
-
// can open for a watching user. A one-shot CLI contributes none of it, and
|
|
47
|
-
// `nonInteractive` tells the agent to report such a gap rather than try.
|
|
48
|
-
for (const section of options?.sections ?? []) parts.push(section);
|
|
49
|
-
|
|
50
|
-
if (options?.promptContext) {
|
|
51
|
-
parts.push(`## Project Test Context\n\n${options.promptContext}`);
|
|
52
|
-
}
|
|
53
|
-
if (options?.contextEntries?.length || options?.contextFolders?.length) {
|
|
54
|
-
parts.push(
|
|
55
|
-
contextPromptSection(options.contextEntries ?? [], options.contextFolders ?? [])
|
|
56
|
-
);
|
|
57
|
-
}
|
|
58
|
-
if (options?.projectInfo) {
|
|
59
|
-
parts.push(projectSettings(options.projectInfo));
|
|
60
|
-
}
|
|
61
|
-
if (tokenAvailable || tokenSlugs.length > 0) {
|
|
62
|
-
parts.push(testomatioConnection(tokenSlugs, options?.backendUrl, options?.connection, tms));
|
|
63
|
-
} else if (mode === "web" || mode === "print") {
|
|
64
|
-
parts.push(testomatioNotConnected());
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
// The answer contract goes last so it is the final instruction the model reads.
|
|
68
|
-
if (options?.brief) parts.push(briefAnswer);
|
|
69
|
-
if (options?.outputFile) parts.push(reportOutput(options.outputFile));
|
|
70
|
-
|
|
71
|
-
return parts.join("\n\n");
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export interface SystemPromptOptions {
|
|
75
|
-
cwd?: string;
|
|
76
|
-
promptContext?: string;
|
|
77
|
-
backendUrl?: string;
|
|
78
|
-
tokens?: Record<string, string>;
|
|
79
|
-
connection?: { tokenAvailable?: boolean; projectId?: string; title?: string };
|
|
80
|
-
mode?: "tui" | "web" | "print";
|
|
81
|
-
/** Whole sections this harness contributes (chat-app UI tools, live browser). */
|
|
82
|
-
sections?: string[];
|
|
83
|
-
/** Extra `<available-tools>` bullets for tools only this harness provides. */
|
|
84
|
-
toolBullets?: string[];
|
|
85
|
-
/** Extra `<rules>` bullets, for rules that only hold in this harness. */
|
|
86
|
-
rules?: string[];
|
|
87
|
-
/** How the agent reaches Testomat.io; defaults to `mcp-direct`. */
|
|
88
|
-
tms?: TmsAccess;
|
|
89
|
-
/** Absolute path the agent must write its final report to (`--output`). */
|
|
90
|
-
outputFile?: string;
|
|
91
|
-
/** Answer a question instead of doing a task and reporting (`testeiya ask`). */
|
|
92
|
-
brief?: boolean;
|
|
93
|
-
projectInfo?: TestomatioProjectInfo | null;
|
|
94
|
-
/** User-added context (linked folders, cloned repos, uploaded docs). */
|
|
95
|
-
contextEntries?: ContextEntry[];
|
|
96
|
-
/** Non-empty predefined `.testeiya` context folders (manual-tests, code, …). */
|
|
97
|
-
contextFolders?: ContextFolder[];
|
|
98
|
-
/** CLI tools the user has connected and signed in (e.g. `gh`, `acli`). */
|
|
99
|
-
connectedClis?: string[];
|
|
100
|
-
/** MCP servers connected for this session (the enabled `mcp.json` set). */
|
|
101
|
-
connectedMcps?: string[];
|
|
102
|
-
}
|
package/prompt/print.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import dedent from "dedent";
|
|
2
|
-
|
|
3
|
-
export const nonInteractive = dedent`
|
|
4
|
-
<non-interactive>
|
|
5
|
-
* Nobody is watching this session. There is no way to ask a question and no answer will ever come.
|
|
6
|
-
* Resolve every ambiguity yourself: pick the most reasonable reading and state the assumption in your output.
|
|
7
|
-
* Never wait for input, confirmation, or approval. Finish the whole task in this run.
|
|
8
|
-
* Missing credentials or an unreachable app are blockers, not questions — report them as the outcome.
|
|
9
|
-
* Do not launch or drive a browser. If the task needs one, report what it would take and stop.
|
|
10
|
-
* Call \`set_result\` with \`fail\` and a one-line reason when the verdict is negative: regressions found, a quality gate unmet, tests broken, or the task could not be completed. Otherwise do not call it — silence means success.
|
|
11
|
-
</non-interactive>
|
|
12
|
-
`;
|
|
13
|
-
|
|
14
|
-
export function reportOutput(path: string): string {
|
|
15
|
-
return dedent`
|
|
16
|
-
<final-report>
|
|
17
|
-
* Write your complete final report to \`${path}\` with the \`write\` tool. Writing it is required before you finish.
|
|
18
|
-
* That file is your answer — it is the run's deliverable. Nothing else you say is kept.
|
|
19
|
-
* Markdown. Open with an \`#\` title, then the findings. Overwrite the file; never append.
|
|
20
|
-
* Keep your chat replies short: the report carries the detail.
|
|
21
|
-
</final-report>
|
|
22
|
-
`;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export const briefAnswer = dedent`
|
|
26
|
-
<answer>
|
|
27
|
-
* You were asked a question, not given a task. Answer it.
|
|
28
|
-
* Lead with the answer in one line, then the evidence you checked.
|
|
29
|
-
* A few sentences. No report file, no headings, no plan.
|
|
30
|
-
* Say plainly when what you found does not settle the question.
|
|
31
|
-
</answer>
|
|
32
|
-
`;
|
package/prompt/project-info.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A project's configuration as Testomat.io reports it (`GET /api/v2/{id}/info`).
|
|
3
|
-
* Rendered into the system prompt by `projectSettings` so the agent assigns only
|
|
4
|
-
* labels that exist, reuses the project's tags and environments, and matches its
|
|
5
|
-
* framework when writing automated tests.
|
|
6
|
-
*/
|
|
7
|
-
export interface TestomatioProjectInfo {
|
|
8
|
-
title: string;
|
|
9
|
-
project_id: string;
|
|
10
|
-
framework: string | null;
|
|
11
|
-
language: string | null;
|
|
12
|
-
status: string | null;
|
|
13
|
-
repository_url: string | null;
|
|
14
|
-
artifacts_storage_enabled: boolean;
|
|
15
|
-
environments: string[];
|
|
16
|
-
labels: { title: string; slug: string }[];
|
|
17
|
-
tags: string[];
|
|
18
|
-
subscription: string | null;
|
|
19
|
-
features: string[];
|
|
20
|
-
ci_profiles: TestomatioCiProfile[];
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export interface TestomatioCiProfile {
|
|
24
|
-
profile_name: string;
|
|
25
|
-
service: string | null;
|
|
26
|
-
config: Record<string, unknown> | null;
|
|
27
|
-
pass_testomatio_key: boolean;
|
|
28
|
-
pass_testomatio_url: boolean;
|
|
29
|
-
pass_run_id: boolean;
|
|
30
|
-
}
|