testeiya 0.2.0 → 0.3.9

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 (412) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +37 -175
  3. package/dist/prompt/context.js +79 -0
  4. package/dist/prompt/context.js.map +1 -0
  5. package/dist/prompt/index.js +56 -0
  6. package/dist/prompt/index.js.map +1 -0
  7. package/dist/prompt/print.js +22 -0
  8. package/dist/prompt/print.js.map +1 -0
  9. package/dist/prompt/project-info.js +2 -0
  10. package/dist/prompt/project-info.js.map +1 -0
  11. package/{src/prompt/system-prompt.ts → dist/prompt/system-prompt.js} +24 -21
  12. package/dist/prompt/system-prompt.js.map +1 -0
  13. package/dist/prompt/testomatio.js +264 -0
  14. package/dist/prompt/testomatio.js.map +1 -0
  15. package/dist/prompt/tools.js +49 -0
  16. package/dist/prompt/tools.js.map +1 -0
  17. package/dist/prompt/vocab.js +8 -0
  18. package/dist/prompt/vocab.js.map +1 -0
  19. package/dist/src/args.js +72 -0
  20. package/dist/src/args.js.map +1 -0
  21. package/dist/src/cli.js +61 -0
  22. package/dist/src/cli.js.map +1 -0
  23. package/dist/src/env.js +69 -0
  24. package/dist/src/env.js.map +1 -0
  25. package/dist/src/mcp-extension.js +9 -0
  26. package/dist/src/mcp-extension.js.map +1 -0
  27. package/dist/src/mcp.js +139 -0
  28. package/dist/src/mcp.js.map +1 -0
  29. package/dist/src/model.js +66 -0
  30. package/dist/src/model.js.map +1 -0
  31. package/dist/src/result.js +41 -0
  32. package/dist/src/result.js.map +1 -0
  33. package/dist/src/run.js +199 -0
  34. package/dist/src/run.js.map +1 -0
  35. package/dist/src/session.js +77 -0
  36. package/dist/src/session.js.map +1 -0
  37. package/dist/vendor/mcp.js +14801 -0
  38. package/mcp-tools.json +2967 -0
  39. package/package.json +29 -41
  40. package/prompt/context.ts +101 -0
  41. package/prompt/index.ts +93 -0
  42. package/prompt/print.ts +23 -0
  43. package/prompt/project-info.ts +30 -0
  44. package/prompt/system-prompt.ts +173 -0
  45. package/{src/prompt → prompt}/testomatio.ts +119 -8
  46. package/{src/prompt → prompt}/tools.ts +30 -8
  47. package/prompt/vocab.ts +7 -0
  48. package/{skills.lock.json → skills/skills.lock.json} +11 -7
  49. package/skills/skills.yaml +34 -0
  50. package/models.catalog.json +0 -6963
  51. package/skills/codeceptjs/ci-fix-tests/SKILL.md +0 -120
  52. package/skills/codeceptjs/codeceptjs-auth/SKILL.md +0 -158
  53. package/skills/codeceptjs/codeceptjs-exploration/SKILL.md +0 -91
  54. package/skills/codeceptjs/codeceptjs-fundamentals/SKILL.md +0 -158
  55. package/skills/codeceptjs/codeceptjs-run-analysis/SKILL.md +0 -90
  56. package/skills/codeceptjs/debugging-codeceptjs-tests/SKILL.md +0 -234
  57. package/skills/codeceptjs/migrate-codeceptjs-4/SKILL.md +0 -110
  58. package/skills/codeceptjs/migrate-cypress-to-codeceptjs/SKILL.md +0 -306
  59. package/skills/codeceptjs/migrate-protractor-to-codeceptjs/SKILL.md +0 -352
  60. package/skills/codeceptjs/migrate-selenium-java-to-codeceptjs/SKILL.md +0 -472
  61. package/skills/codeceptjs/migrate-testcafe-to-codeceptjs/SKILL.md +0 -350
  62. package/skills/codeceptjs/refactoring-codeceptjs-tests/SKILL.md +0 -81
  63. package/skills/codeceptjs/writing-codeceptjs-tests/SKILL.md +0 -206
  64. package/skills/playwright-best-practices-skill/LICENSE.md +0 -7
  65. package/skills/playwright-best-practices-skill/README.md +0 -147
  66. package/skills/playwright-best-practices-skill/SKILL.md +0 -303
  67. package/skills/playwright-best-practices-skill/advanced/authentication-flows.md +0 -360
  68. package/skills/playwright-best-practices-skill/advanced/authentication.md +0 -871
  69. package/skills/playwright-best-practices-skill/advanced/clock-mocking.md +0 -364
  70. package/skills/playwright-best-practices-skill/advanced/mobile-testing.md +0 -409
  71. package/skills/playwright-best-practices-skill/advanced/multi-context.md +0 -288
  72. package/skills/playwright-best-practices-skill/advanced/multi-user.md +0 -393
  73. package/skills/playwright-best-practices-skill/advanced/network-advanced.md +0 -452
  74. package/skills/playwright-best-practices-skill/advanced/third-party.md +0 -464
  75. package/skills/playwright-best-practices-skill/architecture/pom-vs-fixtures.md +0 -363
  76. package/skills/playwright-best-practices-skill/architecture/test-architecture.md +0 -369
  77. package/skills/playwright-best-practices-skill/architecture/when-to-mock.md +0 -383
  78. package/skills/playwright-best-practices-skill/browser-apis/browser-apis.md +0 -391
  79. package/skills/playwright-best-practices-skill/browser-apis/iframes.md +0 -403
  80. package/skills/playwright-best-practices-skill/browser-apis/service-workers.md +0 -504
  81. package/skills/playwright-best-practices-skill/browser-apis/websockets.md +0 -403
  82. package/skills/playwright-best-practices-skill/core/annotations.md +0 -424
  83. package/skills/playwright-best-practices-skill/core/assertions-waiting.md +0 -361
  84. package/skills/playwright-best-practices-skill/core/configuration.md +0 -452
  85. package/skills/playwright-best-practices-skill/core/fixtures-hooks.md +0 -417
  86. package/skills/playwright-best-practices-skill/core/global-setup.md +0 -434
  87. package/skills/playwright-best-practices-skill/core/locators.md +0 -242
  88. package/skills/playwright-best-practices-skill/core/page-object-model.md +0 -315
  89. package/skills/playwright-best-practices-skill/core/projects-dependencies.md +0 -453
  90. package/skills/playwright-best-practices-skill/core/test-data.md +0 -492
  91. package/skills/playwright-best-practices-skill/core/test-suite-structure.md +0 -361
  92. package/skills/playwright-best-practices-skill/core/test-tags.md +0 -298
  93. package/skills/playwright-best-practices-skill/debugging/console-errors.md +0 -420
  94. package/skills/playwright-best-practices-skill/debugging/debugging.md +0 -504
  95. package/skills/playwright-best-practices-skill/debugging/error-testing.md +0 -360
  96. package/skills/playwright-best-practices-skill/debugging/flaky-tests.md +0 -496
  97. package/skills/playwright-best-practices-skill/frameworks/angular.md +0 -530
  98. package/skills/playwright-best-practices-skill/frameworks/nextjs.md +0 -469
  99. package/skills/playwright-best-practices-skill/frameworks/react.md +0 -531
  100. package/skills/playwright-best-practices-skill/frameworks/vue.md +0 -574
  101. package/skills/playwright-best-practices-skill/infrastructure-ci-cd/ci-cd.md +0 -468
  102. package/skills/playwright-best-practices-skill/infrastructure-ci-cd/docker.md +0 -283
  103. package/skills/playwright-best-practices-skill/infrastructure-ci-cd/github-actions.md +0 -546
  104. package/skills/playwright-best-practices-skill/infrastructure-ci-cd/gitlab.md +0 -397
  105. package/skills/playwright-best-practices-skill/infrastructure-ci-cd/other-providers.md +0 -521
  106. package/skills/playwright-best-practices-skill/infrastructure-ci-cd/parallel-sharding.md +0 -371
  107. package/skills/playwright-best-practices-skill/infrastructure-ci-cd/performance.md +0 -453
  108. package/skills/playwright-best-practices-skill/infrastructure-ci-cd/reporting.md +0 -424
  109. package/skills/playwright-best-practices-skill/infrastructure-ci-cd/test-coverage.md +0 -497
  110. package/skills/playwright-best-practices-skill/testing-patterns/accessibility.md +0 -359
  111. package/skills/playwright-best-practices-skill/testing-patterns/api-testing.md +0 -719
  112. package/skills/playwright-best-practices-skill/testing-patterns/browser-extensions.md +0 -506
  113. package/skills/playwright-best-practices-skill/testing-patterns/canvas-webgl.md +0 -493
  114. package/skills/playwright-best-practices-skill/testing-patterns/component-testing.md +0 -500
  115. package/skills/playwright-best-practices-skill/testing-patterns/drag-drop.md +0 -576
  116. package/skills/playwright-best-practices-skill/testing-patterns/electron.md +0 -509
  117. package/skills/playwright-best-practices-skill/testing-patterns/file-operations.md +0 -377
  118. package/skills/playwright-best-practices-skill/testing-patterns/file-upload-download.md +0 -562
  119. package/skills/playwright-best-practices-skill/testing-patterns/forms-validation.md +0 -561
  120. package/skills/playwright-best-practices-skill/testing-patterns/graphql-testing.md +0 -331
  121. package/skills/playwright-best-practices-skill/testing-patterns/i18n.md +0 -508
  122. package/skills/playwright-best-practices-skill/testing-patterns/performance-testing.md +0 -476
  123. package/skills/playwright-best-practices-skill/testing-patterns/security-testing.md +0 -430
  124. package/skills/playwright-best-practices-skill/testing-patterns/visual-regression.md +0 -634
  125. package/skills/playwright-cli/SKILL.md +0 -420
  126. package/skills/playwright-cli/references/element-attributes.md +0 -23
  127. package/skills/playwright-cli/references/playwright-tests.md +0 -39
  128. package/skills/playwright-cli/references/request-mocking.md +0 -87
  129. package/skills/playwright-cli/references/running-code.md +0 -241
  130. package/skills/playwright-cli/references/session-management.md +0 -225
  131. package/skills/playwright-cli/references/storage-state.md +0 -275
  132. package/skills/playwright-cli/references/test-generation.md +0 -433
  133. package/skills/playwright-cli/references/tracing.md +0 -139
  134. package/skills/playwright-cli/references/video-recording.md +0 -143
  135. package/skills/testeiya/README.md +0 -29
  136. package/skills/testeiya/answer-formatting/SKILL.md +0 -30
  137. package/skills/testeiya/check-cucumber/SKILL.md +0 -200
  138. package/skills/testeiya/check-tests/SKILL.md +0 -260
  139. package/skills/testeiya/manual-run-assistant/SKILL.md +0 -61
  140. package/skills/testeiya/testomatio-docs/INDEX.md +0 -175
  141. package/skills/testeiya/testomatio-docs/SKILL.md +0 -102
  142. package/skills/testeiya/testomatio-docs/docs/advanced/ai-powered-features/ai-agents.md +0 -144
  143. package/skills/testeiya/testomatio-docs/docs/advanced/ai-powered-features/ai-powered-features.md +0 -531
  144. package/skills/testeiya/testomatio-docs/docs/advanced/ai-powered-features/ai-requirements.md +0 -437
  145. package/skills/testeiya/testomatio-docs/docs/advanced/api-access/index.md +0 -191
  146. package/skills/testeiya/testomatio-docs/docs/advanced/branches-folder/index.md +0 -277
  147. package/skills/testeiya/testomatio-docs/docs/advanced/bulk-edit-folder/bulk-edit-demos.mdx +0 -39
  148. package/skills/testeiya/testomatio-docs/docs/advanced/bulk-edit-folder/bulk-edit-on-suite-and-test-level.md +0 -122
  149. package/skills/testeiya/testomatio-docs/docs/advanced/bulk-edit-folder/what-is-bulk-edit.md +0 -170
  150. package/skills/testeiya/testomatio-docs/docs/advanced/jira-plugin/branches.md +0 -53
  151. package/skills/testeiya/testomatio-docs/docs/advanced/jira-plugin/index.mdx +0 -98
  152. package/skills/testeiya/testomatio-docs/docs/advanced/jira-plugin/jira-issue.md +0 -151
  153. package/skills/testeiya/testomatio-docs/docs/advanced/jira-plugin/runs-and-reports.md +0 -377
  154. package/skills/testeiya/testomatio-docs/docs/advanced/jira-plugin/work-in-jira.md +0 -267
  155. package/skills/testeiya/testomatio-docs/docs/advanced/living-doc/index.md +0 -138
  156. package/skills/testeiya/testomatio-docs/docs/advanced/milestones/index.md +0 -220
  157. package/skills/testeiya/testomatio-docs/docs/advanced/shortcuts/index.md +0 -48
  158. package/skills/testeiya/testomatio-docs/docs/advanced/tags-labels/labels-and-custom-fields.md +0 -201
  159. package/skills/testeiya/testomatio-docs/docs/advanced/tags-labels/tags-or-labels.md +0 -94
  160. package/skills/testeiya/testomatio-docs/docs/advanced/tags-labels/tags.md +0 -243
  161. package/skills/testeiya/testomatio-docs/docs/advanced/test-artifacts/index.md +0 -135
  162. package/skills/testeiya/testomatio-docs/docs/advanced/tql/index.md +0 -394
  163. package/skills/testeiya/testomatio-docs/docs/getting-started/index.md +0 -290
  164. package/skills/testeiya/testomatio-docs/docs/integrations/continuous-integration/azure.md +0 -96
  165. package/skills/testeiya/testomatio-docs/docs/integrations/continuous-integration/bamboo.md +0 -94
  166. package/skills/testeiya/testomatio-docs/docs/integrations/continuous-integration/bitbucket.md +0 -106
  167. package/skills/testeiya/testomatio-docs/docs/integrations/continuous-integration/circle.md +0 -115
  168. package/skills/testeiya/testomatio-docs/docs/integrations/continuous-integration/github.md +0 -120
  169. package/skills/testeiya/testomatio-docs/docs/integrations/continuous-integration/gitlab.md +0 -88
  170. package/skills/testeiya/testomatio-docs/docs/integrations/continuous-integration/index.mdx +0 -151
  171. package/skills/testeiya/testomatio-docs/docs/integrations/continuous-integration/jenkins.md +0 -121
  172. package/skills/testeiya/testomatio-docs/docs/integrations/continuous-integration/teamcity.md +0 -96
  173. package/skills/testeiya/testomatio-docs/docs/integrations/issues-management/azure.md +0 -31
  174. package/skills/testeiya/testomatio-docs/docs/integrations/issues-management/clickup.md +0 -54
  175. package/skills/testeiya/testomatio-docs/docs/integrations/issues-management/confluence.md +0 -34
  176. package/skills/testeiya/testomatio-docs/docs/integrations/issues-management/github.md +0 -31
  177. package/skills/testeiya/testomatio-docs/docs/integrations/issues-management/gitlab.md +0 -93
  178. package/skills/testeiya/testomatio-docs/docs/integrations/issues-management/index.md +0 -131
  179. package/skills/testeiya/testomatio-docs/docs/integrations/issues-management/jira.md +0 -164
  180. package/skills/testeiya/testomatio-docs/docs/integrations/issues-management/linear.md +0 -29
  181. package/skills/testeiya/testomatio-docs/docs/integrations/issues-management/shortcut.md +0 -67
  182. package/skills/testeiya/testomatio-docs/docs/integrations/issues-management/youtrack.md +0 -94
  183. package/skills/testeiya/testomatio-docs/docs/integrations/report-notifications/azure-devops.md +0 -53
  184. package/skills/testeiya/testomatio-docs/docs/integrations/report-notifications/email.md +0 -71
  185. package/skills/testeiya/testomatio-docs/docs/integrations/report-notifications/jira.md +0 -52
  186. package/skills/testeiya/testomatio-docs/docs/integrations/report-notifications/ms-teams.md +0 -60
  187. package/skills/testeiya/testomatio-docs/docs/integrations/report-notifications/rules.md +0 -267
  188. package/skills/testeiya/testomatio-docs/docs/integrations/report-notifications/slack.md +0 -82
  189. package/skills/testeiya/testomatio-docs/docs/integrations/report-notifications/telegram.md +0 -73
  190. package/skills/testeiya/testomatio-docs/docs/integrations/scim-provisioning/index.mdx +0 -207
  191. package/skills/testeiya/testomatio-docs/docs/integrations/scim-provisioning/okta.md +0 -204
  192. package/skills/testeiya/testomatio-docs/docs/integrations/single-sign-on/azure.md +0 -95
  193. package/skills/testeiya/testomatio-docs/docs/integrations/single-sign-on/google.md +0 -75
  194. package/skills/testeiya/testomatio-docs/docs/integrations/single-sign-on/index.mdx +0 -33
  195. package/skills/testeiya/testomatio-docs/docs/integrations/single-sign-on/okta.md +0 -108
  196. package/skills/testeiya/testomatio-docs/docs/integrations/single-sign-on/saml.md +0 -66
  197. package/skills/testeiya/testomatio-docs/docs/legal/compliance/gdpr.md +0 -95
  198. package/skills/testeiya/testomatio-docs/docs/legal/compliance/index.mdx +0 -94
  199. package/skills/testeiya/testomatio-docs/docs/legal/compliance/privacy.md +0 -26
  200. package/skills/testeiya/testomatio-docs/docs/legal/compliance/terms.md +0 -32
  201. package/skills/testeiya/testomatio-docs/docs/legal/security/index.mdx +0 -242
  202. package/skills/testeiya/testomatio-docs/docs/legal/security/jira.md +0 -140
  203. package/skills/testeiya/testomatio-docs/docs/legal/security/subprocessors.md +0 -76
  204. package/skills/testeiya/testomatio-docs/docs/management/company/administration.md +0 -363
  205. package/skills/testeiya/testomatio-docs/docs/management/company/audit-log.md +0 -41
  206. package/skills/testeiya/testomatio-docs/docs/management/company/plan-features-comparison.md +0 -240
  207. package/skills/testeiya/testomatio-docs/docs/management/company/subscriptions.md +0 -326
  208. package/skills/testeiya/testomatio-docs/docs/management/company/trials.md +0 -75
  209. package/skills/testeiya/testomatio-docs/docs/management/company/users-and-permissions/accountant.md +0 -49
  210. package/skills/testeiya/testomatio-docs/docs/management/company/users-and-permissions/index.mdx +0 -285
  211. package/skills/testeiya/testomatio-docs/docs/management/company/users-and-permissions/read-only-user.md +0 -67
  212. package/skills/testeiya/testomatio-docs/docs/management/company/users-and-permissions/teams.md +0 -138
  213. package/skills/testeiya/testomatio-docs/docs/management/project/settings.md +0 -87
  214. package/skills/testeiya/testomatio-docs/docs/management/project/templates.md +0 -546
  215. package/skills/testeiya/testomatio-docs/docs/project/analytics/index.md +0 -326
  216. package/skills/testeiya/testomatio-docs/docs/project/import-export/export-tests/classical-tests-markdown-format.md +0 -386
  217. package/skills/testeiya/testomatio-docs/docs/project/import-export/export-tests/download-manual-tests-as-files.md +0 -378
  218. package/skills/testeiya/testomatio-docs/docs/project/import-export/export-tests/export-to-obsidian.md +0 -112
  219. package/skills/testeiya/testomatio-docs/docs/project/import-export/export-tests/export-to-spreadsheet.md +0 -127
  220. package/skills/testeiya/testomatio-docs/docs/project/import-export/import/auto-import.md +0 -63
  221. package/skills/testeiya/testomatio-docs/docs/project/import-export/import/import-tests-from-Allure-TestOps.md +0 -49
  222. package/skills/testeiya/testomatio-docs/docs/project/import-export/import/import-tests-from-QTest.md +0 -41
  223. package/skills/testeiya/testomatio-docs/docs/project/import-export/import/import-tests-from-Qase.md +0 -39
  224. package/skills/testeiya/testomatio-docs/docs/project/import-export/import/import-tests-from-Zephyr.md +0 -37
  225. package/skills/testeiya/testomatio-docs/docs/project/import-export/import/import-tests-from-csv-xlsx.md +0 -117
  226. package/skills/testeiya/testomatio-docs/docs/project/import-export/import/import-tests-from-cucumber.md +0 -93
  227. package/skills/testeiya/testomatio-docs/docs/project/import-export/import/import-tests-from-qmetry.md +0 -44
  228. package/skills/testeiya/testomatio-docs/docs/project/import-export/import/import-tests-from-source-code.md +0 -117
  229. package/skills/testeiya/testomatio-docs/docs/project/import-export/import/import-tests-from-testcaselabs.md +0 -44
  230. package/skills/testeiya/testomatio-docs/docs/project/import-export/import/import-tests-from-testmo.md +0 -47
  231. package/skills/testeiya/testomatio-docs/docs/project/import-export/import/import-tests-from-testrail.md +0 -82
  232. package/skills/testeiya/testomatio-docs/docs/project/import-export/import/import-tests-from-xray.md +0 -55
  233. package/skills/testeiya/testomatio-docs/docs/project/plans/index.md +0 -334
  234. package/skills/testeiya/testomatio-docs/docs/project/pulse/index.md +0 -104
  235. package/skills/testeiya/testomatio-docs/docs/project/runs/archive-runs-and-groups.md +0 -176
  236. package/skills/testeiya/testomatio-docs/docs/project/runs/custom-statuses.md +0 -195
  237. package/skills/testeiya/testomatio-docs/docs/project/runs/environments.md +0 -203
  238. package/skills/testeiya/testomatio-docs/docs/project/runs/managing-runs.md +0 -455
  239. package/skills/testeiya/testomatio-docs/docs/project/runs/merge-strategies.md +0 -137
  240. package/skills/testeiya/testomatio-docs/docs/project/runs/reports.md +0 -329
  241. package/skills/testeiya/testomatio-docs/docs/project/runs/rungroups.md +0 -342
  242. package/skills/testeiya/testomatio-docs/docs/project/runs/running-automated-tests.md +0 -256
  243. package/skills/testeiya/testomatio-docs/docs/project/runs/running-manual-and-automated-tests.md +0 -331
  244. package/skills/testeiya/testomatio-docs/docs/project/runs/running-tests-manually.md +0 -633
  245. package/skills/testeiya/testomatio-docs/docs/project/runs/temporary-tests-notes.md +0 -223
  246. package/skills/testeiya/testomatio-docs/docs/project/steps-snippets/snippets.md +0 -68
  247. package/skills/testeiya/testomatio-docs/docs/project/steps-snippets/steps.md +0 -181
  248. package/skills/testeiya/testomatio-docs/docs/project/tests/bdd-test-case-editor.md +0 -98
  249. package/skills/testeiya/testomatio-docs/docs/project/tests/classical-test-case-editor.md +0 -354
  250. package/skills/testeiya/testomatio-docs/docs/project/tests/classical-vs-bdd.md +0 -169
  251. package/skills/testeiya/testomatio-docs/docs/project/tests/copy-and-move-your-tests.md +0 -156
  252. package/skills/testeiya/testomatio-docs/docs/project/tests/other-features-for-test-case-design.md +0 -412
  253. package/skills/testeiya/testomatio-docs/docs/project/tests/test-case-creation-and-editing.md +0 -527
  254. package/skills/testeiya/testomatio-docs/docs/support/index.md +0 -75
  255. package/skills/testeiya/testomatio-docs/docs/test-reporting/artifacts.md +0 -388
  256. package/skills/testeiya/testomatio-docs/docs/test-reporting/cli.md +0 -215
  257. package/skills/testeiya/testomatio-docs/docs/test-reporting/configuration.md +0 -247
  258. package/skills/testeiya/testomatio-docs/docs/test-reporting/frameworks.md +0 -490
  259. package/skills/testeiya/testomatio-docs/docs/test-reporting/functions.md +0 -144
  260. package/skills/testeiya/testomatio-docs/docs/test-reporting/index.mdx +0 -48
  261. package/skills/testeiya/testomatio-docs/docs/test-reporting/junit.md +0 -248
  262. package/skills/testeiya/testomatio-docs/docs/test-reporting/logger.md +0 -138
  263. package/skills/testeiya/testomatio-docs/docs/test-reporting/php.md +0 -77
  264. package/skills/testeiya/testomatio-docs/docs/test-reporting/pipes/bitbucket.md +0 -72
  265. package/skills/testeiya/testomatio-docs/docs/test-reporting/pipes/csv.md +0 -23
  266. package/skills/testeiya/testomatio-docs/docs/test-reporting/pipes/debug.md +0 -18
  267. package/skills/testeiya/testomatio-docs/docs/test-reporting/pipes/github.md +0 -63
  268. package/skills/testeiya/testomatio-docs/docs/test-reporting/pipes/gitlab.md +0 -29
  269. package/skills/testeiya/testomatio-docs/docs/test-reporting/pipes/html.md +0 -80
  270. package/skills/testeiya/testomatio-docs/docs/test-reporting/pipes/index.mdx +0 -57
  271. package/skills/testeiya/testomatio-docs/docs/test-reporting/pipes/testomatio.md +0 -331
  272. package/skills/testeiya/testomatio-docs/docs/test-reporting/python.md +0 -229
  273. package/skills/testeiya/testomatio-docs/docs/test-reporting/workflows.md +0 -325
  274. package/skills/testeiya/testomatio-docs/docs/tutorials/Interacting-via-API.md +0 -159
  275. package/skills/testeiya/testomatio-docs/docs/tutorials/Manual-Testing-Classic.md +0 -164
  276. package/skills/testeiya/testomatio-docs/docs/tutorials/Set-Up-Read-Only-Access.md +0 -85
  277. package/skills/testeiya/testomatio-docs/docs/tutorials/Using-AI-in-Testing.md +0 -163
  278. package/skills/testeiya/testomatio-docs/docs/tutorials/Working-with-Jira.md +0 -125
  279. package/skills/testeiya/testomatio-docs/docs/tutorials/java.md +0 -478
  280. package/skills/testeiya/testomatio-docs/docs/tutorials/playwright.md +0 -207
  281. package/skills/testeiya/testomatio-docs/docs/tutorials/webdriver.md +0 -218
  282. package/skills/testeiya/testomatio-docs/docs.lock.json +0 -6
  283. package/skills/testeiya/testomatio-reporter/SKILL.md +0 -307
  284. package/skills/testomatio/explorbot/explorbot-fundamentals/SKILL.md +0 -88
  285. package/skills/testomatio/explorbot/explorbot-plan/SKILL.md +0 -95
  286. package/skills/testomatio/explorbot/explorbot-setup/SKILL.md +0 -334
  287. package/skills/testomatio/test-automation/automate-manual-test-cases/CLAUDE.md +0 -56
  288. package/skills/testomatio/test-automation/automate-manual-test-cases/SKILL.md +0 -242
  289. package/skills/testomatio/test-automation/automate-manual-test-cases/references/CODECEPTJS_BEST_PRACTICES.md +0 -182
  290. package/skills/testomatio/test-automation/automate-manual-test-cases/references/FINAL_SUMMARY_TEMPLATE.md +0 -22
  291. package/skills/testomatio/test-automation/automate-manual-test-cases/references/PLAYWRIGHT_BEST_PRACTICES.md +0 -90
  292. package/skills/testomatio/test-automation/automate-manual-test-cases/references/POM_BEST_PRACTICES.md +0 -53
  293. package/skills/testomatio/test-automation/automate-manual-test-cases/references/TEST_DATA_MANAGEMENT.md +0 -52
  294. package/skills/testomatio/test-automation/debug-fix-failed-flaky-autotests/SKILL.md +0 -107
  295. package/skills/testomatio/test-automation/debug-fix-failed-flaky-autotests/references/DEBUGGING_QUICK_REFERENCE.md +0 -113
  296. package/skills/testomatio/test-automation/qa-automation-test-consolidation/SKILL.md +0 -29
  297. package/skills/testomatio/test-automation/run-tests-with-testomatio-reporter/SKILL.md +0 -151
  298. package/skills/testomatio/test-automation/setup-pr-testing/SKILL.md +0 -199
  299. package/skills/testomatio/test-automation/testomat-allure-adapter/SKILL.md +0 -289
  300. package/skills/testomatio/test-management/detect-duplicate-test-cases/SKILL.md +0 -86
  301. package/skills/testomatio/test-management/detect-duplicate-test-cases/references/DUPLICATE_INSTRUCTIONS.md +0 -54
  302. package/skills/testomatio/test-management/improve-test-cases/SKILL.md +0 -114
  303. package/skills/testomatio/test-management/improve-test-cases/references/TESTOMAT_MARKDOWN_EXAMPLE.md +0 -66
  304. package/skills/testomatio/test-management/pull-request-diff-analyzer/SKILL.md +0 -141
  305. package/skills/testomatio/test-management/qa-e2e-tests-reporting/SKILL.md +0 -354
  306. package/skills/testomatio/test-management/qa-e2e-tests-reporting/references/TESTOMATIO_ARTIFACTS.md +0 -82
  307. package/skills/testomatio/test-management/qa-e2e-tests-reporting/references/TESTOMATIO_HTML_REPORT.md +0 -37
  308. package/skills/testomatio/test-management/qa-e2e-tests-reporting/references/TESTOMATIO_REPORTERS_CONFIG.md +0 -118
  309. package/skills/testomatio/test-management/qa-pr-requirements-analyzer/SKILL.md +0 -149
  310. package/skills/testomatio/test-management/qa-pr-requirements-analyzer/references/summary-example.md +0 -54
  311. package/skills/testomatio/test-management/qa-requirement-reviewer/SKILL.md +0 -126
  312. package/skills/testomatio/test-management/qa-requirement-reviewer/references/requirements_reviewer_examples.md +0 -128
  313. package/skills/testomatio/test-management/qa-test-code-coverage/SKILL.md +0 -174
  314. package/skills/testomatio/test-management/qa-test-code-coverage/references/COVERAGE_FILE_FORMAT.md +0 -138
  315. package/skills/testomatio/test-management/qa-test-code-coverage/references/E2E_FRAMEWORKS.md +0 -65
  316. package/skills/testomatio/test-management/qa-test-code-coverage/scripts/check-coverage.mjs +0 -40
  317. package/skills/testomatio/test-management/qa-thinking/SKILL.md +0 -36
  318. package/skills/testomatio/test-management/qa-write-test-cases/SKILL.md +0 -267
  319. package/skills/testomatio/test-management/qa-write-test-cases/references/test-case-format.md +0 -387
  320. package/skills/testomatio/test-management/qa-write-test-cases/references/testomat-tms-guide.md +0 -72
  321. package/skills/testomatio/test-management/qa-write-test-cases/references/writing-rule.md +0 -159
  322. package/skills/testomatio/test-management/scan-automation-project/SKILL.md +0 -152
  323. package/skills/testomatio/test-management/sync-test-cases-with-tms/SKILL.md +0 -107
  324. package/skills/testomatio/test-management/sync-test-cases-with-tms/references/TESTOMATIO_CLI.md +0 -140
  325. package/skills/testomatio/test-management/testomatio-mcp/SKILL.md +0 -182
  326. package/skills/testomatio/test-management/testomatio-mcp/references/MCP_SETUP.md +0 -169
  327. package/skills.yaml +0 -21
  328. package/src/ai-debug.ts +0 -188
  329. package/src/api/agent-get.ts +0 -22
  330. package/src/api/agent-start.ts +0 -384
  331. package/src/api/client-log.ts +0 -29
  332. package/src/api/context.ts +0 -332
  333. package/src/api/debug-layout.ts +0 -47
  334. package/src/api/debug-report.ts +0 -29
  335. package/src/api/debug-snapshot.ts +0 -30
  336. package/src/api/debug-stream.ts +0 -52
  337. package/src/api/files-delete.ts +0 -184
  338. package/src/api/files-read.ts +0 -41
  339. package/src/api/files-rename.ts +0 -99
  340. package/src/api/files-tree.ts +0 -292
  341. package/src/api/files-write.ts +0 -41
  342. package/src/api/mcp.ts +0 -603
  343. package/src/api/memory.ts +0 -69
  344. package/src/api/open-external.ts +0 -39
  345. package/src/api/playwright-cli.ts +0 -606
  346. package/src/api/providers.ts +0 -457
  347. package/src/api/read-env-token.ts +0 -33
  348. package/src/api/sessions.ts +0 -79
  349. package/src/api/settings.ts +0 -120
  350. package/src/api/skills.ts +0 -58
  351. package/src/api/testomatio-attachment.ts +0 -89
  352. package/src/api/testomatio-auth.ts +0 -284
  353. package/src/api/testomatio-proxy.ts +0 -197
  354. package/src/api/testomatio-run-stats.ts +0 -81
  355. package/src/api/testomatio-target.ts +0 -225
  356. package/src/api/testomatio-transcription.ts +0 -82
  357. package/src/api/workspace-search.ts +0 -96
  358. package/src/api/workspace-sync.ts +0 -151
  359. package/src/api/workspace.ts +0 -165
  360. package/src/app-server.ts +0 -556
  361. package/src/bridge.ts +0 -251
  362. package/src/check-tests.ts +0 -156
  363. package/src/cli.ts +0 -17
  364. package/src/commands.ts +0 -244
  365. package/src/config.ts +0 -183
  366. package/src/connection.ts +0 -658
  367. package/src/context-store.ts +0 -265
  368. package/src/debug-bus.ts +0 -405
  369. package/src/extensions/tool-gate.ts +0 -220
  370. package/src/extensions/webui/ask-channel.ts +0 -52
  371. package/src/extensions/webui/index.ts +0 -184
  372. package/src/extensions/webui/tools/ask-question.ts +0 -88
  373. package/src/extensions/webui/tools/query-result.ts +0 -79
  374. package/src/extensions/webui/tools/render-chart.ts +0 -53
  375. package/src/extensions/webui/tools/render-item.ts +0 -61
  376. package/src/extensions/webui/tools/render-list.ts +0 -170
  377. package/src/extensions/webui/tools/render-result.ts +0 -85
  378. package/src/extensions/webui/tools/render-tree.ts +0 -71
  379. package/src/extensions/webui/tools/ui-widget.ts +0 -54
  380. package/src/extensions/webui/tools/widget-result.ts +0 -13
  381. package/src/extensions/webui/widget-channel.ts +0 -50
  382. package/src/file-log.ts +0 -196
  383. package/src/git-tracked.ts +0 -68
  384. package/src/gitignore.ts +0 -53
  385. package/src/json-store.ts +0 -43
  386. package/src/load-env.ts +0 -70
  387. package/src/loader-style.ts +0 -96
  388. package/src/main.ts +0 -140
  389. package/src/mcp-catalog.ts +0 -96
  390. package/src/models-catalog.ts +0 -72
  391. package/src/permissions.ts +0 -120
  392. package/src/project-dir.ts +0 -189
  393. package/src/project-info.ts +0 -108
  394. package/src/prompt/app-ui.ts +0 -59
  395. package/src/prompt/browser.ts +0 -27
  396. package/src/prompt/index.ts +0 -62
  397. package/src/server-info.ts +0 -62
  398. package/src/session-factory.ts +0 -442
  399. package/src/session-store.ts +0 -115
  400. package/src/shell-env.ts +0 -45
  401. package/src/skills.ts +0 -163
  402. package/src/sync-snapshot.ts +0 -140
  403. package/src/telemetry.ts +0 -239
  404. package/src/testomatio-auth.ts +0 -299
  405. package/src/testomatio.ts +0 -98
  406. package/src/theme.ts +0 -30
  407. package/src/user-env.ts +0 -94
  408. package/src/welcome.ts +0 -127
  409. package/src/workspace/safe-path.ts +0 -85
  410. package/src/workspace/test-md.ts +0 -70
  411. package/src/workspace-model.ts +0 -440
  412. package/testeiya.config.json +0 -14
