testeiya 0.3.9 → 0.3.14

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.
Files changed (180) hide show
  1. package/README.md +353 -27
  2. package/dist/prompt/index.js +6 -2
  3. package/dist/prompt/index.js.map +1 -1
  4. package/dist/prompt/print.js +8 -0
  5. package/dist/prompt/print.js.map +1 -1
  6. package/dist/prompt/system-prompt.js +14 -4
  7. package/dist/prompt/system-prompt.js.map +1 -1
  8. package/dist/prompt/testomatio.js +3 -3
  9. package/dist/prompt/tools.js +28 -7
  10. package/dist/prompt/tools.js.map +1 -1
  11. package/dist/src/args.js +198 -46
  12. package/dist/src/args.js.map +1 -1
  13. package/dist/src/cli.js +64 -20
  14. package/dist/src/cli.js.map +1 -1
  15. package/dist/src/doctor.js +171 -0
  16. package/dist/src/doctor.js.map +1 -0
  17. package/dist/src/env.js +39 -5
  18. package/dist/src/env.js.map +1 -1
  19. package/dist/src/mcp.js +3 -3
  20. package/dist/src/mcp.js.map +1 -1
  21. package/dist/src/model.js +15 -10
  22. package/dist/src/model.js.map +1 -1
  23. package/dist/src/models.js +38 -0
  24. package/dist/src/models.js.map +1 -0
  25. package/dist/src/output.js +216 -0
  26. package/dist/src/output.js.map +1 -0
  27. package/dist/src/run.js +141 -27
  28. package/dist/src/run.js.map +1 -1
  29. package/dist/src/session.js +46 -25
  30. package/dist/src/session.js.map +1 -1
  31. package/dist/src/sessions.js +72 -0
  32. package/dist/src/sessions.js.map +1 -0
  33. package/dist/src/skills.js +130 -0
  34. package/dist/src/skills.js.map +1 -0
  35. package/package.json +7 -3
  36. package/prompt/index.ts +11 -2
  37. package/prompt/print.ts +9 -0
  38. package/prompt/system-prompt.ts +18 -4
  39. package/prompt/testomatio.ts +3 -3
  40. package/prompt/tools.ts +30 -7
  41. package/skills/codeceptjs/ci-fix-tests/SKILL.md +119 -0
  42. package/skills/codeceptjs/codeceptjs-auth/SKILL.md +141 -0
  43. package/skills/codeceptjs/codeceptjs-exploration/SKILL.md +100 -0
  44. package/skills/codeceptjs/codeceptjs-fundamentals/SKILL.md +196 -0
  45. package/skills/codeceptjs/codeceptjs-run-analysis/SKILL.md +83 -0
  46. package/skills/codeceptjs/debugging-codeceptjs-tests/SKILL.md +126 -0
  47. package/skills/codeceptjs/migrate-codeceptjs-4/SKILL.md +109 -0
  48. package/skills/codeceptjs/migrate-cypress-to-codeceptjs/SKILL.md +295 -0
  49. package/skills/codeceptjs/migrate-protractor-to-codeceptjs/SKILL.md +339 -0
  50. package/skills/codeceptjs/migrate-selenium-java-to-codeceptjs/SKILL.md +459 -0
  51. package/skills/codeceptjs/migrate-testcafe-to-codeceptjs/SKILL.md +338 -0
  52. package/skills/codeceptjs/refactoring-codeceptjs-tests/SKILL.md +78 -0
  53. package/skills/codeceptjs/writing-codeceptjs-tests/SKILL.md +102 -0
  54. package/skills/playwright/playwright-best-practices/SKILL.md +303 -0
  55. package/skills/playwright/playwright-best-practices/advanced/authentication-flows.md +360 -0
  56. package/skills/playwright/playwright-best-practices/advanced/authentication.md +871 -0
  57. package/skills/playwright/playwright-best-practices/advanced/clock-mocking.md +364 -0
  58. package/skills/playwright/playwright-best-practices/advanced/mobile-testing.md +409 -0
  59. package/skills/playwright/playwright-best-practices/advanced/multi-context.md +288 -0
  60. package/skills/playwright/playwright-best-practices/advanced/multi-user.md +393 -0
  61. package/skills/playwright/playwright-best-practices/advanced/network-advanced.md +452 -0
  62. package/skills/playwright/playwright-best-practices/advanced/third-party.md +464 -0
  63. package/skills/playwright/playwright-best-practices/architecture/pom-vs-fixtures.md +363 -0
  64. package/skills/playwright/playwright-best-practices/architecture/test-architecture.md +369 -0
  65. package/skills/playwright/playwright-best-practices/architecture/when-to-mock.md +383 -0
  66. package/skills/playwright/playwright-best-practices/browser-apis/browser-apis.md +391 -0
  67. package/skills/playwright/playwright-best-practices/browser-apis/iframes.md +403 -0
  68. package/skills/playwright/playwright-best-practices/browser-apis/service-workers.md +504 -0
  69. package/skills/playwright/playwright-best-practices/browser-apis/websockets.md +403 -0
  70. package/skills/playwright/playwright-best-practices/core/annotations.md +424 -0
  71. package/skills/playwright/playwright-best-practices/core/assertions-waiting.md +361 -0
  72. package/skills/playwright/playwright-best-practices/core/configuration.md +452 -0
  73. package/skills/playwright/playwright-best-practices/core/fixtures-hooks.md +417 -0
  74. package/skills/playwright/playwright-best-practices/core/global-setup.md +434 -0
  75. package/skills/playwright/playwright-best-practices/core/locators.md +242 -0
  76. package/skills/playwright/playwright-best-practices/core/page-object-model.md +315 -0
  77. package/skills/playwright/playwright-best-practices/core/projects-dependencies.md +453 -0
  78. package/skills/playwright/playwright-best-practices/core/test-data.md +492 -0
  79. package/skills/playwright/playwright-best-practices/core/test-suite-structure.md +361 -0
  80. package/skills/playwright/playwright-best-practices/core/test-tags.md +298 -0
  81. package/skills/playwright/playwright-best-practices/debugging/console-errors.md +420 -0
  82. package/skills/playwright/playwright-best-practices/debugging/debugging.md +504 -0
  83. package/skills/playwright/playwright-best-practices/debugging/error-testing.md +360 -0
  84. package/skills/playwright/playwright-best-practices/debugging/flaky-tests.md +496 -0
  85. package/skills/playwright/playwright-best-practices/frameworks/angular.md +530 -0
  86. package/skills/playwright/playwright-best-practices/frameworks/nextjs.md +469 -0
  87. package/skills/playwright/playwright-best-practices/frameworks/react.md +531 -0
  88. package/skills/playwright/playwright-best-practices/frameworks/vue.md +574 -0
  89. package/skills/playwright/playwright-best-practices/infrastructure-ci-cd/ci-cd.md +468 -0
  90. package/skills/playwright/playwright-best-practices/infrastructure-ci-cd/docker.md +283 -0
  91. package/skills/playwright/playwright-best-practices/infrastructure-ci-cd/github-actions.md +546 -0
  92. package/skills/playwright/playwright-best-practices/infrastructure-ci-cd/gitlab.md +397 -0
  93. package/skills/playwright/playwright-best-practices/infrastructure-ci-cd/other-providers.md +521 -0
  94. package/skills/playwright/playwright-best-practices/infrastructure-ci-cd/parallel-sharding.md +371 -0
  95. package/skills/playwright/playwright-best-practices/infrastructure-ci-cd/performance.md +453 -0
  96. package/skills/playwright/playwright-best-practices/infrastructure-ci-cd/reporting.md +424 -0
  97. package/skills/playwright/playwright-best-practices/infrastructure-ci-cd/test-coverage.md +497 -0
  98. package/skills/playwright/playwright-best-practices/testing-patterns/accessibility.md +359 -0
  99. package/skills/playwright/playwright-best-practices/testing-patterns/api-testing.md +719 -0
  100. package/skills/playwright/playwright-best-practices/testing-patterns/browser-extensions.md +506 -0
  101. package/skills/playwright/playwright-best-practices/testing-patterns/canvas-webgl.md +493 -0
  102. package/skills/playwright/playwright-best-practices/testing-patterns/component-testing.md +500 -0
  103. package/skills/playwright/playwright-best-practices/testing-patterns/drag-drop.md +576 -0
  104. package/skills/playwright/playwright-best-practices/testing-patterns/electron.md +509 -0
  105. package/skills/playwright/playwright-best-practices/testing-patterns/file-operations.md +377 -0
  106. package/skills/playwright/playwright-best-practices/testing-patterns/file-upload-download.md +562 -0
  107. package/skills/playwright/playwright-best-practices/testing-patterns/forms-validation.md +561 -0
  108. package/skills/playwright/playwright-best-practices/testing-patterns/graphql-testing.md +331 -0
  109. package/skills/playwright/playwright-best-practices/testing-patterns/i18n.md +508 -0
  110. package/skills/playwright/playwright-best-practices/testing-patterns/performance-testing.md +476 -0
  111. package/skills/playwright/playwright-best-practices/testing-patterns/security-testing.md +430 -0
  112. package/skills/playwright/playwright-best-practices/testing-patterns/visual-regression.md +634 -0
  113. package/skills/playwright/playwright-cli/SKILL.md +420 -0
  114. package/skills/playwright/playwright-cli/references/element-attributes.md +23 -0
  115. package/skills/playwright/playwright-cli/references/playwright-tests.md +39 -0
  116. package/skills/playwright/playwright-cli/references/request-mocking.md +87 -0
  117. package/skills/playwright/playwright-cli/references/running-code.md +241 -0
  118. package/skills/playwright/playwright-cli/references/session-management.md +225 -0
  119. package/skills/playwright/playwright-cli/references/storage-state.md +275 -0
  120. package/skills/playwright/playwright-cli/references/test-generation.md +433 -0
  121. package/skills/playwright/playwright-cli/references/tracing.md +139 -0
  122. package/skills/playwright/playwright-cli/references/video-recording.md +143 -0
  123. package/skills/skills.lock.json +41 -37
  124. package/skills/skills.yaml +1 -0
  125. package/skills/testomatio/explorbot/explorbot-fundamentals/SKILL.md +76 -0
  126. package/skills/testomatio/explorbot/explorbot-fundamentals/references/no-install.md +36 -0
  127. package/skills/testomatio/explorbot/explorbot-plan/SKILL.md +108 -0
  128. package/skills/testomatio/explorbot/explorbot-setup/SKILL.md +86 -0
  129. package/skills/testomatio/explorbot/prima/SKILL.md +87 -0
  130. package/skills/testomatio/qa-process/qa-explain-behavior/SKILL.md +111 -0
  131. package/skills/testomatio/qa-process/qa-explain-behavior/references/answer-shapes.md +116 -0
  132. package/skills/testomatio/qa-process/qa-explain-behavior/references/examples.md +157 -0
  133. package/skills/testomatio/qa-process/qa-lead-strategy-advisor/SKILL.md +91 -0
  134. package/skills/testomatio/qa-process/qa-lead-strategy-advisor/references/output-format.md +71 -0
  135. package/skills/testomatio/qa-process/testing-workflow/SKILL.md +227 -0
  136. package/skills/testomatio/test-automation/automate-manual-test-cases/CLAUDE.md +56 -0
  137. package/skills/testomatio/test-automation/automate-manual-test-cases/SKILL.md +242 -0
  138. package/skills/testomatio/test-automation/automate-manual-test-cases/references/CODECEPTJS_BEST_PRACTICES.md +182 -0
  139. package/skills/testomatio/test-automation/automate-manual-test-cases/references/FINAL_SUMMARY_TEMPLATE.md +22 -0
  140. package/skills/testomatio/test-automation/automate-manual-test-cases/references/PLAYWRIGHT_BEST_PRACTICES.md +90 -0
  141. package/skills/testomatio/test-automation/automate-manual-test-cases/references/POM_BEST_PRACTICES.md +53 -0
  142. package/skills/testomatio/test-automation/automate-manual-test-cases/references/TEST_DATA_MANAGEMENT.md +52 -0
  143. package/skills/testomatio/test-automation/debug-fix-failed-flaky-autotests/SKILL.md +107 -0
  144. package/skills/testomatio/test-automation/debug-fix-failed-flaky-autotests/references/DEBUGGING_QUICK_REFERENCE.md +113 -0
  145. package/skills/testomatio/test-automation/qa-automation-test-consolidation/SKILL.md +29 -0
  146. package/skills/testomatio/test-automation/qa-data-seeder/SKILL.md +83 -0
  147. package/skills/testomatio/test-automation/run-tests-with-testomatio-reporter/SKILL.md +153 -0
  148. package/skills/testomatio/test-automation/setup-change-aware-pr-testing/SKILL.md +190 -0
  149. package/skills/testomatio/test-automation/setup-ci-automation/SKILL.md +76 -0
  150. package/skills/testomatio/test-automation/testomat-allure-adapter/SKILL.md +289 -0
  151. package/skills/testomatio/test-management/detect-duplicate-test-cases/SKILL.md +86 -0
  152. package/skills/testomatio/test-management/detect-duplicate-test-cases/references/DUPLICATE_INSTRUCTIONS.md +54 -0
  153. package/skills/testomatio/test-management/improve-test-cases/SKILL.md +114 -0
  154. package/skills/testomatio/test-management/improve-test-cases/references/TESTOMAT_MARKDOWN_EXAMPLE.md +66 -0
  155. package/skills/testomatio/test-management/pull-request-diff-analyzer/SKILL.md +141 -0
  156. package/skills/testomatio/test-management/qa-e2e-tests-reporting/SKILL.md +354 -0
  157. package/skills/testomatio/test-management/qa-e2e-tests-reporting/references/TESTOMATIO_ARTIFACTS.md +82 -0
  158. package/skills/testomatio/test-management/qa-e2e-tests-reporting/references/TESTOMATIO_HTML_REPORT.md +37 -0
  159. package/skills/testomatio/test-management/qa-e2e-tests-reporting/references/TESTOMATIO_REPORTERS_CONFIG.md +118 -0
  160. package/skills/testomatio/test-management/qa-pr-requirements-analyzer/SKILL.md +149 -0
  161. package/skills/testomatio/test-management/qa-pr-requirements-analyzer/references/summary-example.md +54 -0
  162. package/skills/testomatio/test-management/qa-requirement-reviewer/SKILL.md +126 -0
  163. package/skills/testomatio/test-management/qa-requirement-reviewer/references/requirements_reviewer_examples.md +128 -0
  164. package/skills/testomatio/test-management/qa-split-testing-levels-pyramid/SKILL.md +55 -0
  165. package/skills/testomatio/test-management/qa-sprint-report-by-testomatio/SKILL.md +220 -0
  166. package/skills/testomatio/test-management/qa-sprint-report-by-testomatio/references/qa-sprint-report.md +126 -0
  167. package/skills/testomatio/test-management/qa-test-code-coverage/SKILL.md +174 -0
  168. package/skills/testomatio/test-management/qa-test-code-coverage/references/COVERAGE_FILE_FORMAT.md +138 -0
  169. package/skills/testomatio/test-management/qa-test-code-coverage/references/E2E_FRAMEWORKS.md +65 -0
  170. package/skills/testomatio/test-management/qa-test-code-coverage/scripts/check-coverage.mjs +40 -0
  171. package/skills/testomatio/test-management/qa-thinking/SKILL.md +36 -0
  172. package/skills/testomatio/test-management/qa-write-test-cases/SKILL.md +267 -0
  173. package/skills/testomatio/test-management/qa-write-test-cases/references/test-case-format.md +387 -0
  174. package/skills/testomatio/test-management/qa-write-test-cases/references/testomat-tms-guide.md +72 -0
  175. package/skills/testomatio/test-management/qa-write-test-cases/references/writing-rule.md +159 -0
  176. package/skills/testomatio/test-management/scan-automation-project/SKILL.md +152 -0
  177. package/skills/testomatio/test-management/sync-test-cases-with-tms/SKILL.md +107 -0
  178. package/skills/testomatio/test-management/sync-test-cases-with-tms/references/TESTOMATIO_CLI.md +140 -0
  179. package/skills/testomatio/test-management/testomatio-mcp/SKILL.md +195 -0
  180. package/skills/testomatio/test-management/testomatio-mcp/references/MCP_SETUP.md +177 -0