@@ -0,0 +1,139 @@
1
+ import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
2
+ import { createRequire } from "node:module";
3
+ import { join } from "node:path";
4
+ import { pathToFileURL } from "node:url";
5
+ import { PI_STATE_DIR } from "./env.js";
6
+ const require_ = createRequire(import.meta.url);
7
+ export const SERVER = "testomatio";
8
+ /**
9
+ * Promoted to their own tools instead of going through the proxy: the reads the
10
+ * skills reach for constantly. @testomatio/mcp exposes 90 tools and registering
11
+ * them all would cost roughly 15k tokens of system prompt, which is the bloat
12
+ * the proxy exists to avoid. Everything else stays reachable through `mcp`.
13
+ */
14
+ export const DIRECT_TOOLS = [
15
+ "tests_list",
16
+ "tests_get",
17
+ "tests_search",
18
+ "suites_list",
19
+ "suites_get",
20
+ "runs_list",
21
+ "runs_get",
22
+ "testruns_list",
23
+ "plans_list",
24
+ "plans_get",
25
+ "labels_list",
26
+ ];
27
+ /**
28
+ * The Testomat.io MCP server needs a project id as well as a token — a token on
29
+ * its own does not identify a project to it. Without one the agent still reaches
30
+ * the project through `check-tests` and REST, which need only the token, so the
31
+ * prompt says exactly that instead of naming tools that are not there.
32
+ */
33
+ export function tmsAccess() {
34
+ if (hasMcp())
35
+ return "mcp-proxy";
36
+ return "cli-only";
37
+ }
38
+ export function hasTestomatio() {
39
+ return Boolean(process.env.TESTOMATIO);
40
+ }
41
+ export function hasMcp() {
42
+ return Boolean(process.env.TESTOMATIO && projectId());
43
+ }
44
+ function projectId() {
45
+ return process.env.TESTOMATIO_PROJECT_ID ?? "";
46
+ }
47
+ /**
48
+ * An in-memory server definition built from the environment. Deliberately not
49
+ * discovered from the checkout: a CI clone must not be able to point the agent
50
+ * at an MCP server of its own.
51
+ */
52
+ export function mcpConfig() {
53
+ const args = [
54
+ require_.resolve("@testomatio/mcp/index.js"),
55
+ "--token",
56
+ process.env.TESTOMATIO ?? "",
57
+ "--project",
58
+ projectId(),
59
+ ];
60
+ const env = {};
61
+ if (process.env.TESTOMATIO_URL)
62
+ env.TESTOMATIO_BASE_URL = process.env.TESTOMATIO_URL;
63
+ return {
64
+ mcpServers: {
65
+ [SERVER]: {
66
+ command: process.execPath,
67
+ args,
68
+ env,
69
+ lifecycle: "lazy",
70
+ directTools: DIRECT_TOOLS,
71
+ },
72
+ },
73
+ };
74
+ }
75
+ export function metadataCachePath() {
76
+ return join(PI_STATE_DIR, "mcp-cache.json");
77
+ }
78
+ /**
79
+ * The MCP adapter, bundled at build time (see scripts/vendor-entry.ts). The
80
+ * specifier is built at runtime so it is never resolved at compile time — the
81
+ * bundle only exists after a build.
82
+ */
83
+ export function vendorBundle() {
84
+ return pathToFileURL(join(import.meta.dirname, "..", "vendor", "mcp.js")).href;
85
+ }
86
+ /**
87
+ * Direct tools are registered from the adapter's metadata cache, which does not
88
+ * exist on a fresh CI runner — so a first run would degrade to proxy-only. The
89
+ * tool metadata ships with this package as mcp-tools.json (generated from
90
+ * @testomatio/mcp's own definitions), and this writes it as a cache entry.
91
+ *
92
+ * The entry is keyed by a hash of the resolved server definition, so the hash
93
+ * comes from the adapter's own bundled code rather than a copy of its logic — a
94
+ * mismatch would silently invalidate the seed. A failure here is not fatal: the
95
+ * run continues proxy-only, which still works.
96
+ */
97
+ export async function seedMetadataCache(config) {
98
+ const cachePath = metadataCachePath();
99
+ if (existsSync(cachePath))
100
+ return;
101
+ const tools = readSeedTools();
102
+ if (tools.length === 0)
103
+ return;
104
+ const hash = await computeServerHash(config.mcpServers[SERVER]);
105
+ if (!hash)
106
+ return;
107
+ const cache = {
108
+ version: 1,
109
+ servers: {
110
+ [SERVER]: {
111
+ configHash: hash,
112
+ tools,
113
+ resources: [],
114
+ cachedAt: Date.now(),
115
+ },
116
+ },
117
+ };
118
+ mkdirSync(PI_STATE_DIR, { recursive: true });
119
+ writeFileSync(cachePath, `${JSON.stringify(cache, null, 2)}\n`, "utf8");
120
+ }
121
+ function readSeedTools() {
122
+ const path = join(import.meta.dirname, "..", "..", "mcp-tools.json");
123
+ try {
124
+ return JSON.parse(readFileSync(path, "utf8"));
125
+ }
126
+ catch {
127
+ return [];
128
+ }
129
+ }
130
+ async function computeServerHash(definition) {
131
+ try {
132
+ const vendor = (await import(vendorBundle()));
133
+ return vendor.computeServerHash(definition);
134
+ }
135
+ catch {
136
+ return null;
137
+ }
138
+ }
139
+ //# sourceMappingURL=mcp.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp.js","sourceRoot":"","sources":["../../src/mcp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC,MAAM,QAAQ,GAAG,aAAa,CAAC,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O,EAAE,IAAI,EAAE,IAAI,EAAE,gBAAgB,CAAC,CAAC;IACrE,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;IAChD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC;AAED,KAAK,UAAU,iBAAiB,CAAC,UAAmB;IAClD,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,CAAC,MAAM,MAAM,CAAC,YAAY,EAAE,CAAC,CAE3C,CAAC;QACF,OAAO,MAAM,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC;IAC9C,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
@@ -0,0 +1,66 @@
1
+ /** Provider key env vars the CLI picks up from the environment. */
2
+ export const PROVIDER_KEYS = [
3
+ { provider: "openrouter", env: "OPENROUTER_API_KEY" },
4
+ { provider: "anthropic", env: "ANTHROPIC_API_KEY" },
5
+ { provider: "openai", env: "OPENAI_API_KEY" },
6
+ { provider: "google", env: "GEMINI_API_KEY" },
7
+ ];
8
+ /** Bad usage — the caller prints the message and exits 2, never prompting. */
9
+ export class UsageError extends Error {
10
+ }
11
+ /**
12
+ * --model, then TESTEIYA_MODEL. There is no default: the model a run spends
13
+ * money on is the caller's choice, never a pin that goes stale here. The
14
+ * desktop app's `~/.testeiya/config.json` is not consulted either — a CI run
15
+ * must not depend on a choice made in someone's GUI. Anything unresolvable
16
+ * throws, so a run never falls through to a prompt.
17
+ */
18
+ export function resolveModel(runtime, explicit) {
19
+ const candidate = explicit || process.env.TESTEIYA_MODEL;
20
+ if (!candidate) {
21
+ throw new UsageError("no model — pass --model <provider>/<id> or set TESTEIYA_MODEL");
22
+ }
23
+ const parsed = splitModelId(candidate);
24
+ if (!parsed) {
25
+ throw new UsageError(`a model must be <provider>/<model-id>, got "${candidate}"`);
26
+ }
27
+ const model = runtime.getModel(parsed.provider, parsed.id);
28
+ if (!model) {
29
+ throw new UsageError(`unknown model "${parsed.id}" for provider "${parsed.provider}"`);
30
+ }
31
+ return requireAuth(runtime, model);
32
+ }
33
+ /** Hand the runtime whichever provider keys the environment resolved. */
34
+ export async function applyEnvKeys(runtime) {
35
+ for (const { provider, env } of PROVIDER_KEYS) {
36
+ const key = process.env[env];
37
+ if (!key)
38
+ continue;
39
+ if (runtime.hasConfiguredAuth(provider))
40
+ continue;
41
+ await runtime.setRuntimeApiKey(provider, key);
42
+ }
43
+ }
44
+ // Without this the run reaches pi's own credential error, which points at a
45
+ // `/login` command this CLI does not have and at paths inside node_modules.
46
+ function requireAuth(runtime, model) {
47
+ if (runtime.hasConfiguredAuth(model.provider))
48
+ return model;
49
+ const known = PROVIDER_KEYS.find((k) => k.provider === model.provider);
50
+ let how = `save a key for "${model.provider}" in ~/.testeiya/auth.json`;
51
+ if (known)
52
+ how = `set ${known.env} in the environment or ~/.testeiya/.env`;
53
+ throw new UsageError(`no API key for ${model.provider} (model ${model.id}) — ${how}`);
54
+ }
55
+ // Splits on the FIRST slash — OpenRouter model ids contain slashes themselves.
56
+ function splitModelId(value) {
57
+ const slash = value.indexOf("/");
58
+ if (slash <= 0)
59
+ return null;
60
+ const provider = value.slice(0, slash);
61
+ const id = value.slice(slash + 1);
62
+ if (!id)
63
+ return null;
64
+ return { provider, id };
65
+ }
66
+ //# sourceMappingURL=model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model.js","sourceRoot":"","sources":["../../src/model.ts"],"names":[],"mappings":"AAEA,mEAAmE;AACnE,MAAM,CAAC,MAAM,aAAa,GAA6C;IACrE,EAAE,QAAQ,EAAE,YAAY,EAAE,GAAG,EAAE,oBAAoB,EAAE;IACrD,EAAE,QAAQ,EAAE,WAAW,EAAE,GAAG,EAAE,mBAAmB,EAAE;IACnD,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,EAAE,gBAAgB,EAAE;IAC7C,EAAE,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AACH,CAAC;AAED,4EAA4E;AAC5E,4EAA4E;AAC5E,SAAS,WAAW,CAAI,OAAqB,EAAE,KAA2C;IACxF,IAAI,OAAO,CAAC,iBAAiB,CAAC,KAAK,CAAC,QAAQ,CAAC;QAAE,OAAO,KAAK,CAAC;IAC5D,MAAM,KAAK,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,KAAK,KAAK,CAAC,QAAQ,CAAC,CAAC;IACvE,IAAI,GAAG,GAAG,mBAAmB,KAAK,CAAC,QAAQ,4BAA4B,CAAC;IACxE,IAAI,KAAK;QAAE,GAAG,GAAG,OAAO,KAAK,CAAC,GAAG,yCAAyC,CAAC;IAC3E,MAAM,IAAI,UAAU,CAAC,kBAAkB,KAAK,CAAC,QAAQ,WAAW,KAAK,CAAC,EAAE,OAAO,GAAG,EAAE,CAAC,CAAC;AACxF,CAAC;AAED,+EAA+E;AAC/E,SAAS,YAAY,CAAC,KAAa;IACjC,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACjC,IAAI,KAAK,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC;IAC5B,MAAM,QAAQ,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;IACvC,MAAM,EAAE,GAAG,KAAK,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;IAClC,IAAI,CAAC,EAAE;QAAE,OAAO,IAAI,CAAC;IACrB,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC;AAC1B,CAAC"}
@@ -0,0 +1,41 @@
1
+ import { Type } from "typebox";
2
+ export function createSetResultTool(runtime) {
3
+ return {
4
+ name: "set_result",
5
+ label: "Set run result",
6
+ description: "Set the outcome of this non-interactive run, which becomes the process " +
7
+ "exit code. Call once with status 'fail' when the verdict is negative — " +
8
+ "regressions found, a quality gate unmet, tests broken, or the task could " +
9
+ "not be completed. Do not call it on success: the run passes by default. " +
10
+ "This does not end the run; finish your work and write your report as usual.",
11
+ parameters: Type.Object({
12
+ status: Type.Union([Type.Literal("pass"), Type.Literal("fail")], {
13
+ description: "'fail' exits the process with code 1; 'pass' with code 0.",
14
+ }),
15
+ reason: Type.String({
16
+ description: "One line explaining the verdict, shown to whoever runs the command " +
17
+ "(e.g. '3 of 12 checkout tests have no assertions').",
18
+ }),
19
+ }),
20
+ async execute(_toolCallId, params) {
21
+ const p = params;
22
+ runtime.status = p.status;
23
+ runtime.reason = p.reason;
24
+ return {
25
+ content: [
26
+ {
27
+ type: "text",
28
+ text: `Recorded: ${p.status}. The command will exit ${exitFor(p.status)}.`,
29
+ },
30
+ ],
31
+ details: p,
32
+ };
33
+ },
34
+ };
35
+ }
36
+ function exitFor(status) {
37
+ if (status === "fail")
38
+ return 1;
39
+ return 0;
40
+ }
41
+ //# sourceMappingURL=result.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"result.js","sourceRoot":"","sources":["../../src/result.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAG/B,MAAM,UAAU,mBAAmB,CAAC,OAAkB;IACpD,OAAO;QACL,IAAI,EAAE,YAAY;QAClB,KAAK,EAAE,gBAAgB;QACvB,WAAW,EACT,yEAAyE;YACzE,yEAAyE;YACzE,2EAA2E;YAC3E,0EAA0E;YAC1E,6EAA6E;QAC/E,UAAU,EAAE,IAAI,CAAC,MAAM,CAAC;YACtB,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE;gBAC/D,WAAW,EAAE,2DAA2D;aACzE,CAAC;YACF,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC;gBAClB,WAAW,EACT,qEAAqE;oBACrE,qDAAqD;aACxD,CAAC;SACH,CAAC;QACF,KAAK,CAAC,OAAO,CAAC,WAAW,EAAE,MAAM;YAC/B,MAAM,CAAC,GAAG,MAAqD,CAAC;YAChE,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC;YAC1B,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC;YAC1B,OAAO;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,aAAa,CAAC,CAAC,MAAM,2BAA2B,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG;qBAC3E;iBACF;gBACD,OAAO,EAAE,CAAC;aACX,CAAC;QACJ,CAAC;KACgB,CAAC;AACtB,CAAC;AAED,SAAS,OAAO,CAAC,MAAuB;IACtC,IAAI,MAAM,KAAK,MAAM;QAAE,OAAO,CAAC,CAAC;IAChC,OAAO,CAAC,CAAC;AACX,CAAC"}
@@ -0,0 +1,199 @@
1
+ import { existsSync, statSync } from "node:fs";
2
+ import { readFile } from "node:fs/promises";
3
+ import { chalkStderr as c } from "chalk";
4
+ import { hasTestomatio } from "./mcp.js";
5
+ import { UsageError } from "./model.js";
6
+ import { createTesteiyaSession } from "./session.js";
7
+ export async function runPrint(options) {
8
+ const started = Date.now();
9
+ const result = {};
10
+ const outputPath = options.outputFile;
11
+ const stampBefore = fileStamp(outputPath);
12
+ const cwd = process.cwd();
13
+ let created;
14
+ try {
15
+ created = await createTesteiyaSession({
16
+ cwd,
17
+ result,
18
+ model: options.model,
19
+ outputFile: outputPath,
20
+ ...connectionOptions(),
21
+ });
22
+ }
23
+ catch (err) {
24
+ // A misconfigured model or missing key is bad usage (exit 2), not a failed
25
+ // run — cli.ts turns it into that. Everything else is a failed run.
26
+ if (err instanceof UsageError)
27
+ throw err;
28
+ note(c.red(` ✗ ${errorText(err)}`));
29
+ return 1;
30
+ }
31
+ const { session, model, skills } = created;
32
+ process.on("SIGINT", () => {
33
+ note(c.yellow("\n ⨯ interrupted"));
34
+ void session.abort().finally(() => process.exit(130));
35
+ });
36
+ note(` Testeiya ${c.dim("·")} ${model} ${c.dim("·")} ${cwd}`);
37
+ note(c.dim(` ${skills} skills`));
38
+ if (outputPath)
39
+ note(c.dim(` → ${outputPath}`));
40
+ note("");
41
+ const run = watchRun(session);
42
+ await promptOnce(session, options.prompt, run);
43
+ const report = await collectReport(session, run, outputPath, stampBefore, result.status);
44
+ run.unsubscribe();
45
+ note("");
46
+ summarize(run, result, started, outputPath, report);
47
+ const code = exitCode(run.error, result.status, Boolean(outputPath), report);
48
+ if (report && !outputPath)
49
+ process.stdout.write(report);
50
+ await session.dispose();
51
+ return code;
52
+ }
53
+ export function exitCode(error, status, wantsReport, report) {
54
+ if (error)
55
+ return 1;
56
+ if (status === "fail")
57
+ return 1;
58
+ if (wantsReport && !report)
59
+ return 1;
60
+ return 0;
61
+ }
62
+ // A project token in the environment is the CLI's whole notion of a connection:
63
+ // no slugs, nothing pulled per project. `tokenAvailable` renders the section
64
+ // that says exactly that, and the TMS rules alongside it.
65
+ function connectionOptions() {
66
+ if (!hasTestomatio())
67
+ return {};
68
+ return {
69
+ connection: { tokenAvailable: true },
70
+ backendUrl: process.env.TESTOMATIO_URL,
71
+ };
72
+ }
73
+ function watchRun(session) {
74
+ const run = { steps: 0, input: 0, output: 0, error: null, unsubscribe: () => { } };
75
+ run.unsubscribe = session.subscribe((event) => {
76
+ if (event.type === "tool_execution_start") {
77
+ run.steps++;
78
+ note(` ${c.dim("▸")} ${c.cyan(event.toolName)}`);
79
+ }
80
+ if (event.type === "tool_execution_end" && event.isError) {
81
+ note(` ${c.red("✗")} ${c.red(event.toolName)}`);
82
+ }
83
+ if (event.type === "turn_end" && event.message.role === "assistant") {
84
+ run.input += event.message.usage.input;
85
+ run.output += event.message.usage.output;
86
+ run.error = null;
87
+ if (event.message.stopReason === "error") {
88
+ run.error = event.message.errorMessage || "The model request failed.";
89
+ }
90
+ }
91
+ if (event.type === "agent_end" && event.willRetry) {
92
+ run.error = null;
93
+ }
94
+ });
95
+ return run;
96
+ }
97
+ async function promptOnce(session, text, run) {
98
+ try {
99
+ await session.prompt(text, { expandPromptTemplates: false });
100
+ }
101
+ catch (err) {
102
+ run.error = errorText(err);
103
+ }
104
+ }
105
+ async function collectReport(session, run, path, before, status) {
106
+ if (run.error)
107
+ return null;
108
+ if (!path)
109
+ return lastAssistantText(session);
110
+ const report = await readIfFresh(path, before);
111
+ if (report)
112
+ return report;
113
+ if (status === "fail")
114
+ return null;
115
+ return nudgeForReport(session, run, path, before);
116
+ }
117
+ async function nudgeForReport(session, run, path, before) {
118
+ note(c.yellow(" ⟳ report missing, asking once more"));
119
+ await promptOnce(session, `You have not written the report to ${path} yet. Write it now with the write tool: ` +
120
+ `the complete report in markdown, nothing else.`, run);
121
+ if (run.error)
122
+ return null;
123
+ const report = await readIfFresh(path, before);
124
+ if (report)
125
+ return report;
126
+ run.error = `no report written to ${path}`;
127
+ return null;
128
+ }
129
+ function summarize(run, result, started, outputPath, report) {
130
+ const stats = `${elapsed(started)} ${c.dim("·")} ${run.steps} steps ${c.dim("·")} ${tokens(run.input)} in / ${tokens(run.output)} out`;
131
+ if (run.error) {
132
+ note(` ${c.red("✗ failed")} ${c.dim("·")} ${stats}`);
133
+ note(` ${c.red(run.error)}`);
134
+ return;
135
+ }
136
+ if (result.status === "fail") {
137
+ note(` ${c.red("✗ fail")} ${c.dim("·")} ${stats}`);
138
+ if (result.reason)
139
+ note(` ${c.red(result.reason)}`);
140
+ return;
141
+ }
142
+ let target = "";
143
+ if (report && outputPath)
144
+ target = ` ${c.dim("→")} ${outputPath}`;
145
+ note(` ${c.green("✓ done")} ${c.dim("·")} ${stats}${target}`);
146
+ }
147
+ async function readIfFresh(path, before) {
148
+ if (fileStamp(path) === before)
149
+ return null;
150
+ const text = await readFile(path, "utf8").catch(() => "");
151
+ if (!text.trim())
152
+ return null;
153
+ if (text.endsWith("\n"))
154
+ return text;
155
+ return `${text}\n`;
156
+ }
157
+ function fileStamp(path) {
158
+ if (!path || !existsSync(path))
159
+ return null;
160
+ const stat = statSync(path);
161
+ return `${stat.mtimeMs}:${stat.size}`;
162
+ }
163
+ function lastAssistantText(session) {
164
+ const messages = session.state.messages ?? [];
165
+ for (let i = messages.length - 1; i >= 0; i--) {
166
+ const message = messages[i];
167
+ if (message?.role !== "assistant")
168
+ continue;
169
+ const parts = [];
170
+ for (const part of message.content) {
171
+ if (part.type === "text")
172
+ parts.push(part.text);
173
+ }
174
+ const text = parts.join("").trim();
175
+ if (text)
176
+ return `${text}\n`;
177
+ }
178
+ return null;
179
+ }
180
+ function errorText(err) {
181
+ if (err instanceof Error)
182
+ return err.message;
183
+ return String(err);
184
+ }
185
+ function note(line) {
186
+ process.stderr.write(`${line}\n`);
187
+ }
188
+ function elapsed(started) {
189
+ const seconds = Math.round((Date.now() - started) / 1000);
190
+ if (seconds < 60)
191
+ return `${seconds}s`;
192
+ return `${Math.floor(seconds / 60)}m ${seconds % 60}s`;
193
+ }
194
+ function tokens(count) {
195
+ if (count < 1000)
196
+ return String(count);
197
+ return `${(count / 1000).toFixed(1)}k`;
198
+ }
199
+ //# sourceMappingURL=run.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run.js","sourceRoot":"","sources":["../../src/run.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,WAAW,IAAI,CAAC,EAAE,MAAM,OAAO,CAAC;AAGzC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAGrD,MAAM,CAAC,KAAK,UAAU,QAAQ,CAAC,OAAqB;IAClD,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IAC3B,MAAM,MAAM,GAAc,EAAE,CAAC;IA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IACvC,OAAO,GAAG,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC;AACzC,CAAC"}
@@ -0,0 +1,77 @@
1
+ import { join } from "node:path";
2
+ import { createAgentSession, DefaultResourceLoader, ModelRuntime, SessionManager, SettingsManager, } from "@earendil-works/pi-coding-agent";
3
+ import { buildSystemPrompt } from "../prompt/index.js";
4
+ import { PI_STATE_DIR, TESTEIYA_HOME } from "./env.js";
5
+ import { hasMcp, tmsAccess } from "./mcp.js";
6
+ import { applyEnvKeys, resolveModel } from "./model.js";
7
+ import { createSetResultTool } from "./result.js";
8
+ // dist/src/session.js → the package root. `../skills` would resolve to
9
+ // dist/skills, and the skills filter below would then silently drop everything.
10
+ const BUNDLED_SKILLS_DIR = join(import.meta.dirname, "..", "..", "skills");
11
+ const MCP_EXTENSION = join(import.meta.dirname, "mcp-extension.js");
12
+ export async function createTesteiyaSession(options) {
13
+ // The adapter reads its metadata cache from this dir, and it takes it from the
14
+ // environment rather than from anything we pass in.
15
+ process.env.PI_CODING_AGENT_DIR = PI_STATE_DIR;
16
+ const runtime = await ModelRuntime.create({
17
+ authPath: join(TESTEIYA_HOME, "auth.json"),
18
+ modelsPath: null,
19
+ });
20
+ await applyEnvKeys(runtime);
21
+ const model = resolveModel(runtime, options.model);
22
+ const settingsManager = SettingsManager.inMemory();
23
+ const extensionPaths = [];
24
+ if (hasMcp())
25
+ extensionPaths.push(MCP_EXTENSION);
26
+ const loader = new DefaultResourceLoader({
27
+ cwd: options.cwd,
28
+ agentDir: PI_STATE_DIR,
29
+ settingsManager,
30
+ additionalSkillPaths: [BUNDLED_SKILLS_DIR],
31
+ additionalExtensionPaths: extensionPaths,
32
+ systemPromptOverride: () => buildSystemPrompt({
33
+ cwd: options.cwd,
34
+ mode: "print",
35
+ tms: tmsAccess(),
36
+ tokens: options.tokens,
37
+ connection: options.connection,
38
+ backendUrl: options.backendUrl,
39
+ outputFile: options.outputFile,
40
+ }),
41
+ // A filter, not a loader: pi also discovers skills from the checkout it is
42
+ // pointed at (`.agents/skills`, `.pi/skills`, and the user's own), and an
43
+ // arbitrary CI clone must not be able to hand the model its own skills.
44
+ skillsOverride: (current) => ({
45
+ skills: current.skills.filter((s) => s.baseDir.startsWith(BUNDLED_SKILLS_DIR)),
46
+ diagnostics: current.diagnostics,
47
+ }),
48
+ });
49
+ await loader.reload();
50
+ const { session } = await createAgentSession({
51
+ cwd: options.cwd,
52
+ agentDir: PI_STATE_DIR,
53
+ model,
54
+ modelRuntime: runtime,
55
+ resourceLoader: loader,
56
+ settingsManager,
57
+ sessionManager: SessionManager.inMemory(options.cwd),
58
+ customTools: [createSetResultTool(options.result)],
59
+ // Extensions start their runtime on this event. Without it the MCP adapter
60
+ // registers its tools but never connects, and every call answers
61
+ // "MCP not initialized".
62
+ sessionStartEvent: { type: "session_start", reason: "startup" },
63
+ });
64
+ // Starts the extension runtime and fires session_start. createAgentSession
65
+ // does not do this — pi's own modes do — and without it an extension is
66
+ // constructed but never initialized: the MCP adapter registers its tools and
67
+ // then answers "MCP not initialized" for every call.
68
+ await session.bindExtensions({
69
+ mode: "print",
70
+ onError: (err) => {
71
+ process.stderr.write(` extension error (${err.extensionPath}): ${err.error}\n`);
72
+ },
73
+ });
74
+ const skills = loader.getSkills().skills.length;
75
+ return { session, model: `${model.provider}/${model.id}`, skills };
76
+ }
77
+ //# sourceMappingURL=session.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session.js","sourceRoot":"","sources":["../../src/session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EACL,kBAAkB,EAClB,qBAAqB,EACrB,YAAY,EACZ,cAAc,EACd,eAAe,GAEhB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACvD,O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