package/dist/src/args.js CHANGED
@@ -1,72 +1,224 @@
1
1
  import { parseArgs } from "node:util";
2
- export const USAGE = `testeiya — AI testing agent
2
+ export const WELCOME = `
3
+ Testeiya, an AI testing agent.
4
+
5
+ testeiya task "analyze this pr and find inconsistencies"
6
+ testeiya ask "is this feature ready"
7
+
8
+ testeiya doctor check your setup
9
+ testeiya --help options and environment
10
+ testeiya help the full guide
11
+ `;
12
+ export const USAGE = `testeiya, an AI testing agent
3
13
 
4
14
  Usage:
5
- testeiya "<task>" --model <provider>/<id> [--output <file>]
6
- cat task.md | testeiya [--output <file>]
15
+ testeiya task "<task>" run one task and write a report
16
+ testeiya ask "<question>" answer a question
17
+ testeiya doctor check what a run would resolve
18
+ testeiya models [pattern] list the models your key can reach
19
+ testeiya skills [pattern] list the skills bundled with this package
20
+ testeiya sessions list saved sessions for this folder
7
21
 
8
22
  Options:
9
- -o, --output <file.md> file the agent must write its report to
10
- -p, --print <task> same as passing the task positionally
11
- --model <id> provider/model to use, e.g. openrouter/anthropic/claude-sonnet-5
12
- --project <id> Testomat.io project id (same as TESTOMATIO_PROJECT_ID)
13
- -h, --help show this help
23
+ -o, --output <dest> report destination, repeatable: file.md, file.json, gh:pr-comment
24
+ --model <id> provider/model to run
25
+ --project <id> Testomat.io project id
26
+ -c, --continue continue the last session in this folder
27
+ --resume <id> continue that session
28
+ --session <label> continue the session with that name, or start it
29
+ --name <label> name the session
30
+ --no-session do not save the session
31
+ --exit-zero a negative verdict exits 0
32
+ --header <text> line added above the report
33
+ --footer <text> line added under the report
34
+ --no-default-footer do not sign the report
35
+ --json machine-readable output
36
+ --probe doctor only: test the key with one request
37
+ -h, --help show this
14
38
  -v, --version show version
15
39
 
16
- Runs show progress and errors on stderr; the result is the report file.
17
- Without --output the agent's final answer is printed to stdout instead.
40
+ Environment:
41
+ TESTEIYA_MODEL model to run, e.g. openrouter/anthropic/claude-sonnet-5
42
+ TESTEIYA_NO_DEFAULT_FOOTER do not sign the report
43
+ OPENROUTER_API_KEY provider key, also ANTHROPIC_API_KEY, OPENAI_API_KEY, GEMINI_API_KEY
44
+ TESTOMATIO Testomat.io project API key
45
+ TESTOMATIO_PROJECT_ID Testomat.io project id, same as --project
46
+ TESTOMATIO_URL Testomat.io base url, for self-hosted
47
+
48
+ Run "testeiya help" for the full guide.`;
49
+ export const HELP = `${USAGE}
50
+
51
+ Running a task
52
+
53
+ The agent runs one task and exits. There is no interactive mode. Progress and
54
+ errors go to stderr, so a run drops into CI as-is.
55
+
56
+ A task can also come from stdin: cat task.md | testeiya task
57
+ A task starting with "-" must follow "--": testeiya task -- "-weird task"
58
+
59
+ Exit codes: 0 pass, 1 failed run or negative verdict, 2 bad usage, 130 interrupted.
60
+
61
+ --exit-zero keeps a negative verdict from failing the command: a broken run
62
+ still exits 1 and bad usage still exits 2. The verdict is still in the report
63
+ and in the run envelope, so a pipeline can gate on it when it wants to.
64
+
65
+ Where the report goes
66
+
67
+ --output names a destination and can repeat. Without one the report goes to
68
+ stdout. --json prints the run envelope to stdout instead.
69
+
70
+ report.md the agent writes the report there
71
+ run.json the run envelope: verdict, reason, report, tokens, session id
72
+ gh:pr-comment posted on this branch's pull request, through the GitHub CLI
73
+ gh:pr#123 posted on that pull request
74
+
75
+ --footer adds a line under the report and --header adds one above. Both go
76
+ wherever the report goes: stdout, the file, the posted comment. Use --footer
77
+ to say how to answer a comment, e.g. --footer "> Reply with /testeiya".
78
+
79
+ The report is signed, unless you write your own footer:
18
80
 
19
- There is no default model: pass --model or set TESTEIYA_MODEL, or the run exits 2.
20
- The provider API key comes from the environment, ~/.testeiya/.env, or
21
- ~/.testeiya/auth.json.
81
+ *🧚🏻‍♀️ Provided by [Testeiya QA Agent](https://testomat.ai/testeiya) & <model>*
22
82
 
23
- Set TESTOMATIO to a project API key to work with that Testomat.io project. Add
24
- the project id (--project or TESTOMATIO_PROJECT_ID) and the agent also gets the
25
- Testomat.io tools; with the token alone it uses check-tests and the REST API.
83
+ --no-default-footer drops the signature, so does TESTEIYA_NO_DEFAULT_FOOTER.
26
84
 
27
- A task starting with "-" must follow "--": testeiya -- "-weird task"
85
+ Every destination is checked before the run starts, so a missing gh costs no
86
+ tokens.
28
87
 
29
- Exit codes: 0 pass · 1 failed run or verdict · 2 bad usage · 130 interrupted.`;
88
+ Models and keys
89
+
90
+ There is no default model. Pass --model or set TESTEIYA_MODEL. A resumed run
91
+ reuses its session's model. "testeiya models" lists what your key can reach.
92
+
93
+ The provider key comes from the environment, from ~/.testeiya/.env, or from
94
+ ~/.testeiya/auth.json, which is the file the desktop app's Settings dialog
95
+ writes.
96
+
97
+ Sessions
98
+
99
+ Runs are saved under ~/.testeiya, so a follow-up picks up where the last one
100
+ stopped. -c continues the last session in this folder, --resume <id> picks
101
+ another, --name labels one, and --no-session saves nothing.
102
+
103
+ --session <label> is the one for a job that runs again and again: it continues
104
+ the session with that name, and starts it the first time. Give each thread its
105
+ own label and they never mix.
106
+
107
+ Skills
108
+
109
+ The package ships the skills the agent reads, and only those: skills found in
110
+ the folder it runs in are ignored, so a checkout cannot hand it its own.
111
+ "testeiya skills" lists them. Name one in the task with a slash and it is
112
+ loaded before the run, e.g. "/qa-thinking". A name we do not ship is left
113
+ alone, so a stray "/word" in the task is just a word.
114
+
115
+ Testomat.io
116
+
117
+ Set TESTOMATIO to a project API key and the agent reads and writes that
118
+ project's tests, suites, runs and plans through check-tests and the REST API.
119
+ Add the project id, with --project or TESTOMATIO_PROJECT_ID, and it also gets
120
+ the Testomat.io tools. The MCP server needs the id: a token alone does not say
121
+ which project to talk to.`;
122
+ export const COMMANDS = ["task", "ask", "models", "skills", "doctor", "sessions", "help"];
30
123
  export function parseCliArgs(argv) {
124
+ const first = argv[0];
125
+ if (!first)
126
+ return { command: "welcome" };
127
+ if (first === "-h" || first === "--help")
128
+ return { command: "usage" };
129
+ if (first === "-v" || first === "--version")
130
+ return { command: "version" };
131
+ if (!isCommand(first))
132
+ return { error: unknownCommand(first) };
133
+ if (first === "help")
134
+ return { command: "help" };
135
+ const options = OPTIONS[first];
31
136
  let parsed;
32
137
  try {
33
- parsed = parseArgs({
34
- args: argv,
35
- options: {
36
- output: { type: "string", short: "o" },
37
- print: { type: "string", short: "p" },
38
- model: { type: "string" },
39
- project: { type: "string" },
40
- help: { type: "boolean", short: "h" },
41
- version: { type: "boolean", short: "v" },
42
- },
43
- allowPositionals: true,
44
- strict: true,
45
- });
138
+ parsed = parseArgs({ args: argv.slice(1), options, allowPositionals: true, strict: true });
46
139
  }
47
140
  catch (err) {
48
141
  if (err instanceof Error)
49
142
  return { error: err.message };
50
143
  return { error: String(err) };
51
144
  }
52
- const { values, positionals } = parsed;
145
+ const values = parsed.values;
53
146
  if (values.help)
54
- return { help: true };
55
- if (values.version)
56
- return { version: true };
57
- const parts = [...positionals];
58
- if (values.print)
59
- parts.unshift(values.print);
60
- const prompt = parts.join(" ").trim();
61
- const args = {};
62
- if (prompt)
63
- args.prompt = prompt;
64
- if (values.output)
65
- args.output = values.output;
66
- if (values.model)
147
+ return { command: "usage" };
148
+ const args = { command: first };
149
+ const text = parsed.positionals.join(" ").trim();
150
+ if ((first === "task" || first === "ask") && text)
151
+ args.prompt = text;
152
+ if ((first === "models" || first === "skills") && text)
153
+ args.pattern = text;
154
+ if (Array.isArray(values.output))
155
+ args.outputs = values.output;
156
+ if (values.json)
157
+ args.json = true;
158
+ if (values.probe)
159
+ args.probe = true;
160
+ if (typeof values.model === "string")
67
161
  args.model = values.model;
68
- if (values.project)
162
+ if (typeof values.project === "string")
69
163
  args.project = values.project;
164
+ if (values.continue)
165
+ args.continueLast = true;
166
+ if (typeof values.resume === "string")
167
+ args.resume = values.resume;
168
+ if (typeof values.session === "string")
169
+ args.session = values.session;
170
+ if (typeof values.name === "string")
171
+ args.name = values.name;
172
+ if (values["no-session"])
173
+ args.noSession = true;
174
+ if (values["exit-zero"])
175
+ args.exitZero = true;
176
+ if (typeof values.header === "string")
177
+ args.header = values.header;
178
+ if (typeof values.footer === "string")
179
+ args.footer = values.footer;
180
+ if (values["no-default-footer"])
181
+ args.noDefaultFooter = true;
182
+ if (args.session && (args.continueLast || args.resume || args.name || args.noSession)) {
183
+ return { error: "--session already names and continues a session" };
184
+ }
70
185
  return args;
71
186
  }
187
+ const HELP_FLAG = { type: "boolean", short: "h" };
188
+ const JSON_FLAG = { type: "boolean" };
189
+ const RUN_OPTIONS = {
190
+ output: { type: "string", short: "o", multiple: true },
191
+ json: JSON_FLAG,
192
+ model: { type: "string" },
193
+ project: { type: "string" },
194
+ continue: { type: "boolean", short: "c" },
195
+ resume: { type: "string" },
196
+ session: { type: "string" },
197
+ name: { type: "string" },
198
+ "no-session": { type: "boolean" },
199
+ "exit-zero": { type: "boolean" },
200
+ header: { type: "string" },
201
+ footer: { type: "string" },
202
+ "no-default-footer": { type: "boolean" },
203
+ help: HELP_FLAG,
204
+ };
205
+ const OPTIONS = {
206
+ task: RUN_OPTIONS,
207
+ ask: RUN_OPTIONS,
208
+ models: { json: JSON_FLAG, help: HELP_FLAG },
209
+ skills: { json: JSON_FLAG, help: HELP_FLAG },
210
+ doctor: { json: JSON_FLAG, probe: { type: "boolean" }, model: { type: "string" }, help: HELP_FLAG },
211
+ sessions: { json: JSON_FLAG, help: HELP_FLAG },
212
+ help: {},
213
+ };
214
+ function isCommand(value) {
215
+ return COMMANDS.includes(value);
216
+ }
217
+ // The task used to be the first positional, so a bare prompt is the mistake to
218
+ // expect. Name the fix rather than printing the whole usage at them.
219
+ function unknownCommand(value) {
220
+ if (value.startsWith("-"))
221
+ return `unknown option "${value}"`;
222
+ return `unknown command "${value}" — did you mean: testeiya task "${value}"`;
223
+ }
72
224
  //# sourceMappingURL=args.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"args.js","sourceRoot":"","sources":["../../src/args.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,MAAM,CAAC,MAAM,KAAK,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;8EA2ByD,CAAC;AAE/E,MAAM,UAAU,YAAY,CAAC,IAAc;IACzC,IAAI,MAAM,CAAC;IACX,IAAI,CAAC;QACH,MAAM,GAAG,SAAS,CAAC;YACjB,IAAI,EAAE,IAAI;YACV,OAAO,EAAE;gBACP,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,EAAE;gBACtC,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,EAAE;gBACrC,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;gBACzB,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;gBAC3B,IAAI,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,EAAE;gBACrC,OAAO,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,EAAE;aACzC;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E;CACT,CAAC;AAEF,SAAS,SAAS,CAAC,KAAa;IAC9B,OAAQ,QAA8B,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AACzD,CAAC;AAED,+EAA+E;AAC/E,qEAAqE;AACrE,SAAS,cAAc,CAAC,KAAa;IACnC,IAAI,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC;QAAE,OAAO,mBAAmB,KAAK,GAAG,CAAC;IAC9D,OAAO,oBAAoB,KAAK,qCAAqC,KAAK,GAAG,CAAC;AAChF,CAAC"}
package/dist/src/cli.js CHANGED
@@ -1,10 +1,13 @@
1
1
  #!/usr/bin/env node
2
- import { readFileSync } from "node:fs";
3
- import { join } from "node:path";
4
- import { parseCliArgs, USAGE } from "./args.js";
5
- import { loadEnvFiles } from "./env.js";
2
+ import { HELP, parseCliArgs, USAGE, WELCOME } from "./args.js";
3
+ import { runDoctor } from "./doctor.js";
4
+ import { loadEnvFiles, VERSION } from "./env.js";
6
5
  import { UsageError } from "./model.js";
6
+ import { runModels } from "./models.js";
7
+ import { runSkills } from "./skills.js";
8
+ import { parseDestinations, preflight } from "./output.js";
7
9
  import { runPrint } from "./run.js";
10
+ import { openSessionManager, runSessions } from "./sessions.js";
8
11
  main(process.argv.slice(2)).catch((err) => {
9
12
  process.stderr.write(`${err?.message ?? err}\n`);
10
13
  process.exit(1);
@@ -16,28 +19,38 @@ async function main(argv) {
16
19
  process.stderr.write(`${args.error}\n\n${USAGE}\n`);
17
20
  process.exit(2);
18
21
  }
19
- if (args.help) {
22
+ if (args.command === "welcome") {
23
+ process.stdout.write(`${WELCOME}\n`);
24
+ return;
25
+ }
26
+ if (args.command === "usage") {
20
27
  process.stdout.write(`${USAGE}\n`);
21
28
  return;
22
29
  }
23
- if (args.version) {
24
- process.stdout.write(`${version()}\n`);
30
+ if (args.command === "help") {
31
+ process.stdout.write(`${HELP}\n`);
32
+ return;
33
+ }
34
+ if (args.command === "version") {
35
+ process.stdout.write(`${VERSION}\n`);
25
36
  return;
26
37
  }
27
- loadEnvFiles();
38
+ const envSources = loadEnvFiles();
28
39
  // --project is a spelling of the env var the MCP server needs, so the rest of
29
40
  // the CLI only ever reads the environment.
30
41
  if (args.project)
31
42
  process.env.TESTOMATIO_PROJECT_ID = args.project;
32
- // No task and nothing piped in: there is no interactive mode, so this is a
33
- // usage error rather than a prompt.
34
- const prompt = args.prompt ?? (await readStdin());
35
- if (!prompt.trim()) {
36
- process.stderr.write(`${USAGE}\n`);
37
- process.exit(2);
38
- }
39
43
  try {
40
- process.exit(await runPrint({ prompt, outputFile: args.output, model: args.model }));
44
+ if (args.command === "models")
45
+ process.exit(await runModels(args.pattern, args.json));
46
+ if (args.command === "skills")
47
+ process.exit(await runSkills(args.pattern, args.json));
48
+ if (args.command === "doctor") {
49
+ process.exit(await runDoctor({ envSources, json: args.json, probe: args.probe, model: args.model }));
50
+ }
51
+ if (args.command === "sessions")
52
+ process.exit(await runSessions(process.cwd(), args.json));
53
+ process.exit(await task(args));
41
54
  }
42
55
  catch (err) {
43
56
  if (!(err instanceof UsageError))
@@ -46,6 +59,41 @@ async function main(argv) {
46
59
  process.exit(2);
47
60
  }
48
61
  }
62
+ async function task(args) {
63
+ const prompt = args.prompt ?? (await readStdin());
64
+ if (!prompt.trim()) {
65
+ process.stderr.write(` ${args.command} needs something to work on\n\n${USAGE}\n`);
66
+ process.exit(2);
67
+ }
68
+ const destinations = parseDestinations(args.outputs ?? [], args.json);
69
+ if (typeof destinations === "string")
70
+ throw new UsageError(destinations);
71
+ // Everything a destination needs is checked before a single token is spent.
72
+ const unreachable = await preflight(destinations);
73
+ if (unreachable)
74
+ throw new UsageError(unreachable);
75
+ const sessionManager = await openSessionManager(process.cwd(), args);
76
+ if (typeof sessionManager === "string")
77
+ throw new UsageError(sessionManager);
78
+ if (args.name)
79
+ sessionManager.appendSessionInfo(args.name);
80
+ let sessionId = null;
81
+ if (!args.noSession)
82
+ sessionId = sessionManager.getSessionId();
83
+ const brief = args.command === "ask";
84
+ return runPrint({
85
+ prompt,
86
+ destinations,
87
+ sessionManager,
88
+ sessionId,
89
+ brief,
90
+ model: args.model,
91
+ exitZero: args.exitZero,
92
+ header: args.header,
93
+ footer: args.footer,
94
+ noDefaultFooter: args.noDefaultFooter,
95
+ });
96
+ }
49
97
  async function readStdin() {
50
98
  if (process.stdin.isTTY)
51
99
  return "";
@@ -54,8 +102,4 @@ async function readStdin() {
54
102
  chunks.push(chunk);
55
103
  return Buffer.concat(chunks).toString("utf8");
56
104
  }
57
- function version() {
58
- const pkg = JSON.parse(readFileSync(join(import.meta.dirname, "..", "..", "package.json"), "utf8"));
59
- return pkg.version;
60
- }
61
105
  //# sourceMappingURL=cli.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/cli.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEpC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;IACxC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,GAAG,EAAE,OAAO,IAAI,GAAG,IAAI,CAAC,CAAC;IACjD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC;AAEH,KAAK,UAAU,IAAI,CAAC,IAAc;IAChC,OAAO,CAAC,KAAK,GAAG,UAAU,CAAC;IAE3B,MAAM,IAAI,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;IAChC,IAAI,IA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AS;QACT,KAAK;QACL,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,MAAM,EAAE,IAAI,CAAC,MAAM;QACnB,MAAM,EAAE,IAAI,CAAC,MAAM;QACnB,eAAe,EAAE,IAAI,CAAC,eAAe;KACtC,CAAC,CAAC;AACL,CAAC;AAED,KAAK,UAAU,SAAS;IACtB,IAAI,OAAO,CAAC,KAAK,CAAC,KAAK;QAAE,OAAO,EAAE,CAAC;IACnC,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,IAAI,KAAK,EAAE,MAAM,KAAK,IAAI,OAAO,CAAC,KAAK;QAAE,MAAM,CAAC,IAAI,CAAC,KAAe,CAAC,CAAC;IACtE,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;AAChD,CAAC"}
@@ -0,0 +1,171 @@
1
+ import { existsSync } from "node:fs";
2
+ import { relative } from "node:path";
3
+ import { fileURLToPath } from "node:url";
4
+ import { TESTEIYA_HOME } from "./env.js";
5
+ import { hasMcp, hasTestomatio, metadataCachePath, vendorBundle } from "./mcp.js";
6
+ import { PROVIDER_KEYS, resolveModel, UsageError } from "./model.js";
7
+ import { loadBundledSkills } from "./skills.js";
8
+ import { BUNDLED_SKILLS_DIR, createRuntime } from "./session.js";
9
+ const MIN_NODE = [22, 19];
10
+ /**
11
+ * Everything a run resolves silently: which key file won, whether skills loaded,
12
+ * whether MCP is on. Reads config only — `--probe` is the one check that spends.
13
+ */
14
+ export async function runDoctor(options) {
15
+ const checks = [nodeCheck(), homeCheck()];
16
+ const runtime = await createRuntime();
17
+ checks.push(keyCheck(runtime, options.envSources));
18
+ const model = modelCheck(runtime, options.model);
19
+ checks.push(model.check);
20
+ const skills = await skillsChecks();
21
+ checks.push(...skills.checks);
22
+ checks.push(testomatioCheck(), mcpCacheCheck());
23
+ if (options.probe)
24
+ checks.push(await probeCheck(runtime, model.resolved));
25
+ if (options.json) {
26
+ const report = {
27
+ checks: checks.filter((check) => check.status !== "list"),
28
+ skills: skills.groups,
29
+ };
30
+ process.stdout.write(`${JSON.stringify(report, null, 2)}\n`);
31
+ return worst(checks) === "fail" ? 1 : 0;
32
+ }
33
+ process.stdout.write("\n");
34
+ for (const check of checks) {
35
+ process.stdout.write(` ${MARK[check.status]} ${check.name.padEnd(12)} ${check.detail}\n`);
36
+ }
37
+ process.stdout.write("\n");
38
+ return worst(checks) === "fail" ? 1 : 0;
39
+ }
40
+ function nodeCheck() {
41
+ const version = process.versions.node;
42
+ const [major = 0, minor = 0] = version.split(".").map(Number);
43
+ if (major > MIN_NODE[0] || (major === MIN_NODE[0] && minor >= MIN_NODE[1])) {
44
+ return { name: "node", status: "ok", detail: `v${version}` };
45
+ }
46
+ return { name: "node", status: "fail", detail: `v${version}, needs v22.19 or newer` };
47
+ }
48
+ function homeCheck() {
49
+ if (!existsSync(TESTEIYA_HOME)) {
50
+ return { name: "home", status: "warn", detail: `${TESTEIYA_HOME} (not created yet)` };
51
+ }
52
+ return { name: "home", status: "ok", detail: TESTEIYA_HOME };
53
+ }
54
+ // The key can come from four places and nothing else ever says which one won.
55
+ function keyCheck(runtime, sources) {
56
+ const found = [];
57
+ for (const { provider, env } of PROVIDER_KEYS) {
58
+ if (process.env[env]) {
59
+ found.push(`${provider} from ${sources.get(env) ?? "environment"}`);
60
+ continue;
61
+ }
62
+ if (runtime.hasConfiguredAuth(provider))
63
+ found.push(`${provider} from auth.json`);
64
+ }
65
+ if (found.length === 0) {
66
+ return { name: "key", status: "fail", detail: "none — set OPENROUTER_API_KEY or similar" };
67
+ }
68
+ return { name: "key", status: "ok", detail: found.join(", ") };
69
+ }
70
+ function modelCheck(runtime, explicit) {
71
+ try {
72
+ const model = resolveModel(runtime, explicit);
73
+ return {
74
+ check: { name: "model", status: "ok", detail: `${model.provider}/${model.id}` },
75
+ resolved: model,
76
+ };
77
+ }
78
+ catch (err) {
79
+ const detail = err instanceof UsageError ? err.message : String(err);
80
+ return { check: { name: "model", status: "warn", detail } };
81
+ }
82
+ }
83
+ async function skillsChecks() {
84
+ const { count, groups, diagnostics } = await loadBundledSkills();
85
+ const checks = [];
86
+ if (count === 0) {
87
+ checks.push({ name: "skills", status: "warn", detail: "none loaded" });
88
+ }
89
+ if (count > 0) {
90
+ checks.push({ name: "skills", status: "ok", detail: `${count} loaded` });
91
+ for (const { group, skills } of groups) {
92
+ const names = skills.map((skill) => skill.name);
93
+ checks.push({ name: "", status: "list", detail: `${group.padEnd(28)} ${summarize(names)}` });
94
+ }
95
+ }
96
+ // Collisions and parse errors were dropped on the floor before this command.
97
+ for (const diagnostic of diagnostics) {
98
+ const status = diagnostic.type === "error" ? "fail" : "warn";
99
+ let detail = diagnostic.message;
100
+ if (diagnostic.path)
101
+ detail = `${detail} — ${shorten(diagnostic.path)}`;
102
+ checks.push({ name: "skills", status, detail });
103
+ }
104
+ const listed = groups.map(({ group, skills }) => ({
105
+ group,
106
+ skills: skills.map((skill) => skill.name),
107
+ }));
108
+ return { checks, groups: listed };
109
+ }
110
+ function shorten(path) {
111
+ const inBundle = relative(BUNDLED_SKILLS_DIR, path);
112
+ if (inBundle.startsWith(".."))
113
+ return path;
114
+ return inBundle;
115
+ }
116
+ // The full list is `testeiya skills`; this line only proves the right set loaded.
117
+ function summarize(names) {
118
+ if (names.length <= 6)
119
+ return names.join(", ");
120
+ return `${names.slice(0, 6).join(", ")}, +${names.length - 6}`;
121
+ }
122
+ function testomatioCheck() {
123
+ if (!hasTestomatio()) {
124
+ return { name: "testomatio", status: "warn", detail: "no TESTOMATIO token, not connected" };
125
+ }
126
+ if (!hasMcp()) {
127
+ return {
128
+ name: "testomatio",
129
+ status: "warn",
130
+ detail: "token set, no project id — check-tests and REST only",
131
+ };
132
+ }
133
+ return { name: "testomatio", status: "ok", detail: "token and project id, MCP tools on" };
134
+ }
135
+ function mcpCacheCheck() {
136
+ if (!hasMcp())
137
+ return { name: "mcp", status: "ok", detail: "off" };
138
+ const bundle = fileURLToPath(vendorBundle());
139
+ if (!existsSync(bundle)) {
140
+ return { name: "mcp", status: "fail", detail: "vendor bundle missing — run npm run build" };
141
+ }
142
+ if (!existsSync(metadataCachePath())) {
143
+ return { name: "mcp", status: "warn", detail: "tool cache empty, first run is proxy-only" };
144
+ }
145
+ return { name: "mcp", status: "ok", detail: "direct tools and proxy" };
146
+ }
147
+ async function probeCheck(runtime, model) {
148
+ if (!model)
149
+ return { name: "probe", status: "warn", detail: "skipped, no model to probe" };
150
+ const message = await runtime
151
+ .completeSimple(model, { messages: [{ role: "user", content: "ping", timestamp: Date.now() }] })
152
+ .catch((err) => ({ stopReason: "error", errorMessage: String(err) }));
153
+ if (message.stopReason === "error") {
154
+ return { name: "probe", status: "fail", detail: message.errorMessage ?? "request failed" };
155
+ }
156
+ return { name: "probe", status: "ok", detail: "the key works" };
157
+ }
158
+ function worst(checks) {
159
+ if (checks.some((check) => check.status === "fail"))
160
+ return "fail";
161
+ if (checks.some((check) => check.status === "warn"))
162
+ return "warn";
163
+ return "ok";
164
+ }
165
+ const MARK = {
166
+ ok: "✓",
167
+ warn: "!",
168
+ fail: "✗",
169
+ list: " ",
170
+ };
171
+ //# sourceMappingURL=doctor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"doctor.js","sourceRoot":"","sources":["../../src/doctor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAgB,aAAa,EAAE,MAAM,UAAU,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAClF,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACrE,OAAO,EAAE,iBAAiB,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