@orion-qa/orion 3.0.0 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (578) hide show
  1. package/.claude/agents/codebase-analyst.md +1 -1
  2. package/.claude/settings.json +9 -0
  3. package/.claude/skills/appium/SKILL.md +1 -1
  4. package/.claude/skills/appium/templates/README.md +6 -9
  5. package/.claude/skills/appium/templates/ci/github-actions-android.yml +8 -2
  6. package/.claude/skills/appium/templates/ci/github-actions-ios.yml +8 -2
  7. package/.claude/skills/appium/templates/ci/github-actions-windows.yml +9 -2
  8. package/.claude/skills/appium/templates/project-java/.env.example +4 -0
  9. package/.claude/skills/appium/templates/project-java/pom.xml +2 -0
  10. package/.claude/skills/appium/templates/project-java/src/test/java/automation/{framework/Config.java → config/Env.java} +43 -52
  11. package/.claude/skills/appium/templates/project-java/src/test/java/automation/config/Flags.java +45 -0
  12. package/.claude/skills/appium/templates/project-java/src/test/java/automation/config/Paths.java +14 -0
  13. package/.claude/skills/appium/templates/project-java/src/test/java/automation/desc/SignInDesc.java +30 -0
  14. package/.claude/skills/appium/templates/project-java/src/test/java/automation/{framework → driver}/DriverFactory.java +19 -13
  15. package/.claude/skills/appium/templates/project-java/src/test/java/automation/{framework → driver}/DriverManager.java +12 -9
  16. package/.claude/skills/appium/templates/project-java/src/test/java/automation/fixtures/BaseTest.java +75 -0
  17. package/.claude/skills/appium/templates/project-java/src/test/java/automation/{screens → pageObjects}/BaseScreen.java +12 -12
  18. package/.claude/skills/appium/templates/project-java/src/test/java/automation/pageObjects/HomeScreen.java +26 -0
  19. package/.claude/skills/appium/templates/project-java/src/test/java/automation/pageObjects/LoginScreen.java +63 -0
  20. package/.claude/skills/appium/templates/project-java/src/test/java/automation/pageObjects/ShellScreen.java +26 -0
  21. package/.claude/skills/appium/templates/project-java/src/test/java/automation/setup/AuthSetup.java +49 -0
  22. package/.claude/skills/appium/templates/project-java/src/test/java/automation/testData/TestData.java +78 -0
  23. package/.claude/skills/appium/templates/project-java/src/test/java/automation/tests/ui/SignInTest.java +45 -0
  24. package/.claude/skills/appium/templates/project-java/src/test/java/automation/tests/unit/UtilsTest.java +34 -0
  25. package/.claude/skills/appium/templates/project-java/src/test/java/automation/{framework → utils}/AutomationError.java +4 -4
  26. package/.claude/skills/appium/templates/project-java/src/test/java/automation/utils/Case.java +20 -0
  27. package/.claude/skills/appium/templates/project-java/src/test/java/automation/utils/CaseTransformer.java +54 -0
  28. package/.claude/skills/appium/templates/project-java/src/test/java/automation/utils/Dates.java +42 -0
  29. package/.claude/skills/appium/templates/project-java/src/test/java/automation/utils/Log.java +45 -0
  30. package/.claude/skills/appium/templates/project-java/src/test/java/automation/utils/MissingSettingError.java +13 -0
  31. package/.claude/skills/appium/templates/project-java/src/test/java/automation/utils/RandomData.java +41 -0
  32. package/.claude/skills/appium/templates/project-java/src/test/java/automation/utils/Redact.java +33 -0
  33. package/.claude/skills/appium/templates/project-java/src/test/java/automation/utils/TestDescription.java +25 -0
  34. package/.claude/skills/appium/templates/project-java/src/test/resources/testData/testData.properties +7 -0
  35. package/.claude/skills/appium/templates/project-java/testng.xml +11 -4
  36. package/.claude/skills/architecture-analysis/SKILL.md +2 -1
  37. package/.claude/skills/automation-implementation/SKILL.md +2 -1
  38. package/.claude/skills/automation-implementation/references/patterns.md +46 -24
  39. package/.claude/skills/code-review/SKILL.md +3 -2
  40. package/.claude/skills/code-review/references/pattern-rules.md +12 -7
  41. package/.claude/skills/documentation/SKILL.md +23 -18
  42. package/.claude/skills/execution/SKILL.md +6 -3
  43. package/.claude/skills/httpclient/templates/README.md +6 -7
  44. package/.claude/skills/httpclient/templates/csharp-nunit/.env.example +4 -0
  45. package/.claude/skills/httpclient/templates/csharp-nunit/Automation.csproj +7 -3
  46. package/.claude/skills/httpclient/templates/csharp-nunit/Config/Env.cs +62 -0
  47. package/.claude/skills/httpclient/templates/csharp-nunit/Config/Flags.cs +35 -0
  48. package/.claude/skills/httpclient/templates/csharp-nunit/Config/Paths.cs +22 -0
  49. package/.claude/skills/httpclient/templates/csharp-nunit/Fixtures/BaseTest.cs +22 -0
  50. package/.claude/skills/httpclient/templates/csharp-nunit/Resources/Desc/ProductsDesc.cs +22 -0
  51. package/.claude/skills/httpclient/templates/csharp-nunit/Resources/TestData/TestData.cs +61 -0
  52. package/.claude/skills/httpclient/templates/csharp-nunit/Resources/TestData/testData.json +9 -0
  53. package/.claude/skills/httpclient/templates/csharp-nunit/Services/ApiClient.cs +48 -0
  54. package/.claude/skills/httpclient/templates/csharp-nunit/Services/HealthApi.cs +11 -0
  55. package/.claude/skills/httpclient/templates/csharp-nunit/{Api → Services}/ProductsApi.cs +8 -5
  56. package/.claude/skills/httpclient/templates/csharp-nunit/Tests/Api/ProductsTests.cs +61 -0
  57. package/.claude/skills/httpclient/templates/csharp-nunit/Tests/Unit/UtilsTests.cs +40 -0
  58. package/.claude/skills/httpclient/templates/csharp-nunit/Utils/AutomationError.cs +15 -0
  59. package/.claude/skills/httpclient/templates/csharp-nunit/Utils/Dates.cs +18 -0
  60. package/.claude/skills/httpclient/templates/csharp-nunit/Utils/Log.cs +37 -0
  61. package/.claude/skills/httpclient/templates/csharp-nunit/Utils/RandomData.cs +26 -0
  62. package/.claude/skills/httpclient/templates/csharp-nunit/Utils/Redact.cs +22 -0
  63. package/.claude/skills/httpclient/templates/csharp-nunit/Utils/TestDescription.cs +55 -0
  64. package/.claude/skills/javascript/references/sources.md +1 -1
  65. package/.claude/skills/k6/SKILL.md +1 -1
  66. package/.claude/skills/k6/templates/README.md +5 -3
  67. package/.claude/skills/k6/templates/project/{data/cases.js → resources/desc/products.desc.js} +1 -1
  68. package/.claude/skills/k6/templates/project/resources/testData/testData.js +32 -0
  69. package/.claude/skills/k6/templates/project/{lib/config.js → src/config/env.js} +10 -5
  70. package/.claude/skills/k6/templates/project/{lib → src/services}/products-api.js +7 -5
  71. package/.claude/skills/k6/templates/project/{load → tests/load}/products.js +8 -8
  72. package/.claude/skills/karate/templates/README.md +4 -5
  73. package/.claude/skills/karate/templates/java-junit5/.env.example +2 -0
  74. package/.claude/skills/karate/templates/java-junit5/pom.xml +4 -0
  75. package/.claude/skills/karate/templates/java-junit5/src/test/java/{support → config}/EnvSettings.java +1 -1
  76. package/.claude/skills/karate/templates/java-junit5/src/test/java/karate-config.js +13 -6
  77. package/.claude/skills/karate/templates/java-junit5/src/test/java/logback-test.xml +1 -1
  78. package/.claude/skills/karate/templates/java-junit5/src/test/java/{api → tests}/ApiTest.java +7 -4
  79. package/.claude/skills/karate/templates/java-junit5/src/test/java/{api → tests/api}/health.feature +3 -3
  80. package/.claude/skills/karate/templates/java-junit5/src/test/java/tests/api/products.feature +29 -0
  81. package/.claude/skills/karate/templates/java-junit5/src/test/java/{support → utils}/MaskingLogModifier.java +1 -1
  82. package/.claude/skills/karate/templates/java-junit5/src/test/resources/testData/newProduct.js +7 -0
  83. package/.claude/skills/karate/templates/java-junit5/src/test/resources/testData/testData.json +6 -0
  84. package/.claude/skills/newman/templates/README.md +4 -5
  85. package/.claude/skills/newman/templates/collection/.env.example +2 -0
  86. package/.claude/skills/newman/templates/collection/collections/api.postman_collection.json +165 -145
  87. package/.claude/skills/newman/templates/collection/package.json +2 -1
  88. package/.claude/skills/newman/templates/collection/resources/desc/products.desc.json +53 -0
  89. package/.claude/skills/newman/templates/collection/resources/testData/testData.json +10 -0
  90. package/.claude/skills/newman/templates/collection/run.js +41 -31
  91. package/.claude/skills/newman/templates/collection/src/config/env.js +37 -0
  92. package/.claude/skills/orion/SKILL.md +9 -7
  93. package/.claude/skills/orion/references/assess-fix.md +34 -0
  94. package/.claude/skills/orion/references/capabilities.md +1 -1
  95. package/.claude/skills/orion/references/conversation.md +9 -8
  96. package/.claude/skills/orion/references/delivery-formats.md +1 -1
  97. package/.claude/skills/orion/references/modes.md +3 -1
  98. package/.claude/skills/orion/references/project-context-files.md +6 -1
  99. package/.claude/skills/orion/references/setup-card.md +12 -6
  100. package/.claude/skills/orion/references/status-lines.md +6 -2
  101. package/.claude/skills/orion/references/task-brief.md +1 -0
  102. package/.claude/skills/orion/references/work-branch.md +3 -1
  103. package/.claude/skills/orion/scripts/browser_setup.mjs +30 -15
  104. package/.claude/skills/orion/scripts/env_check.mjs +8 -3
  105. package/.claude/skills/orion/scripts/env_check.py +12 -5
  106. package/.claude/skills/orion/scripts/fix_plan.mjs +149 -0
  107. package/.claude/skills/orion/scripts/graph.mjs +400 -0
  108. package/.claude/skills/orion/scripts/lib/inside.mjs +31 -0
  109. package/.claude/skills/orion/scripts/lib/scan.mjs +357 -0
  110. package/.claude/skills/orion/scripts/parity_check.mjs +166 -0
  111. package/.claude/skills/orion/scripts/report_check.mjs +77 -0
  112. package/.claude/skills/orion/scripts/results_parse.mjs +203 -0
  113. package/.claude/skills/orion/scripts/reuse_check.mjs +251 -0
  114. package/.claude/skills/orion/scripts/run_state.mjs +171 -0
  115. package/.claude/skills/orion/scripts/suite_check.mjs +228 -0
  116. package/.claude/skills/orion/scripts/timing_profile.mjs +128 -0
  117. package/.claude/skills/orion/scripts/usage_report.mjs +315 -0
  118. package/.claude/skills/orion/templates/project-context/assessment.md +45 -0
  119. package/.claude/skills/orion/templates/project-context/defects.md +5 -0
  120. package/.claude/skills/orion/templates/project-context/report.md +45 -0
  121. package/.claude/skills/orion/templates/project-context/run.md +4 -1
  122. package/.claude/skills/orion/templates/project-context/test-case-map.md +5 -0
  123. package/.claude/skills/orion/templates/project-context/test-design.md +18 -0
  124. package/.claude/skills/pact/SKILL.md +2 -2
  125. package/.claude/skills/pact/templates/README.md +4 -2
  126. package/.claude/skills/pact/templates/project/package.json +2 -2
  127. package/.claude/skills/pact/templates/project/{data/cases.js → resources/desc/products.desc.js} +3 -3
  128. package/.claude/skills/pact/templates/project/resources/testData/testData.js +21 -0
  129. package/.claude/skills/pact/templates/project/src/config/env.js +32 -0
  130. package/.claude/skills/pact/templates/project/src/{products-client.js → services/products-client.js} +4 -2
  131. package/.claude/skills/pact/templates/project/tests/contract/products.contract.test.js +46 -0
  132. package/.claude/skills/pact/templates/project/{verify → tests/verify}/products.verify.js +7 -22
  133. package/.claude/skills/playwright/SKILL.md +6 -6
  134. package/.claude/skills/playwright/templates/README.md +29 -10
  135. package/.claude/skills/playwright/templates/ci/Jenkinsfile +1 -1
  136. package/.claude/skills/playwright/templates/ci/azure-pipelines.yml +1 -1
  137. package/.claude/skills/playwright/templates/ci/github-actions-javascript.yml +1 -1
  138. package/.claude/skills/playwright/templates/ci/github-actions.yml +1 -1
  139. package/.claude/skills/playwright/templates/ci/gitlab-ci.yml +1 -1
  140. package/.claude/skills/playwright/templates/dotnet/.env.example +7 -0
  141. package/.claude/skills/playwright/templates/dotnet/.runsettings +17 -0
  142. package/.claude/skills/playwright/templates/dotnet/Automation.csproj +8 -0
  143. package/.claude/skills/playwright/templates/dotnet/Config/Env.cs +89 -0
  144. package/.claude/skills/playwright/templates/dotnet/Config/Flags.cs +56 -0
  145. package/.claude/skills/playwright/templates/dotnet/Config/Paths.cs +31 -0
  146. package/.claude/skills/playwright/templates/dotnet/Fixtures/ApiBaseTest.cs +39 -0
  147. package/.claude/skills/playwright/templates/dotnet/Fixtures/BaseTest.cs +72 -0
  148. package/.claude/skills/playwright/templates/dotnet/PageObjects/BasePage.cs +59 -0
  149. package/.claude/skills/playwright/templates/dotnet/PageObjects/HomePage.cs +21 -0
  150. package/.claude/skills/playwright/templates/dotnet/PageObjects/LoginPage.cs +54 -0
  151. package/.claude/skills/playwright/templates/dotnet/PageObjects/ShellPage.cs +29 -0
  152. package/.claude/skills/playwright/templates/dotnet/Resources/Desc/SignInDesc.cs +23 -0
  153. package/.claude/skills/playwright/templates/dotnet/Resources/TestData/TestData.cs +74 -0
  154. package/.claude/skills/playwright/templates/dotnet/Resources/TestData/testData.json +19 -0
  155. package/.claude/skills/playwright/templates/dotnet/Services/ApiClient.cs +51 -0
  156. package/.claude/skills/playwright/templates/dotnet/Setup/AuthSetup.cs +63 -0
  157. package/.claude/skills/playwright/templates/dotnet/Tests/Api/SessionTests.cs +18 -0
  158. package/.claude/skills/playwright/templates/dotnet/Tests/Ui/SignInTests.cs +48 -0
  159. package/.claude/skills/playwright/templates/dotnet/Tests/Unit/UtilsTests.cs +40 -0
  160. package/.claude/skills/playwright/templates/dotnet/Utils/AutomationError.cs +15 -0
  161. package/.claude/skills/playwright/templates/dotnet/Utils/Dates.cs +18 -0
  162. package/.claude/skills/playwright/templates/dotnet/Utils/Log.cs +37 -0
  163. package/.claude/skills/playwright/templates/dotnet/Utils/RandomData.cs +26 -0
  164. package/.claude/skills/playwright/templates/dotnet/Utils/Redact.cs +22 -0
  165. package/.claude/skills/playwright/templates/dotnet/Utils/TestDescription.cs +55 -0
  166. package/.claude/skills/playwright/templates/dotnet/gitignore +6 -1
  167. package/.claude/skills/playwright/templates/javascript/.env.example +8 -0
  168. package/.claude/skills/playwright/templates/javascript/fixtures/index.js +83 -0
  169. package/.claude/skills/playwright/templates/javascript/fixtures/session.js +79 -0
  170. package/.claude/skills/playwright/templates/javascript/gitignore +7 -0
  171. package/.claude/skills/playwright/templates/javascript/jsconfig.json +11 -0
  172. package/.claude/skills/playwright/templates/javascript/package.json +7 -3
  173. package/.claude/skills/playwright/templates/javascript/pageObjects/basePage.js +58 -0
  174. package/.claude/skills/playwright/templates/javascript/pageObjects/homePage.js +19 -0
  175. package/.claude/skills/playwright/templates/javascript/pageObjects/loginPage.js +44 -0
  176. package/.claude/skills/playwright/templates/javascript/pageObjects/shellPage.js +26 -0
  177. package/.claude/skills/playwright/templates/javascript/playwright.config.js +42 -24
  178. package/.claude/skills/playwright/templates/javascript/reporters/summaryReporter.js +233 -0
  179. package/.claude/skills/playwright/templates/javascript/resources/desc/signIn.desc.js +33 -0
  180. package/.claude/skills/playwright/templates/javascript/resources/testData/testData.js +45 -0
  181. package/.claude/skills/playwright/templates/javascript/setup/auth.setup.js +17 -0
  182. package/.claude/skills/playwright/templates/javascript/setup/auth.teardown.js +16 -0
  183. package/.claude/skills/playwright/templates/javascript/src/config/env.js +79 -0
  184. package/.claude/skills/playwright/templates/javascript/src/config/flags.js +70 -0
  185. package/.claude/skills/playwright/templates/javascript/src/config/loadEnv.js +21 -0
  186. package/.claude/skills/playwright/templates/javascript/src/config/paths.js +22 -0
  187. package/.claude/skills/playwright/templates/javascript/src/services/apiClient.js +68 -0
  188. package/.claude/skills/playwright/templates/javascript/tests/api/session.spec.js +15 -0
  189. package/.claude/skills/playwright/templates/javascript/tests/ui/signIn.spec.js +35 -0
  190. package/.claude/skills/playwright/templates/javascript/tests/unit/summaryReporter.test.js +34 -0
  191. package/.claude/skills/playwright/templates/javascript/tests/unit/utils.test.js +31 -0
  192. package/.claude/skills/playwright/templates/javascript/utils/date.js +28 -0
  193. package/.claude/skills/playwright/templates/javascript/{src → utils}/errors.js +1 -0
  194. package/.claude/skills/playwright/templates/javascript/utils/formFill.js +29 -0
  195. package/.claude/skills/playwright/templates/javascript/utils/logger.js +33 -0
  196. package/.claude/skills/playwright/templates/javascript/utils/random.js +37 -0
  197. package/.claude/skills/playwright/templates/javascript/utils/redact.js +35 -0
  198. package/.claude/skills/playwright/templates/javascript/utils/titles.js +38 -0
  199. package/.claude/skills/playwright/templates/project/.env.example +8 -0
  200. package/.claude/skills/playwright/templates/project/fixtures/index.ts +84 -0
  201. package/.claude/skills/playwright/templates/project/fixtures/session.ts +76 -0
  202. package/.claude/skills/playwright/templates/project/gitignore +9 -2
  203. package/.claude/skills/playwright/templates/project/package.json +8 -6
  204. package/.claude/skills/playwright/templates/project/pageObjects/basePage.ts +53 -0
  205. package/.claude/skills/playwright/templates/project/pageObjects/homePage.ts +20 -0
  206. package/.claude/skills/playwright/templates/project/pageObjects/loginPage.ts +47 -0
  207. package/.claude/skills/playwright/templates/project/pageObjects/shellPage.ts +22 -0
  208. package/.claude/skills/playwright/templates/project/playwright.config.ts +46 -23
  209. package/.claude/skills/playwright/templates/project/reporters/summaryReporter.ts +241 -0
  210. package/.claude/skills/playwright/templates/project/resources/desc/signIn.desc.ts +32 -0
  211. package/.claude/skills/playwright/templates/project/resources/testData/testData.ts +42 -0
  212. package/.claude/skills/playwright/templates/project/setup/auth.setup.ts +16 -0
  213. package/.claude/skills/playwright/templates/project/setup/auth.teardown.ts +15 -0
  214. package/.claude/skills/playwright/templates/project/src/config/env.ts +81 -0
  215. package/.claude/skills/playwright/templates/project/src/config/flags.ts +70 -0
  216. package/.claude/skills/playwright/templates/project/src/config/loadEnv.ts +17 -0
  217. package/.claude/skills/playwright/templates/project/src/config/paths.ts +19 -0
  218. package/.claude/skills/playwright/templates/project/src/services/apiClient.ts +70 -0
  219. package/.claude/skills/playwright/templates/project/tests/api/session.spec.ts +14 -0
  220. package/.claude/skills/playwright/templates/project/tests/ui/signIn.spec.ts +34 -0
  221. package/.claude/skills/playwright/templates/project/tests/unit/summaryReporter.test.ts +33 -0
  222. package/.claude/skills/playwright/templates/project/tests/unit/utils.test.ts +30 -0
  223. package/.claude/skills/playwright/templates/project/tsconfig.json +3 -8
  224. package/.claude/skills/playwright/templates/project/utils/date.ts +25 -0
  225. package/.claude/skills/playwright/templates/project/utils/formFill.ts +27 -0
  226. package/.claude/skills/playwright/templates/project/utils/logger.ts +32 -0
  227. package/.claude/skills/playwright/templates/project/utils/random.ts +34 -0
  228. package/.claude/skills/playwright/templates/project/utils/redact.ts +32 -0
  229. package/.claude/skills/playwright/templates/project/utils/titles.ts +42 -0
  230. package/.claude/skills/playwright/templates/python/.env.example +8 -0
  231. package/.claude/skills/playwright/templates/python/conftest.py +91 -16
  232. package/.claude/skills/playwright/templates/python/gitignore +5 -0
  233. package/.claude/skills/playwright/templates/python/page_objects/__init__.py +1 -0
  234. package/.claude/skills/playwright/templates/python/page_objects/base_page.py +54 -0
  235. package/.claude/skills/playwright/templates/python/page_objects/home_page.py +22 -0
  236. package/.claude/skills/playwright/templates/python/page_objects/login_page.py +42 -0
  237. package/.claude/skills/playwright/templates/python/page_objects/shell_page.py +21 -0
  238. package/.claude/skills/playwright/templates/python/pytest.ini +5 -2
  239. package/.claude/skills/playwright/templates/python/requirements.txt +1 -0
  240. package/.claude/skills/playwright/templates/python/resources/__init__.py +1 -0
  241. package/.claude/skills/playwright/templates/python/resources/desc/__init__.py +1 -0
  242. package/.claude/skills/playwright/templates/python/resources/desc/sign_in_desc.py +27 -0
  243. package/.claude/skills/playwright/templates/python/resources/test_data/__init__.py +1 -0
  244. package/.claude/skills/playwright/templates/python/resources/test_data/test_data.py +41 -0
  245. package/.claude/skills/playwright/templates/python/setup/__init__.py +1 -0
  246. package/.claude/skills/playwright/templates/python/setup/auth.py +53 -0
  247. package/.claude/skills/playwright/templates/python/src/__init__.py +1 -0
  248. package/.claude/skills/playwright/templates/python/src/config/__init__.py +1 -0
  249. package/.claude/skills/playwright/templates/python/{framework/config.py → src/config/env.py} +24 -33
  250. package/.claude/skills/playwright/templates/python/src/config/flags.py +63 -0
  251. package/.claude/skills/playwright/templates/python/src/config/load_env.py +16 -0
  252. package/.claude/skills/playwright/templates/python/src/config/paths.py +25 -0
  253. package/.claude/skills/playwright/templates/python/src/services/__init__.py +1 -0
  254. package/.claude/skills/playwright/templates/python/src/services/api_client.py +60 -0
  255. package/.claude/skills/playwright/templates/python/tests/api/test_session.py +14 -0
  256. package/.claude/skills/playwright/templates/python/tests/ui/test_sign_in.py +36 -0
  257. package/.claude/skills/playwright/templates/python/tests/unit/test_utils.py +32 -0
  258. package/.claude/skills/playwright/templates/python/utils/__init__.py +1 -0
  259. package/.claude/skills/playwright/templates/python/utils/dates.py +23 -0
  260. package/.claude/skills/playwright/templates/python/{framework → utils}/errors.py +3 -2
  261. package/.claude/skills/playwright/templates/python/utils/form_fill.py +26 -0
  262. package/.claude/skills/playwright/templates/python/utils/logger.py +40 -0
  263. package/.claude/skills/playwright/templates/python/utils/markers.py +6 -0
  264. package/.claude/skills/playwright/templates/python/utils/random_data.py +35 -0
  265. package/.claude/skills/playwright/templates/python/utils/redact.py +30 -0
  266. package/.claude/skills/playwright/templates/python/utils/titles.py +53 -0
  267. package/.claude/skills/quality-checks/SKILL.md +11 -11
  268. package/.claude/skills/quality-checks/templates/README.md +14 -12
  269. package/.claude/skills/quality-checks/templates/playwright-js/pageObjects/scannedPage.js +21 -0
  270. package/.claude/skills/quality-checks/templates/playwright-js/resources/desc/quality.desc.js +63 -0
  271. package/.claude/skills/quality-checks/templates/playwright-js/resources/testData/qualityData.js +32 -0
  272. package/.claude/skills/quality-checks/templates/playwright-js/src/checks/accessibility.js +50 -0
  273. package/.claude/skills/quality-checks/templates/playwright-js/src/checks/pageHealth.js +38 -0
  274. package/.claude/skills/quality-checks/templates/playwright-js/src/checks/performance.js +21 -0
  275. package/.claude/skills/quality-checks/templates/playwright-js/src/services/graphqlClient.js +28 -0
  276. package/.claude/skills/quality-checks/templates/playwright-js/tests/api/graphql.spec.js +23 -0
  277. package/.claude/skills/quality-checks/templates/playwright-js/tests/ui/quality.spec.js +50 -0
  278. package/.claude/skills/quality-checks/templates/playwright-ts/pageObjects/scannedPage.ts +20 -0
  279. package/.claude/skills/quality-checks/templates/playwright-ts/resources/desc/quality.desc.ts +59 -0
  280. package/.claude/skills/quality-checks/templates/playwright-ts/{src/data/quality.data.ts → resources/testData/qualityData.ts} +3 -2
  281. package/.claude/skills/quality-checks/templates/playwright-ts/tests/api/graphql.spec.ts +22 -0
  282. package/.claude/skills/quality-checks/templates/playwright-ts/tests/ui/quality.spec.ts +49 -0
  283. package/.claude/skills/requests/templates/README.md +6 -7
  284. package/.claude/skills/requests/templates/python-pytest/.env.example +4 -0
  285. package/.claude/skills/requests/templates/python-pytest/conftest.py +24 -9
  286. package/.claude/skills/requests/templates/python-pytest/pytest.ini +6 -3
  287. package/.claude/skills/requests/templates/python-pytest/requirements.txt +1 -0
  288. package/.claude/skills/requests/templates/python-pytest/resources/__init__.py +1 -0
  289. package/.claude/skills/requests/templates/python-pytest/resources/desc/__init__.py +1 -0
  290. package/.claude/skills/requests/templates/python-pytest/resources/desc/products_desc.py +27 -0
  291. package/.claude/skills/requests/templates/python-pytest/resources/test_data/__init__.py +1 -0
  292. package/.claude/skills/requests/templates/python-pytest/resources/test_data/test_data.py +27 -0
  293. package/.claude/skills/requests/templates/python-pytest/src/__init__.py +1 -0
  294. package/.claude/skills/requests/templates/python-pytest/src/config/__init__.py +1 -0
  295. package/.claude/skills/requests/templates/python-pytest/src/config/env.py +39 -0
  296. package/.claude/skills/requests/templates/python-pytest/src/config/flags.py +35 -0
  297. package/.claude/skills/requests/templates/python-pytest/src/config/load_env.py +16 -0
  298. package/.claude/skills/requests/templates/python-pytest/src/config/paths.py +16 -0
  299. package/.claude/skills/requests/templates/python-pytest/src/services/__init__.py +1 -0
  300. package/.claude/skills/requests/templates/python-pytest/{api/client.py → src/services/api_client.py} +19 -10
  301. package/.claude/skills/requests/templates/python-pytest/{api → src/services}/products_api.py +3 -9
  302. package/.claude/skills/requests/templates/python-pytest/tests/api/test_products.py +35 -0
  303. package/.claude/skills/requests/templates/python-pytest/tests/unit/test_utils.py +32 -0
  304. package/.claude/skills/requests/templates/python-pytest/utils/__init__.py +1 -0
  305. package/.claude/skills/requests/templates/python-pytest/utils/dates.py +23 -0
  306. package/.claude/skills/{selenium/templates/python-pytest/framework → requests/templates/python-pytest/utils}/errors.py +4 -3
  307. package/.claude/skills/requests/templates/python-pytest/utils/logger.py +40 -0
  308. package/.claude/skills/requests/templates/python-pytest/utils/random_data.py +35 -0
  309. package/.claude/skills/requests/templates/python-pytest/utils/redact.py +30 -0
  310. package/.claude/skills/requests/templates/python-pytest/utils/titles.py +53 -0
  311. package/.claude/skills/requirement-analysis/SKILL.md +1 -1
  312. package/.claude/skills/rest-assured/SKILL.md +1 -1
  313. package/.claude/skills/rest-assured/templates/README.md +6 -7
  314. package/.claude/skills/rest-assured/templates/ci/github-actions.yml +5 -2
  315. package/.claude/skills/rest-assured/templates/java-testng/.env.example +3 -0
  316. package/.claude/skills/rest-assured/templates/java-testng/pom.xml +7 -0
  317. package/.claude/skills/rest-assured/templates/java-testng/src/test/java/automation/{api/ApiConfig.java → config/Env.java} +35 -22
  318. package/.claude/skills/rest-assured/templates/java-testng/src/test/java/automation/config/Flags.java +17 -0
  319. package/.claude/skills/rest-assured/templates/java-testng/src/test/java/automation/config/Paths.java +14 -0
  320. package/.claude/skills/rest-assured/templates/java-testng/src/test/java/automation/desc/ProductsDesc.java +26 -0
  321. package/.claude/skills/rest-assured/templates/java-testng/src/test/java/automation/fixtures/BaseTest.java +29 -0
  322. package/.claude/skills/rest-assured/templates/java-testng/src/test/java/automation/services/ApiSpec.java +31 -0
  323. package/.claude/skills/rest-assured/templates/java-testng/src/test/java/automation/services/HealthApi.java +17 -0
  324. package/.claude/skills/rest-assured/templates/java-testng/src/test/java/automation/{api → services}/ProductsApi.java +19 -14
  325. package/.claude/skills/rest-assured/templates/java-testng/src/test/java/automation/{data → testData}/ProductBuilder.java +4 -8
  326. package/.claude/skills/rest-assured/templates/java-testng/src/test/java/automation/testData/TestData.java +64 -0
  327. package/.claude/skills/rest-assured/templates/java-testng/src/test/java/automation/tests/api/ProductsTest.java +49 -0
  328. package/.claude/skills/rest-assured/templates/java-testng/src/test/java/automation/tests/unit/UtilsTest.java +34 -0
  329. package/.claude/skills/{selenium/templates/java-testng/src/test/java/automation/framework → rest-assured/templates/java-testng/src/test/java/automation/utils}/AutomationError.java +4 -4
  330. package/.claude/skills/rest-assured/templates/java-testng/src/test/java/automation/utils/Case.java +20 -0
  331. package/.claude/skills/rest-assured/templates/java-testng/src/test/java/automation/utils/CaseTransformer.java +54 -0
  332. package/.claude/skills/rest-assured/templates/java-testng/src/test/java/automation/utils/Dates.java +42 -0
  333. package/.claude/skills/rest-assured/templates/java-testng/src/test/java/automation/utils/Log.java +45 -0
  334. package/.claude/skills/rest-assured/templates/java-testng/src/test/java/automation/utils/MissingSettingError.java +13 -0
  335. package/.claude/skills/rest-assured/templates/java-testng/src/test/java/automation/utils/RandomData.java +41 -0
  336. package/.claude/skills/rest-assured/templates/java-testng/src/test/java/automation/utils/Redact.java +33 -0
  337. package/.claude/skills/rest-assured/templates/java-testng/src/test/java/automation/utils/TestDescription.java +25 -0
  338. package/.claude/skills/rest-assured/templates/java-testng/src/test/resources/testData/testData.properties +14 -0
  339. package/.claude/skills/rest-assured/templates/java-testng/testng.xml +14 -0
  340. package/.claude/skills/selenium/SKILL.md +1 -1
  341. package/.claude/skills/selenium/templates/README.md +25 -13
  342. package/.claude/skills/selenium/templates/ci/github-actions-java.yml +5 -2
  343. package/.claude/skills/selenium/templates/csharp-nunit/.env.example +15 -0
  344. package/.claude/skills/selenium/templates/csharp-nunit/Automation.csproj +7 -0
  345. package/.claude/skills/selenium/templates/csharp-nunit/{Framework/Config.cs → Config/Env.cs} +33 -34
  346. package/.claude/skills/selenium/templates/csharp-nunit/Config/Flags.cs +39 -0
  347. package/.claude/skills/selenium/templates/csharp-nunit/Config/Paths.cs +31 -0
  348. package/.claude/skills/selenium/templates/csharp-nunit/{Framework → Driver}/DriverFactory.cs +16 -13
  349. package/.claude/skills/selenium/templates/csharp-nunit/Driver/DriverManager.cs +27 -0
  350. package/.claude/skills/selenium/templates/csharp-nunit/Fixtures/BaseTest.cs +56 -0
  351. package/.claude/skills/selenium/templates/csharp-nunit/{Pages → PageObjects}/BasePage.cs +40 -14
  352. package/.claude/skills/selenium/templates/csharp-nunit/PageObjects/HomePage.cs +21 -0
  353. package/.claude/skills/selenium/templates/csharp-nunit/PageObjects/LoginPage.cs +53 -0
  354. package/.claude/skills/selenium/templates/csharp-nunit/PageObjects/ShellPage.cs +22 -0
  355. package/.claude/skills/selenium/templates/csharp-nunit/Resources/Desc/SignInDesc.cs +23 -0
  356. package/.claude/skills/selenium/templates/csharp-nunit/Resources/TestData/TestData.cs +74 -0
  357. package/.claude/skills/selenium/templates/csharp-nunit/Resources/TestData/testData.json +14 -0
  358. package/.claude/skills/selenium/templates/csharp-nunit/Services/ApiClient.cs +71 -0
  359. package/.claude/skills/selenium/templates/csharp-nunit/Setup/AuthSetup.cs +104 -0
  360. package/.claude/skills/selenium/templates/csharp-nunit/Tests/Api/SessionTests.cs +23 -0
  361. package/.claude/skills/selenium/templates/csharp-nunit/Tests/Ui/SignInTests.cs +42 -0
  362. package/.claude/skills/selenium/templates/csharp-nunit/Tests/Unit/UtilsTests.cs +40 -0
  363. package/.claude/skills/selenium/templates/csharp-nunit/Utils/AutomationError.cs +15 -0
  364. package/.claude/skills/selenium/templates/csharp-nunit/Utils/Dates.cs +18 -0
  365. package/.claude/skills/selenium/templates/csharp-nunit/Utils/FormFill.cs +20 -0
  366. package/.claude/skills/selenium/templates/csharp-nunit/Utils/Log.cs +37 -0
  367. package/.claude/skills/selenium/templates/csharp-nunit/Utils/RandomData.cs +26 -0
  368. package/.claude/skills/selenium/templates/csharp-nunit/Utils/Redact.cs +22 -0
  369. package/.claude/skills/selenium/templates/csharp-nunit/Utils/TestDescription.cs +55 -0
  370. package/.claude/skills/selenium/templates/csharp-nunit/gitignore +6 -2
  371. package/.claude/skills/selenium/templates/java-testng/.env.example +12 -0
  372. package/.claude/skills/selenium/templates/java-testng/gitignore +5 -2
  373. package/.claude/skills/selenium/templates/java-testng/pom.xml +2 -0
  374. package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/{framework/Config.java → config/Env.java} +45 -55
  375. package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/config/Flags.java +50 -0
  376. package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/config/Paths.java +20 -0
  377. package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/desc/SignInDesc.java +30 -0
  378. package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/{framework → driver}/DriverFactory.java +15 -12
  379. package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/{framework → driver}/DriverManager.java +4 -7
  380. package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/fixtures/BaseTest.java +87 -0
  381. package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/{pages → pageObjects}/BasePage.java +38 -17
  382. package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/pageObjects/HomePage.java +32 -0
  383. package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/pageObjects/LoginPage.java +69 -0
  384. package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/pageObjects/ShellPage.java +34 -0
  385. package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/services/ApiClient.java +93 -0
  386. package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/setup/AuthSetup.java +125 -0
  387. package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/testData/TestData.java +88 -0
  388. package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/tests/api/SessionTest.java +23 -0
  389. package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/tests/ui/SignInTest.java +46 -0
  390. package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/tests/unit/UtilsTest.java +34 -0
  391. package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/utils/AutomationError.java +18 -0
  392. package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/utils/Case.java +20 -0
  393. package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/utils/CaseTransformer.java +54 -0
  394. package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/utils/Dates.java +42 -0
  395. package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/utils/FormFill.java +25 -0
  396. package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/utils/Log.java +45 -0
  397. package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/utils/MissingSettingError.java +13 -0
  398. package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/utils/RandomData.java +41 -0
  399. package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/utils/Redact.java +33 -0
  400. package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/utils/TestDescription.java +25 -0
  401. package/.claude/skills/selenium/templates/java-testng/src/test/resources/testData/testData.properties +11 -0
  402. package/.claude/skills/selenium/templates/java-testng/testng.xml +15 -5
  403. package/.claude/skills/selenium/templates/python-pytest/.env.example +12 -0
  404. package/.claude/skills/selenium/templates/python-pytest/conftest.py +63 -12
  405. package/.claude/skills/selenium/templates/python-pytest/gitignore +7 -2
  406. package/.claude/skills/selenium/templates/python-pytest/page_objects/__init__.py +1 -0
  407. package/.claude/skills/selenium/templates/python-pytest/{pages → page_objects}/base_page.py +17 -20
  408. package/.claude/skills/selenium/templates/python-pytest/page_objects/home_page.py +17 -0
  409. package/.claude/skills/selenium/templates/python-pytest/{pages → page_objects}/login_page.py +12 -14
  410. package/.claude/skills/selenium/templates/python-pytest/page_objects/shell_page.py +16 -0
  411. package/.claude/skills/selenium/templates/python-pytest/pytest.ini +6 -2
  412. package/.claude/skills/selenium/templates/python-pytest/requirements.txt +1 -0
  413. package/.claude/skills/selenium/templates/python-pytest/resources/__init__.py +1 -0
  414. package/.claude/skills/selenium/templates/python-pytest/resources/desc/__init__.py +1 -0
  415. package/.claude/skills/selenium/templates/python-pytest/resources/desc/sign_in_desc.py +27 -0
  416. package/.claude/skills/selenium/templates/python-pytest/resources/test_data/__init__.py +1 -0
  417. package/.claude/skills/selenium/templates/python-pytest/resources/test_data/test_data.py +25 -0
  418. package/.claude/skills/selenium/templates/python-pytest/setup/__init__.py +1 -0
  419. package/.claude/skills/selenium/templates/python-pytest/setup/auth.py +60 -0
  420. package/.claude/skills/selenium/templates/python-pytest/src/__init__.py +1 -0
  421. package/.claude/skills/selenium/templates/python-pytest/src/config/__init__.py +1 -0
  422. package/.claude/skills/selenium/templates/python-pytest/src/config/env.py +68 -0
  423. package/.claude/skills/selenium/templates/python-pytest/src/config/flags.py +40 -0
  424. package/.claude/skills/selenium/templates/python-pytest/src/config/load_env.py +16 -0
  425. package/.claude/skills/selenium/templates/python-pytest/src/config/paths.py +25 -0
  426. package/.claude/skills/selenium/templates/python-pytest/src/driver/__init__.py +1 -0
  427. package/.claude/skills/selenium/templates/python-pytest/{framework → src/driver}/driver_factory.py +11 -18
  428. package/.claude/skills/selenium/templates/python-pytest/{framework → src/driver}/driver_manager.py +3 -3
  429. package/.claude/skills/selenium/templates/python-pytest/src/services/__init__.py +1 -0
  430. package/.claude/skills/selenium/templates/python-pytest/src/services/api_client.py +89 -0
  431. package/.claude/skills/selenium/templates/python-pytest/tests/api/test_session.py +11 -0
  432. package/.claude/skills/selenium/templates/python-pytest/tests/ui/test_sign_in.py +34 -0
  433. package/.claude/skills/selenium/templates/python-pytest/tests/unit/test_utils.py +32 -0
  434. package/.claude/skills/selenium/templates/python-pytest/utils/__init__.py +1 -0
  435. package/.claude/skills/selenium/templates/python-pytest/utils/dates.py +23 -0
  436. package/.claude/skills/selenium/templates/python-pytest/utils/errors.py +28 -0
  437. package/.claude/skills/selenium/templates/python-pytest/utils/form_fill.py +29 -0
  438. package/.claude/skills/selenium/templates/python-pytest/utils/logger.py +40 -0
  439. package/.claude/skills/selenium/templates/python-pytest/utils/markers.py +6 -0
  440. package/.claude/skills/selenium/templates/python-pytest/utils/random_data.py +35 -0
  441. package/.claude/skills/selenium/templates/python-pytest/utils/redact.py +30 -0
  442. package/.claude/skills/selenium/templates/python-pytest/utils/titles.py +53 -0
  443. package/.claude/skills/self-healing/SKILL.md +1 -1
  444. package/.claude/skills/test-design/SKILL.md +1 -1
  445. package/.claude/skills/ui-observation/SKILL.md +7 -6
  446. package/.claude/skills/ui-observation/references/login-methods.md +1 -1
  447. package/.claude-plugin/plugin.json +1 -1
  448. package/.cursor/commands/orion.md +1 -1
  449. package/.gemini/commands/orion.toml +2 -2
  450. package/.github/prompts/orion.prompt.md +2 -2
  451. package/.windsurf/workflows/orion.md +2 -2
  452. package/AGENTS.md +1 -1
  453. package/README.md +23 -3
  454. package/assets/architecture.svg +104 -0
  455. package/hosts/gemini-extension/gemini-extension.json +1 -1
  456. package/package.json +2 -1
  457. package/.claude/skills/appium/templates/project-java/src/test/java/automation/data/Cases.java +0 -37
  458. package/.claude/skills/appium/templates/project-java/src/test/java/automation/data/SignInData.java +0 -25
  459. package/.claude/skills/appium/templates/project-java/src/test/java/automation/flows/SignInFlow.java +0 -34
  460. package/.claude/skills/appium/templates/project-java/src/test/java/automation/framework/Account.java +0 -19
  461. package/.claude/skills/appium/templates/project-java/src/test/java/automation/screens/HomeScreen.java +0 -36
  462. package/.claude/skills/appium/templates/project-java/src/test/java/automation/screens/LoginScreen.java +0 -57
  463. package/.claude/skills/appium/templates/project-java/src/test/java/automation/tests/BaseTest.java +0 -33
  464. package/.claude/skills/appium/templates/project-java/src/test/java/automation/tests/SmokeTest.java +0 -17
  465. package/.claude/skills/httpclient/templates/csharp-nunit/Api/ApiClient.cs +0 -61
  466. package/.claude/skills/httpclient/templates/csharp-nunit/Api/ApiConfig.cs +0 -61
  467. package/.claude/skills/httpclient/templates/csharp-nunit/Api/ApiError.cs +0 -17
  468. package/.claude/skills/httpclient/templates/csharp-nunit/Data/Cases.cs +0 -41
  469. package/.claude/skills/httpclient/templates/csharp-nunit/Data/HealthData.cs +0 -11
  470. package/.claude/skills/httpclient/templates/csharp-nunit/Data/ProductBuilder.cs +0 -16
  471. package/.claude/skills/httpclient/templates/csharp-nunit/Data/ProductsData.cs +0 -17
  472. package/.claude/skills/httpclient/templates/csharp-nunit/Tests/HealthTests.cs +0 -18
  473. package/.claude/skills/httpclient/templates/csharp-nunit/Tests/ProductsTests.cs +0 -48
  474. package/.claude/skills/k6/templates/project/data/builders.js +0 -8
  475. package/.claude/skills/karate/templates/java-junit5/src/test/java/api/products.feature +0 -33
  476. package/.claude/skills/pact/templates/project/test/contract/products.contract.test.js +0 -45
  477. package/.claude/skills/playwright/templates/dotnet/Components/AccountMenu.cs +0 -23
  478. package/.claude/skills/playwright/templates/dotnet/Data/Cases.cs +0 -43
  479. package/.claude/skills/playwright/templates/dotnet/Data/SignInData.cs +0 -24
  480. package/.claude/skills/playwright/templates/dotnet/Flows/SignInFlow.cs +0 -51
  481. package/.claude/skills/playwright/templates/dotnet/Framework/AutomationError.cs +0 -17
  482. package/.claude/skills/playwright/templates/dotnet/Framework/Config.cs +0 -91
  483. package/.claude/skills/playwright/templates/dotnet/Pages/BasePage.cs +0 -57
  484. package/.claude/skills/playwright/templates/dotnet/Pages/HomePage.cs +0 -26
  485. package/.claude/skills/playwright/templates/dotnet/Pages/LoginPage.cs +0 -45
  486. package/.claude/skills/playwright/templates/dotnet/Tests/SmokeTests.cs +0 -47
  487. package/.claude/skills/playwright/templates/javascript/src/components/account-menu.component.js +0 -30
  488. package/.claude/skills/playwright/templates/javascript/src/config.js +0 -53
  489. package/.claude/skills/playwright/templates/javascript/src/data/accounts.js +0 -23
  490. package/.claude/skills/playwright/templates/javascript/src/data/cases.js +0 -49
  491. package/.claude/skills/playwright/templates/javascript/src/data/sign-in.data.js +0 -12
  492. package/.claude/skills/playwright/templates/javascript/src/flows/sign-in.flow.js +0 -53
  493. package/.claude/skills/playwright/templates/javascript/src/pages/base.page.js +0 -59
  494. package/.claude/skills/playwright/templates/javascript/src/pages/home.page.js +0 -31
  495. package/.claude/skills/playwright/templates/javascript/src/pages/login.page.js +0 -56
  496. package/.claude/skills/playwright/templates/javascript/tests/fixtures.js +0 -20
  497. package/.claude/skills/playwright/templates/javascript/tests/smoke.spec.js +0 -22
  498. package/.claude/skills/playwright/templates/project/src/components/account-menu.component.ts +0 -27
  499. package/.claude/skills/playwright/templates/project/src/config.ts +0 -56
  500. package/.claude/skills/playwright/templates/project/src/data/accounts.ts +0 -21
  501. package/.claude/skills/playwright/templates/project/src/data/cases.ts +0 -55
  502. package/.claude/skills/playwright/templates/project/src/data/sign-in.data.ts +0 -10
  503. package/.claude/skills/playwright/templates/project/src/flows/sign-in.flow.ts +0 -51
  504. package/.claude/skills/playwright/templates/project/src/pages/base.page.ts +0 -52
  505. package/.claude/skills/playwright/templates/project/src/pages/home.page.ts +0 -30
  506. package/.claude/skills/playwright/templates/project/src/pages/login.page.ts +0 -53
  507. package/.claude/skills/playwright/templates/project/tests/fixtures.ts +0 -25
  508. package/.claude/skills/playwright/templates/project/tests/smoke.spec.ts +0 -22
  509. package/.claude/skills/playwright/templates/python/components/__init__.py +0 -1
  510. package/.claude/skills/playwright/templates/python/components/account_menu.py +0 -22
  511. package/.claude/skills/playwright/templates/python/data/accounts.py +0 -14
  512. package/.claude/skills/playwright/templates/python/data/cases.py +0 -33
  513. package/.claude/skills/playwright/templates/python/data/sign_in_data.py +0 -9
  514. package/.claude/skills/playwright/templates/python/flows/sign_in.py +0 -63
  515. package/.claude/skills/playwright/templates/python/pages/base_page.py +0 -51
  516. package/.claude/skills/playwright/templates/python/pages/home_page.py +0 -21
  517. package/.claude/skills/playwright/templates/python/pages/login_page.py +0 -40
  518. package/.claude/skills/playwright/templates/python/tests/test_smoke.py +0 -26
  519. package/.claude/skills/quality-checks/templates/playwright-ts/src/pages/scanned.page.ts +0 -16
  520. package/.claude/skills/quality-checks/templates/playwright-ts/tests/quality.spec.ts +0 -58
  521. package/.claude/skills/requests/templates/python-pytest/api/config.py +0 -43
  522. package/.claude/skills/requests/templates/python-pytest/api/errors.py +0 -15
  523. package/.claude/skills/requests/templates/python-pytest/data/builders.py +0 -16
  524. package/.claude/skills/requests/templates/python-pytest/data/cases.py +0 -30
  525. package/.claude/skills/requests/templates/python-pytest/data/health_data.py +0 -6
  526. package/.claude/skills/requests/templates/python-pytest/data/products_data.py +0 -10
  527. package/.claude/skills/requests/templates/python-pytest/tests/test_health.py +0 -12
  528. package/.claude/skills/requests/templates/python-pytest/tests/test_products.py +0 -25
  529. package/.claude/skills/rest-assured/templates/java-testng/src/test/java/automation/api/ApiError.java +0 -18
  530. package/.claude/skills/rest-assured/templates/java-testng/src/test/java/automation/api/ApiSpec.java +0 -29
  531. package/.claude/skills/rest-assured/templates/java-testng/src/test/java/automation/api/HealthApi.java +0 -21
  532. package/.claude/skills/rest-assured/templates/java-testng/src/test/java/automation/data/Cases.java +0 -45
  533. package/.claude/skills/rest-assured/templates/java-testng/src/test/java/automation/data/HealthData.java +0 -12
  534. package/.claude/skills/rest-assured/templates/java-testng/src/test/java/automation/data/ProductsData.java +0 -16
  535. package/.claude/skills/rest-assured/templates/java-testng/src/test/java/automation/tests/HealthTest.java +0 -15
  536. package/.claude/skills/rest-assured/templates/java-testng/src/test/java/automation/tests/ProductsTest.java +0 -37
  537. package/.claude/skills/selenium/templates/csharp-nunit/Components/AccountMenu.cs +0 -26
  538. package/.claude/skills/selenium/templates/csharp-nunit/Data/Cases.cs +0 -43
  539. package/.claude/skills/selenium/templates/csharp-nunit/Data/SignInData.cs +0 -24
  540. package/.claude/skills/selenium/templates/csharp-nunit/Flows/SignInFlow.cs +0 -51
  541. package/.claude/skills/selenium/templates/csharp-nunit/Framework/AutomationError.cs +0 -17
  542. package/.claude/skills/selenium/templates/csharp-nunit/Framework/DriverManager.cs +0 -26
  543. package/.claude/skills/selenium/templates/csharp-nunit/Pages/HomePage.cs +0 -28
  544. package/.claude/skills/selenium/templates/csharp-nunit/Pages/LoginPage.cs +0 -58
  545. package/.claude/skills/selenium/templates/csharp-nunit/Tests/BaseTest.cs +0 -22
  546. package/.claude/skills/selenium/templates/csharp-nunit/Tests/SmokeTests.cs +0 -37
  547. package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/components/AccountMenu.java +0 -37
  548. package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/data/Cases.java +0 -48
  549. package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/data/SignInData.java +0 -36
  550. package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/flows/SignInFlow.java +0 -60
  551. package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/framework/Account.java +0 -19
  552. package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/pages/HomePage.java +0 -45
  553. package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/pages/LoginPage.java +0 -78
  554. package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/tests/BaseTest.java +0 -33
  555. package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/tests/SmokeTest.java +0 -33
  556. package/.claude/skills/selenium/templates/python-pytest/components/__init__.py +0 -1
  557. package/.claude/skills/selenium/templates/python-pytest/components/account_menu.py +0 -19
  558. package/.claude/skills/selenium/templates/python-pytest/data/accounts.py +0 -14
  559. package/.claude/skills/selenium/templates/python-pytest/data/cases.py +0 -33
  560. package/.claude/skills/selenium/templates/python-pytest/data/sign_in_data.py +0 -9
  561. package/.claude/skills/selenium/templates/python-pytest/flows/__init__.py +0 -0
  562. package/.claude/skills/selenium/templates/python-pytest/flows/sign_in.py +0 -61
  563. package/.claude/skills/selenium/templates/python-pytest/framework/__init__.py +0 -0
  564. package/.claude/skills/selenium/templates/python-pytest/framework/config.py +0 -90
  565. package/.claude/skills/selenium/templates/python-pytest/pages/__init__.py +0 -0
  566. package/.claude/skills/selenium/templates/python-pytest/pages/home_page.py +0 -23
  567. package/.claude/skills/selenium/templates/python-pytest/tests/test_smoke.py +0 -25
  568. /package/.claude/skills/karate/templates/java-junit5/src/test/java/{api → tests/api}/delete-product.feature +0 -0
  569. /package/.claude/skills/playwright/templates/{python/data/__init__.py → dotnet/auth/.gitkeep} +0 -0
  570. /package/.claude/skills/playwright/templates/{python/flows/__init__.py → javascript/auth/.gitkeep} +0 -0
  571. /package/.claude/skills/playwright/templates/{python/framework/__init__.py → project/auth/.gitkeep} +0 -0
  572. /package/.claude/skills/playwright/templates/project/{src → utils}/errors.ts +0 -0
  573. /package/.claude/skills/playwright/templates/python/{pages/__init__.py → auth/.gitkeep} +0 -0
  574. /package/.claude/skills/quality-checks/templates/playwright-ts/src/checks/{page-health.ts → pageHealth.ts} +0 -0
  575. /package/.claude/skills/quality-checks/templates/playwright-ts/src/{api/graphql.ts → services/graphqlClient.ts} +0 -0
  576. /package/.claude/skills/{requests/templates/python-pytest/api/__init__.py → selenium/templates/csharp-nunit/auth/.gitkeep} +0 -0
  577. /package/.claude/skills/{requests/templates/python-pytest/data/__init__.py → selenium/templates/java-testng/auth/.gitkeep} +0 -0
  578. /package/.claude/skills/selenium/templates/python-pytest/{data/__init__.py → auth/.gitkeep} +0 -0
@@ -0,0 +1,203 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Per-test results of a run, in one shape, from the report files the runner wrote. Run by the executor after every
4
+ * counted run (execution skill); the Orion graph and the failure analyst read its output.
5
+ *
6
+ * Usage (from the workspace root):
7
+ * node .claude/skills/orion/scripts/results_parse.mjs <report file or folder> [...] --run <run id> [--attempt-run <n>]
8
+ * [--out project-context/results/<run id>.json]
9
+ *
10
+ * Reads: JUnit XML (Playwright `junit`, Maven Surefire/Failsafe, Gradle, pytest `--junitxml`, Cypress and WebdriverIO
11
+ * junit reporters, Karate), .NET TRX (`dotnet test --logger trx`) and the Playwright JSON reporter. A folder is searched
12
+ * for `*.xml`, `*.trx` and `*.json` files that are reports; other files are skipped and named.
13
+ * Writes, per test: test_id (TS-n or <story>:TS-n from the title or method name, else null), story (an issue key in the
14
+ * title, else null), file, title, status (passed | failed | skipped | flaky), duration_ms, attempts, failure_sig (the
15
+ * first line of the failure, colour codes removed, numbers as #, at most 160 characters; for a skipped test the reason
16
+ * goes in skip_reason). Totals per status.
17
+ * Secrets: the values of environment variables whose names look secret (PASSWORD, TOKEN, SECRET, KEY, AUTH, COOKIE)
18
+ * are masked as *** wherever they appear, and so are `Bearer …`, `password=…` and JWT-shaped strings. No .env file is
19
+ * read. Exit code: 0 written · 1 no test results found · 2 wrong arguments or a file that can't be read.
20
+ */
21
+ import fs from 'node:fs';
22
+ import path from 'node:path';
23
+ import { insideWorkspace } from './lib/inside.mjs';
24
+
25
+ const FORMAT = 'orion-results/1';
26
+
27
+ function usage(msg) {
28
+ if (msg) console.log(msg);
29
+ console.log('usage: node .claude/skills/orion/scripts/results_parse.mjs <report file or folder> [...] --run <run id> [--out file]');
30
+ process.exit(2);
31
+ }
32
+
33
+ const SECRET_VALUES = Object.entries(process.env)
34
+ .filter(([k, v]) => /PASS|TOKEN|SECRET|KEY|AUTH|COOKIE|CREDENTIAL/i.test(k) && typeof v === 'string' && v.length >= 4)
35
+ .map(([, v]) => v).sort((a, b) => b.length - a.length);
36
+
37
+ /** Text with secret values and secret-shaped strings replaced by ***. */
38
+ function mask(text) {
39
+ if (!text) return text;
40
+ let t = text;
41
+ for (const v of SECRET_VALUES) t = t.split(v).join('***');
42
+ return t.replace(/\b(Bearer|Basic)\s+[A-Za-z0-9._~+/=-]{8,}/g, '$1 ***')
43
+ .replace(/((?:password|passwd|pwd|token|secret|api[_-]?key)["']?\s*[:=]\s*["']?)[^\s"'&,;]{3,}/gi, '$1***')
44
+ .replace(/\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{4,}/g, '***');
45
+ }
46
+
47
+ const ANSI = /\u001b\[[0-9;]*m/g;
48
+ const ENTITIES = { amp: '&', lt: '<', gt: '>', quot: '"', apos: "'" };
49
+ const decode = (s) => (s || '').replace(/&(#x[0-9a-f]+|#\d+|\w+);/gi, (m, e) => (e[0] === '#'
50
+ ? String.fromCodePoint(e[1].toLowerCase() === 'x' ? parseInt(e.slice(2), 16) : parseInt(e.slice(1), 10)) : ENTITIES[e] ?? m))
51
+ .replace(/<!\[CDATA\[([\s\S]*?)\]\]>/g, '$1');
52
+ const attrs = (tag) => Object.fromEntries([...tag.matchAll(/([\w:.-]+)\s*=\s*"([^"]*)"/g)].map((m) => [m[1], decode(m[2])]));
53
+
54
+ /** First meaningful line of a failure, normalised so the same cause gives the same signature. */
55
+ function signature(text) {
56
+ if (!text) return null;
57
+ const line = mask(decode(text)).replace(ANSI, '').split('\n').map((l) => l.trim()).find((l) => l && !/^at\s|^\s*$/.test(l));
58
+ if (!line) return null;
59
+ const s = line.replace(/\d+(\.\d+)?/g, '#').replace(/\s+/g, ' ');
60
+ return s.length > 160 ? `${s.slice(0, 157)}...` : s;
61
+ }
62
+
63
+ /** A skip reason as written (secrets masked, colour codes removed), first line, at most 160 characters. */
64
+ function reason(text) {
65
+ const line = mask(decode(text || '')).replace(ANSI, '').split('\n').map((l) => l.trim()).find(Boolean);
66
+ if (!line) return null;
67
+ return line.length > 160 ? `${line.slice(0, 157)}...` : line;
68
+ }
69
+
70
+ /** TS-n (or <story>:TS-n) and an issue key from a title or method name. */
71
+ function ids(title) {
72
+ const t = title || '';
73
+ const global = t.match(/\b([A-Z][A-Z0-9]+-\d+):(TS-\d+)\b/);
74
+ const ts = t.match(/\b(TS|TC)-?(\d+)\b/i) || t.match(/(?:^|_)ts(\d+)(?:_|$)/i);
75
+ const story = t.match(/\b(?!TS-|TC-)([A-Z][A-Z0-9]+-\d+)\b/);
76
+ const testId = global ? `${global[1]}:${global[2]}` : ts ? `TS-${ts[2] ?? ts[1]}` : null;
77
+ return { test_id: testId, story: global ? global[1] : story ? story[1] : null };
78
+ }
79
+
80
+ /** JUnit XML: one row per <testcase>; a <failure>/<error> is failed, <skipped> skipped, Surefire's flakyFailure flaky. */
81
+ function parseJUnit(xml, source) {
82
+ const out = [];
83
+ for (const m of xml.matchAll(/<testcase\b([^>]*?)(\/>|>([\s\S]*?)<\/testcase>)/g)) {
84
+ const a = attrs(m[1]);
85
+ const body = m[3] || '';
86
+ const fail = body.match(/<(failure|error)\b([^>]*?)(\/>|>([\s\S]*?)<\/\1>)/);
87
+ const flaky = /<flakyFailure\b|<flakyError\b/.test(body);
88
+ const reruns = (body.match(/<rerun(Failure|Error)\b/g) || []).length;
89
+ const status = fail ? 'failed' : /<skipped\b/.test(body) ? 'skipped' : flaky ? 'flaky' : 'passed';
90
+ const skip = body.match(/<skipped\b([^>]*?)(?:\/>|>([\s\S]*?)<\/skipped>)/);
91
+ const failText = fail ? (attrs(fail[2]).message || fail[4] || '')
92
+ : flaky ? (body.match(/<flakyFailure\b[^>]*message="([^"]*)"/) || [])[1] : '';
93
+ const skipText = !fail && skip ? reason(attrs(skip[1]).message || skip[2] || '') : null;
94
+ const file = a.file || a.classname || '';
95
+ out.push({ title: a.name || '', file, status, duration_ms: a.time ? Math.round(parseFloat(a.time) * 1000) : null,
96
+ attempts: 1 + reruns + (flaky ? (body.match(/<flaky(Failure|Error)\b/g) || []).length : 0), failure_sig: signature(failText),
97
+ ...(skipText ? { skip_text: skipText } : {}), source });
98
+ }
99
+ return out;
100
+ }
101
+
102
+ /** .NET TRX: UnitTestResult rows, class names from TestDefinitions. */
103
+ function parseTrx(xml, source) {
104
+ const cls = {};
105
+ for (const m of xml.matchAll(/<UnitTest\b[^>]*\bid="([^"]+)"[^>]*>[\s\S]*?<TestMethod\b([^>]*)\/?>/g)) cls[m[1]] = attrs(m[2]).className || '';
106
+ const out = [];
107
+ for (const m of xml.matchAll(/<UnitTestResult\b([^>]*?)(\/>|>([\s\S]*?)<\/UnitTestResult>)/g)) {
108
+ const a = attrs(m[1]);
109
+ const msg = ((m[3] || '').match(/<Message>([\s\S]*?)<\/Message>/) || [])[1];
110
+ const d = (a.duration || '').match(/(\d+):(\d+):(\d+(?:\.\d+)?)/);
111
+ const status = { Passed: 'passed', Failed: 'failed', NotExecuted: 'skipped', Inconclusive: 'skipped', Error: 'failed', Timeout: 'failed' }[a.outcome] || 'failed';
112
+ out.push({ title: a.testName || '', file: cls[a.testId] || '', status,
113
+ duration_ms: d ? Math.round(((+d[1]) * 3600 + (+d[2]) * 60 + parseFloat(d[3])) * 1000) : null, attempts: 1,
114
+ failure_sig: signature(msg), source });
115
+ }
116
+ return out;
117
+ }
118
+
119
+ /** Playwright JSON reporter: specs → tests → results (one per attempt); outcome expected/unexpected/flaky/skipped. */
120
+ function parsePlaywrightJson(data, source) {
121
+ const out = [];
122
+ const walk = (suite, trail) => {
123
+ const names = suite.title && !/\.(spec|test)\.\w+$/.test(suite.title) ? [...trail, suite.title] : trail;
124
+ for (const spec of suite.specs || []) {
125
+ for (const t of spec.tests || []) {
126
+ const results = t.results || [];
127
+ const last = results[results.length - 1] || {};
128
+ const status = t.status === 'expected' ? 'passed' : t.status === 'flaky' ? 'flaky' : t.status === 'skipped' ? 'skipped' : 'failed';
129
+ const err = results.map((r) => (r.error && r.error.message) || (r.errors && r.errors[0] && r.errors[0].message)).find(Boolean);
130
+ out.push({ title: [...names, spec.title].join(' › '), file: spec.file || suite.file || '', project: t.projectName || null,
131
+ status, duration_ms: results.reduce((n, r) => n + (r.duration || 0), 0) || (last.duration ?? null), attempts: Math.max(1, results.length),
132
+ failure_sig: status === 'passed' ? null : signature(err), source });
133
+ }
134
+ }
135
+ for (const s of suite.suites || []) walk(s, names);
136
+ };
137
+ for (const s of data.suites || []) walk(s, []);
138
+ return out;
139
+ }
140
+
141
+ /** Report files named on the command line (folders searched one level per call, recursively). */
142
+ function reportFiles(inputs) {
143
+ const files = [];
144
+ const visit = (p) => {
145
+ const st = fs.statSync(p);
146
+ if (st.isDirectory()) { for (const e of fs.readdirSync(p).sort()) if (!['node_modules', '.git', 'attachments', 'data', 'trace'].includes(e)) visit(path.join(p, e)); }
147
+ else if (/\.(xml|trx|json)$/i.test(p)) files.push(p);
148
+ };
149
+ for (const i of inputs) { if (!fs.existsSync(i)) usage(`not found: ${i}`); visit(i); }
150
+ return files;
151
+ }
152
+
153
+ function main() {
154
+ const argv = process.argv.slice(2);
155
+ const opt = {}; const inputs = [];
156
+ for (let i = 0; i < argv.length; i++) {
157
+ if (argv[i].startsWith('--')) { opt[argv[i].slice(2)] = argv[i + 1]; i++; } else inputs.push(argv[i]);
158
+ }
159
+ if (!inputs.length || !opt.run) usage();
160
+ if (!/^[\w.-]+$/.test(opt.run)) usage('--run takes a run id such as 20261112-1430');
161
+
162
+ const rows = []; const sources = []; const skipped = [];
163
+ for (const f of reportFiles(inputs)) {
164
+ let text;
165
+ try { text = fs.readFileSync(f, 'utf8').replace(/^/, ''); } catch { usage(`can't read ${f}`); }
166
+ const rel = path.relative(process.cwd(), f).split(path.sep).join('/');
167
+ let found = [];
168
+ let format = null;
169
+ if (/^\s*\{/.test(text)) {
170
+ try { const j = JSON.parse(text); if (Array.isArray(j.suites) && j.stats) { format = 'playwright-json'; found = parsePlaywrightJson(j, rel); } } catch { /* not JSON */ }
171
+ } else if (/<TestRun\b/.test(text)) { format = 'trx'; found = parseTrx(text, rel); }
172
+ else if (/<testsuites?\b/.test(text)) { format = 'junit'; found = parseJUnit(text, rel); }
173
+ if (!format) { skipped.push(rel); continue; }
174
+ sources.push({ file: rel, format, tests: found.length });
175
+ rows.push(...found);
176
+ }
177
+ // Surefire with TestNG writes the same cases into TEST-TestSuite.xml and one file per class: keep one of each.
178
+ const seen = new Map();
179
+ for (const r of rows) {
180
+ const k = `${r.file}\0${r.title}\0${r.project || ''}`;
181
+ if (!seen.has(k)) seen.set(k, r);
182
+ }
183
+ const tests = [...seen.values()].map((r) => {
184
+ const { source, skip_text: skipText, ...rest } = r;
185
+ const skippedWhy = rest.status === 'skipped' ? (skipText || rest.failure_sig) : undefined;
186
+ if (rest.status === 'skipped' || rest.status === 'passed') rest.failure_sig = null;
187
+ return { ...ids(r.title), ...rest, ...(skippedWhy ? { skip_reason: skippedWhy } : {}), title: mask(r.title), source };
188
+ }).sort((a, b) => a.file.localeCompare(b.file) || a.title.localeCompare(b.title) || String(a.project).localeCompare(String(b.project)));
189
+ for (const t of tests) if (t.project === null || t.project === undefined) delete t.project;
190
+ const totals = { tests: tests.length, passed: 0, failed: 0, skipped: 0, flaky: 0 };
191
+ for (const t of tests) totals[t.status]++;
192
+ const report = { format: FORMAT, run_id: opt.run, sources, skipped_files: skipped, totals, tests };
193
+ const text = `${JSON.stringify(report, null, 2)}\n`;
194
+ if (!tests.length) { console.log(`results: no test results in ${inputs.join(', ')}${skipped.length ? ` (not reports: ${skipped.join(', ')})` : ''}`); process.exit(1); }
195
+ if (opt.out) {
196
+ insideWorkspace(opt.out, '--out');
197
+ fs.mkdirSync(path.dirname(opt.out), { recursive: true });
198
+ fs.writeFileSync(opt.out, text);
199
+ console.log(`results: ${totals.tests} tests · passed ${totals.passed} · failed ${totals.failed} · flaky ${totals.flaky} · skipped ${totals.skipped} → ${opt.out}`);
200
+ } else process.stdout.write(text);
201
+ }
202
+
203
+ main();
@@ -0,0 +1,251 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Less code, more reuse: finds code in a suite that repeats or isn't needed (pattern rules U9, M1, M4, P17).
4
+ * Run by the implementer before it returns and by the reviewer on the diff; in assess mode on the whole suite.
5
+ * Release 1 is report-only: findings are listed in the RESULT and the run record, never a blocking review finding.
6
+ *
7
+ * Usage (from the workspace root):
8
+ * node .claude/skills/orion/scripts/reuse_check.mjs <suite folder> [--changed <git base>] [--json]
9
+ * --changed limits the report to findings that touch files changed since <git base> (plus untracked files).
10
+ *
11
+ * Reports, each with file:line:
12
+ * duplicate the same function body (3+ statements, whitespace, comments and literal values ignored) in two places
13
+ * locator the same locator in two page objects → one place (a shared screen part or ShellPage)
14
+ * sequence the same 3+ statements in a row in two tests or fixtures → one page method or fixture
15
+ * pass-through a method that only calls another method with the same arguments (M1)
16
+ * unused a page, helper or service method no other file or line refers to
17
+ * same-name two non-test functions with the same name in different files (inferred: may do the same job)
18
+ * Limits (said in the output): regular expressions, not a parser; renamed variables hide a duplicate; a method used
19
+ * only through reflection or a framework hook may show as unused (annotated and override methods are skipped).
20
+ * Exit code: 0 nothing found · 1 findings · 2 wrong arguments.
21
+ */
22
+ import fs from 'node:fs';
23
+ import path from 'node:path';
24
+ import { execFileSync } from 'node:child_process';
25
+ import { scan } from './lib/scan.mjs';
26
+
27
+ const LANG = (f) => (/\.m?[jt]sx?$/.test(f) ? 'js' : /\.py$/.test(f) ? 'py' : /\.(java|kt)$/.test(f) ? 'java' : /\.cs$/.test(f) ? 'cs' : null);
28
+ const KEYWORDS = new Set(['if', 'for', 'while', 'switch', 'catch', 'return', 'function', 'new', 'else', 'using', 'lock', 'foreach',
29
+ 'await', 'throw', 'typeof', 'super', 'this', 'synchronized', 'try', 'do', 'base', 'constructor', 'get', 'set', 'static', 'async']);
30
+ const HOOK_NAMES = new Set(['main', 'toString', 'equals', 'hashCode', 'run', 'setup', 'teardown', 'setUp', 'tearDown', 'dispose',
31
+ 'Dispose', 'DisposeAsync', 'onStart', 'onFinish', 'beforeAll', 'afterAll', 'beforeEach', 'afterEach', '__init__', '__repr__',
32
+ '__str__', '__enter__', '__exit__', 'transform', 'ApplyToTest', 'ApplyToContext', 'globalSetup', 'globalTeardown', 'redirect_request', 'http_error_default']);
33
+
34
+ /** Lines without comments; string literals become "S" and numbers N (so values don't hide a duplicate). */
35
+ function normalise(line) {
36
+ return line.replace(/\/\/.*$|#(?![\w{]).*$/, '').replace(/(['"`])(?:\\.|(?!\1).)*\1/g, '"S"').replace(/\b\d+(\.\d+)?\b/g, 'N')
37
+ .replace(/\s+/g, ' ').trim();
38
+ }
39
+
40
+ /** Functions in one file: name, start line, statement lines (normalised), raw body, annotated/override flag, params. */
41
+ export function functionsOf(text, lang) {
42
+ const lines = text.split('\n');
43
+ const out = [];
44
+ if (lang === 'py') {
45
+ lines.forEach((line, i) => {
46
+ const m = line.match(/^(\s*)(?:async\s+)?def\s+(\w+)\s*\(([^)]*)\)/);
47
+ if (!m) return;
48
+ const indent = m[1].length;
49
+ const body = [];
50
+ let j = i + 1;
51
+ for (; j < lines.length; j++) {
52
+ const l = lines[j];
53
+ if (l.trim() && (l.length - l.trimStart().length) <= indent) break;
54
+ body.push(l);
55
+ }
56
+ const decorated = i > 0 && /^\s*@/.test(lines[i - 1]);
57
+ const stmts = body.map(normalise).filter((s) => s && !/^("S"|''')$/.test(s) && !/^"""/.test(s));
58
+ out.push({ name: m[2], line: i + 1, params: m[3], stmts, decorated, toolkit: /@toolkit/.test(body.slice(0, 4).join(' ')), body: body.join('\n') });
59
+ });
60
+ return out;
61
+ }
62
+ const head = lang === 'js'
63
+ ? /^\s*(?:export\s+)?(?:async\s+)?(?:function\s+(\w+)\s*\(([^)]*)\)|(?:static\s+)?(?:async\s+)?(?!if\b|for\b|while\b|switch\b|catch\b|return\b)(\w+)\s*\(([^)]*)\)\s*\{|(?:export\s+)?const\s+(\w+)\s*=\s*(?:async\s*)?\(([^)]*)\)\s*=>\s*\{)/
64
+ : /^\s*(?:(?:public|protected|private|internal|static|final|async|override|virtual|abstract|synchronized|sealed|partial)\s+)*(?:[\w<>[\],.?]+\s+)+(\w+)\s*\(([^)]*)\)\s*(?:throws\s+[\w.,\s]+)?(?:\{|=>.*)?\s*$/;
65
+ const testHead = /^\s*(?:test|it)(?:\.(?!describe\b)\w+)?\(\s*(?:(['"`])(.+?)\1|(titleOf\(\w+\)|[\w.[\]'"]+))[^\n]*=>\s*\{\s*$/;
66
+ for (let i = 0; i < lines.length; i++) {
67
+ const t = lang === 'js' && lines[i].match(testHead);
68
+ const m = t ? [null, `test: ${t[2] || t[3]}`, ''] : lines[i].match(head);
69
+ if (!m) continue;
70
+ const name = m[1] || m[3] || m[5];
71
+ if (!name || KEYWORDS.has(name)) continue;
72
+ let doc = ''; for (let d = i - 1; d >= 0 && d >= i - 12; d--) { if (/^\s*(\/\*\*|\*|\/\/\/|\/\/|@|\[)/.test(lines[d])) doc = lines[d] + doc; else break; }
73
+ const params = m[2] ?? m[4] ?? m[6] ?? '';
74
+ let depth = 0; let started = false; const body = []; let j = i;
75
+ const arrow = lang !== 'js' && /\)\s*=>/.test(lines[i]);
76
+ if (arrow) { // C#/Java expression-bodied member: the body runs to the first line ending in ';'
77
+ const first = lines[i].split('=>').slice(1).join('=>');
78
+ if (first.trim()) body.push(first);
79
+ for (j = first.trim().endsWith(';') ? i : i + 1; j < lines.length && j !== i; j++) { body.push(lines[j]); if (/;\s*$/.test(lines[j])) break; }
80
+ body.push('}');
81
+ started = true;
82
+ }
83
+ for (; !arrow && j < lines.length; j++) {
84
+ for (const ch of lines[j].replace(/(['"`])(?:\\.|(?!\1).)*\1/g, '""')) {
85
+ if (ch === '{') { depth++; started = true; } else if (ch === '}') depth--;
86
+ }
87
+ if (j > i) body.push(lines[j]);
88
+ if (started && depth <= 0) break;
89
+ if (!started && j > i + 1) break;
90
+ }
91
+ if (!started) continue;
92
+ let k = i - 1; let decorated = false;
93
+ while (k >= 0 && /^\s*(@\w|\[\w|\/\/|\*|\/\*\*)/.test(lines[k])) { if (/^\s*(@\w|\[\w)/.test(lines[k])) decorated = true; k--; }
94
+ if (/\boverride\b/.test(lines[i])) decorated = true;
95
+ const stmts = body.slice(0, -1).map(normalise).filter((s) => s && s !== '{' && s !== '}');
96
+ out.push({ name, line: i + 1, params, stmts, decorated, toolkit: /@toolkit/.test(doc), body: body.join('\n') });
97
+ }
98
+ return out;
99
+ }
100
+
101
+ /** Locator expressions in a page object: the call and its first string argument. */
102
+ function locatorsOf(text) {
103
+ const out = [];
104
+ text.split('\n').forEach((line, i) => {
105
+ for (const m of line.matchAll(/\b(locator|getBy\w+|get_by_\w+|By\.\w+|FindElement|find_element|cy\.get|\$)\(([^()]*(?:\([^()]*\)[^()]*)*)\)/g)) {
106
+ if (!/['"`]/.test(m[2])) continue;
107
+ out.push({ key: `${m[1].replace(/^get_by_/, 'getBy_')}(${m[2].replace(/\s+/g, '')})`, line: i + 1 });
108
+ }
109
+ });
110
+ return out;
111
+ }
112
+
113
+ function changedFiles(root, base) {
114
+ // A value starting with '-' would reach git as an option (e.g. `--output=<file>` writes anywhere): refs only.
115
+ if (!/^[\w][\w./~^@{}-]*$/.test(base)) { console.log(`--changed takes a commit or ref, got ${JSON.stringify(base)}`); process.exit(2); }
116
+ const run = (args) => execFileSync('git', ['-C', root, ...args], { encoding: 'utf8' }).split('\n').filter(Boolean);
117
+ const top = execFileSync('git', ['-C', root, 'rev-parse', '--show-toplevel'], { encoding: 'utf8' }).trim();
118
+ const rel = (f) => path.relative(path.resolve(root), path.join(top, f)).split(path.sep).join('/');
119
+ return new Set([...run(['diff', '--name-only', base, '--']).map(rel), ...run(['ls-files', '--others', '--exclude-standard']).map((f) => f)]);
120
+ }
121
+
122
+ /** All findings for a suite folder. */
123
+ export function reuseCheck(root) {
124
+ const s = scan(root);
125
+ const roleOf = new Map();
126
+ for (const [role, list] of Object.entries(s.files)) for (const f of list) roleOf.set(f, role);
127
+ for (const t of s.tests) roleOf.set(t.file, 'tests');
128
+ const sources = [...roleOf.keys()].filter((f) => LANG(f) && !/(^|\/)tests?\/unit\/|Tests\/Unit\//.test(f));
129
+ const text = new Map(sources.map((f) => [f, fs.readFileSync(path.join(root, f), 'utf8')]));
130
+ // Usage is counted over every source file in the suite (setup, config, unit tests too), not only the ones with a role.
131
+ const every = [];
132
+ const walk = (dir) => {
133
+ for (const e of fs.readdirSync(dir, { withFileTypes: true })) {
134
+ if (e.isDirectory()) { if (!/^(node_modules|\.git|target|bin|obj|\.venv|venv|__pycache__|test-results|playwright-report|reports|TestResults)$/.test(e.name)) walk(path.join(dir, e.name)); }
135
+ else if (LANG(e.name) || /\.(feature|json)$/.test(e.name)) every.push(path.join(dir, e.name));
136
+ }
137
+ };
138
+ walk(root);
139
+ const allText = every.map((f) => { try { return fs.readFileSync(f, 'utf8'); } catch { return ''; } }).join('\n');
140
+ const toolkitFile = new Set(sources.filter((f) => /@toolkit/.test(text.get(f).split('\n').slice(0, 15).join('\n'))));
141
+ const findings = [];
142
+ const fns = [];
143
+ for (const f of sources) for (const fn of functionsOf(text.get(f), LANG(f))) fns.push({ ...fn, file: f, role: roleOf.get(f) });
144
+
145
+ // duplicate bodies
146
+ const byBody = new Map();
147
+ for (const fn of fns) {
148
+ if (fn.stmts.length < 3) continue;
149
+ // Parameter names don't make two bodies different: priceToCents(label) and toCents(text) are the same job.
150
+ const names = fn.params.split(',').map((p) => p.trim().replace(/[:=].*$/, '').replace(/^.*\s/, '').replace(/^[*{[(]+|[)}\]]+$/g, '')).filter((p) => /^\w+$/.test(p) && !['self', 'this'].includes(p));
151
+ const k = fn.stmts.map((st) => names.reduce((t, p, i) => t.replace(new RegExp(`\\b${p}\\b`, 'g'), `P${i}`), st)).join('\n');
152
+ if (!byBody.has(k)) byBody.set(k, []);
153
+ byBody.get(k).push(fn);
154
+ }
155
+ for (const list of byBody.values()) {
156
+ if (list.length < 2) continue;
157
+ const [first, ...rest] = list;
158
+ for (const fn of rest) findings.push({ kind: 'duplicate', rule: 'M4', file: fn.file, line: fn.line, what: `${fn.name}() has the same body as ${first.name}() at ${first.file}:${first.line}`, also: [`${first.file}:${first.line}`] });
159
+ }
160
+
161
+ // the same locator in two page objects
162
+ const byLoc = new Map();
163
+ for (const f of s.files.pages) for (const l of locatorsOf(text.get(f) || '')) {
164
+ if (!byLoc.has(l.key)) byLoc.set(l.key, []);
165
+ byLoc.get(l.key).push({ file: f, line: l.line });
166
+ }
167
+ for (const [key, list] of byLoc) {
168
+ const files = [...new Set(list.map((x) => x.file))];
169
+ if (files.length < 2) continue;
170
+ findings.push({ kind: 'locator', rule: 'P17', file: list[1].file, line: list[1].line, what: `${key} is also in ${list[0].file}:${list[0].line}: keep it in one page object or a shared screen part`, also: [`${list[0].file}:${list[0].line}`] });
171
+ }
172
+
173
+ // repeated 3+ statement sequences in tests and fixtures
174
+ const windows = new Map();
175
+ for (const fn of fns.filter((x) => x.role === 'tests' || x.role === 'fixtures')) {
176
+ const st = fn.stmts.filter((x) => !/^(expect|assert|Assert)\b/.test(x));
177
+ for (let i = 0; i + 3 <= st.length; i++) {
178
+ const k = st.slice(i, i + 3).join('\n');
179
+ if (!/\(/.test(k)) continue;
180
+ if (!windows.has(k)) windows.set(k, []);
181
+ windows.get(k).push(fn);
182
+ }
183
+ }
184
+ const seenSeq = new Set();
185
+ for (const list of windows.values()) {
186
+ const distinct = [...new Map(list.map((fn) => [`${fn.file}:${fn.line}`, fn])).values()];
187
+ if (distinct.length < 2) continue;
188
+ const at = distinct[1];
189
+ const k = `${at.file}:${at.line}`;
190
+ if (seenSeq.has(k)) continue;
191
+ seenSeq.add(k);
192
+ findings.push({ kind: 'sequence', rule: 'M4', file: at.file, line: at.line, what: `the same 3+ steps also run in ${distinct[0].file}:${distinct[0].line} (${distinct[0].name}): one page method or fixture`, also: [`${distinct[0].file}:${distinct[0].line}`] });
193
+ }
194
+
195
+ // pass-through methods
196
+ for (const fn of fns) {
197
+ if (fn.stmts.length !== 1 || fn.decorated || fn.name === path.basename(fn.file).replace(/\.\w+$/, '')) continue;
198
+ const args = fn.params.split(',').map((p) => p.trim().replace(/[:=].*$/, '').replace(/^.*\s/, '').replace(/^(self|this)$/, '')).filter(Boolean).join(',');
199
+ const m = fn.stmts[0].match(/^(?:return\s+)?(?:await\s+)?(?:this\.|self\.)?(\w+)\((.*)\);?$/);
200
+ if (m && !['super', 'base'].includes(m[1]) && m[1] !== fn.name && m[2].replace(/\s/g, '') === args && args) {
201
+ findings.push({ kind: 'pass-through', rule: 'M1', file: fn.file, line: fn.line, what: `${fn.name}() only calls ${m[1]}() with the same arguments: call ${m[1]}() directly or give it a user-level name` });
202
+ }
203
+ }
204
+
205
+ // unused page/helper/service methods
206
+ for (const fn of fns.filter((x) => ['pages', 'helpers', 'services'].includes(x.role))) {
207
+ if (fn.decorated || fn.toolkit || toolkitFile.has(fn.file) || HOOK_NAMES.has(fn.name) || /^test: /.test(fn.name) || /^_/.test(fn.name) || fn.name === path.basename(fn.file).replace(/\.\w+$/, '')) continue;
208
+ const uses = (allText.match(new RegExp(`\\b${fn.name}\\b`, 'g')) || []).length;
209
+ if (uses <= 1) findings.push({ kind: 'unused', rule: 'U9', file: fn.file, line: fn.line, what: `${fn.name}() is never called` });
210
+ }
211
+
212
+ // same name in two files (non-test)
213
+ const byName = new Map();
214
+ for (const fn of fns.filter((x) => ['pages', 'helpers', 'services', 'fixtures', 'data', 'config'].includes(x.role) && !x.decorated && !HOOK_NAMES.has(x.name))) {
215
+ if (!byName.has(fn.name)) byName.set(fn.name, []);
216
+ byName.get(fn.name).push(fn);
217
+ }
218
+ for (const [name, all] of byName) {
219
+ const list = all.filter((x) => x.stmts.length >= 3 && x.role === all[0].role);
220
+ const files = [...new Set(list.map((x) => x.file))];
221
+ if (files.length < 2 || list.every((x) => x.role === 'pages') && ['open', 'goto', 'isReady', 'waitUntilReady', 'is_ready', 'IsReady'].includes(name)) continue;
222
+ const dupBodies = new Set(list.map((x) => x.stmts.join('\n')));
223
+ if (dupBodies.size === 1 && list[0].stmts.length >= 3) continue; // already reported as duplicate
224
+ findings.push({ kind: 'same-name', rule: 'U9', file: list[1].file, line: list[1].line, what: `${name}() also exists in ${list[0].file}:${list[0].line}; check it isn't the same job (inferred)`, also: [`${list[0].file}:${list[0].line}`], tag: 'inferred' });
225
+ }
226
+ findings.sort((a, b) => a.file.localeCompare(b.file) || a.line - b.line);
227
+ return { root, findings, functions: fns.length, limits: [
228
+ 'regular expressions, not a parser: renamed variables hide a duplicate',
229
+ 'a method used only through reflection, a fixture name or a framework hook can show as unused (annotated and override methods are skipped)',
230
+ 'unit tests are left out; same-name findings are leads for the reviewer, not proof'] };
231
+ }
232
+
233
+ function main() {
234
+ const args = process.argv.slice(2);
235
+ const root = args.find((a) => !a.startsWith('--') && args[args.indexOf(a) - 1] !== '--changed');
236
+ if (!root || !fs.existsSync(root) || !fs.statSync(root).isDirectory()) {
237
+ console.log('usage: node .claude/skills/orion/scripts/reuse_check.mjs <suite folder> [--changed <git base>] [--json]');
238
+ process.exit(2);
239
+ }
240
+ const r = reuseCheck(root.replace(/[\\/]+$/, ''));
241
+ if (args.includes('--changed')) {
242
+ const changed = changedFiles(root, args[args.indexOf('--changed') + 1]);
243
+ r.findings = r.findings.filter((f) => changed.has(f.file) || (f.also || []).some((a) => changed.has(a.split(':')[0])));
244
+ }
245
+ if (args.includes('--json')) { process.stdout.write(`${JSON.stringify(r, null, 2)}\n`); process.exit(r.findings.length ? 1 : 0); }
246
+ for (const f of r.findings) console.log(`${r.root}/${f.file}:${f.line}: ${f.kind} (${f.rule}${f.tag ? `, ${f.tag}` : ''}): ${f.what}`);
247
+ console.log(`reuse check: ${r.findings.length} finding(s) in ${r.functions} functions (report-only)`);
248
+ process.exit(r.findings.length ? 1 : 0);
249
+ }
250
+
251
+ if (process.argv[1] && path.resolve(process.argv[1]) === path.resolve(new URL(import.meta.url).pathname)) main();
@@ -0,0 +1,171 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Keeps the run file (`project-context/runs/R-….md`) up to date in one call per event, so the orchestrator spends no
4
+ * turns of its own on bookkeeping: it makes this call in the same turn as its next action (a parallel tool call).
5
+ * Times come from the clock when the call runs, never typed by the model. Measured reason: in the 2026-11-12 baseline,
6
+ * 27 of the orchestrator's ~60 tool calls were run-file and decision-log writes, each re-reading its whole context.
7
+ *
8
+ * Usage (from the workspace root); several actions in one call are separated by a lone `+`:
9
+ * node .claude/skills/orion/scripts/run_state.mjs init <key> --requirement "<text>" --workflow <new|existing|design|…>
10
+ * → creates project-context/runs/R-<YYYYMMDD>-<HHMM>-<key>.md from the template, adds the execution-history
11
+ * line, prints the run file path
12
+ * node .claude/skills/orion/scripts/run_state.mjs <run file> <action> [+ <action> …]
13
+ * Actions:
14
+ * gate <1-8> start "<task>" state ▶, Start = now
15
+ * gate <1-8> end <✓|✗|⏸|⛔> "<status>" state and End = now; the board follows (gate 5 sets Implementation
16
+ * and Review)
17
+ * retry <1-8> +1 in the gate's Retries column
18
+ * log <task> <agent> <decision> <status> <failure_class> <accepted> ["<note>"]
19
+ * one log row at the current time
20
+ * state <stack|ui_map|design|build|run|heals|code> "<value>" replaces that Run state line (code: the header line)
21
+ * metric <name>=<value> [<name>=<value> …] sets fields of the Metrics line (`stopped` defaults to now when given
22
+ * as `stopped=now`); `+1` adds one to a number (e.g. delegations=+1)
23
+ * Output: one line per action. Exit code: 0 done · 1 the run file or a row wasn't found · 2 wrong arguments.
24
+ * Never writes secrets: refuses a value that looks like `password=…`, a bearer token or a JWT.
25
+ */
26
+ import fs from 'node:fs';
27
+ import path from 'node:path';
28
+ import { fileURLToPath } from 'node:url';
29
+ import { insideWorkspace } from './lib/inside.mjs';
30
+
31
+ const HERE = path.dirname(fileURLToPath(import.meta.url));
32
+ const TEMPLATE = path.join(HERE, '..', 'templates', 'project-context', 'run.md');
33
+ const BOARD = { 1: ['Requirement'], 2: ['Environment'], 3: ['Codebase'], 4: ['Strategy'], 5: ['Implementation', 'Review'],
34
+ 6: ['Execution'], 7: ['Evidence'], 8: ['Final'] };
35
+ const STATE_KEYS = ['stack', 'ui_map', 'design', 'build', 'run', 'heals'];
36
+
37
+ const pad = (n) => String(n).padStart(2, '0');
38
+ function now() {
39
+ const d = new Date();
40
+ return { hm: `${pad(d.getHours())}:${pad(d.getMinutes())}`, id: `${d.getFullYear()}${pad(d.getMonth() + 1)}${pad(d.getDate())}-${pad(d.getHours())}${pad(d.getMinutes())}`,
41
+ iso: `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}T${pad(d.getHours())}:${pad(d.getMinutes())}` };
42
+ }
43
+ function die(code, msg) { console.log(msg); process.exit(code); }
44
+ const cell = (s) => String(s).replace(/\|/g, '/').replace(/\n/g, ' ').trim();
45
+ function noSecret(s) {
46
+ if (/(password|passwd|token|secret|api[_-]?key)\s*[:=]\s*\S{3,}|\bBearer\s+[A-Za-z0-9._~+/=-]{8,}|\beyJ[A-Za-z0-9_-]{8,}\./i.test(s)) {
47
+ die(2, `refused: the value looks like it holds a secret (AGENTS.md rule 5): ${s.slice(0, 40)}…`);
48
+ }
49
+ return s;
50
+ }
51
+
52
+ function init(argv) {
53
+ const key = argv[0];
54
+ const opt = {};
55
+ for (let i = 1; i < argv.length; i += 2) opt[argv[i].replace(/^--/, '')] = argv[i + 1];
56
+ if (!key || !/^[\w.-]+$/.test(key) || !opt.requirement) die(2, 'usage: run_state.mjs init <key> --requirement "<text>" --workflow <workflow>');
57
+ const t = now();
58
+ const dir = path.join('project-context', 'runs');
59
+ fs.mkdirSync(dir, { recursive: true });
60
+ const file = path.join(dir, `R-${t.id}-${key}.md`);
61
+ if (fs.existsSync(file)) die(1, `exists: ${file}`);
62
+ let text = fs.readFileSync(TEMPLATE, 'utf8')
63
+ .replace('# Run R-<YYYYMMDD>-<HHMM>-<key>', `# Run R-${t.id}-${key}`)
64
+ .replace(/^requirement: .*$/m, `requirement: ${cell(noSecret(opt.requirement))} · started ${t.iso} · workflow: ${opt.workflow || 'new'}`)
65
+ .replace('started: <ISO>', `started: ${t.iso}`);
66
+ fs.writeFileSync(file, text);
67
+ const hist = path.join('project-context', 'execution-history.md');
68
+ if (fs.existsSync(hist)) fs.appendFileSync(hist, `- R-${t.id}-${key} · ${t.iso} · ${cell(opt.requirement)} · [run file](runs/R-${t.id}-${key}.md)\n`);
69
+ console.log(file);
70
+ }
71
+
72
+ /** Rewrite the board line(s) from the gate table's State column. */
73
+ function syncBoard(lines) {
74
+ const states = {};
75
+ for (const l of lines) { const m = l.match(/^\| ([1-8]) \| (\S+) \|/); if (m) states[m[1]] = m[2]; }
76
+ return lines.map((l) => (/^(Requirement|Review) /.test(l)
77
+ ? l.replace(/(Requirement|Environment|Codebase|Strategy|Implementation|Review|Execution|Evidence|Final) (\S+)/g, (all, label) => {
78
+ const gate = Object.keys(BOARD).find((g) => BOARD[g].includes(label));
79
+ return `${label} ${states[gate] || '○'}`;
80
+ }) : l));
81
+ }
82
+
83
+ function apply(lines, act, t) {
84
+ const [verb, ...a] = act;
85
+ const gateRow = (g) => lines.findIndex((l) => new RegExp(`^\\| ${g} \\|`).test(l));
86
+ if (verb === 'gate') {
87
+ const [g, what, ...rest] = a;
88
+ const i = gateRow(g);
89
+ if (i < 0 || !/^[1-8]$/.test(g)) die(1, `no gate row ${g}`);
90
+ const c = lines[i].split('|').map((x) => x.trim());
91
+ // c: ['', gate, state, agent, task, start, end, status, retries, '']
92
+ if (what === 'start') { c[2] = '▶'; c[4] = cell(noSecret(rest.join(' ') || c[4])); c[5] = t.hm; c[6] = ''; }
93
+ else if (what === 'end') { const [sym, ...st] = rest; if (!['✓', '✗', '⏸', '⛔'].includes(sym)) die(2, `gate end takes ✓ ✗ ⏸ or ⛔, got ${sym}`); c[2] = sym; c[6] = sym === '⏸' ? '' : t.hm; if (!c[5]) c[5] = t.hm; c[7] = cell(noSecret(st.join(' '))); }
94
+ else die(2, `gate ${g} start|end`);
95
+ lines[i] = `| ${c.slice(1, -1).join(' | ')} |`;
96
+ lines = syncBoard(lines);
97
+ console.log(`gate ${g} ${what} at ${t.hm}`);
98
+ } else if (verb === 'retry') {
99
+ const i = gateRow(a[0]);
100
+ if (i < 0) die(1, `no gate row ${a[0]}`);
101
+ const c = lines[i].split('|').map((x) => x.trim());
102
+ c[8] = String((parseInt(c[8], 10) || 0) + 1);
103
+ lines[i] = `| ${c.slice(1, -1).join(' | ')} |`;
104
+ console.log(`gate ${a[0]} retries ${c[8]}`);
105
+ } else if (verb === 'log') {
106
+ if (a.length < 6) die(2, 'log <task> <agent> <decision> <status> <failure_class> <accepted> ["<note>"]');
107
+ a.forEach(noSecret);
108
+ const [task, agent, decision, status, fc, accepted, ...note] = a;
109
+ const row = `| ${t.hm} | ${cell(noSecret([task, ...note].join(' ')))} | ${cell(agent)} | ${cell(decision)} | ${cell(status)} | ${cell(fc)} | ${cell(accepted)} |`;
110
+ let i = lines.findIndex((l) => /^### Log/.test(l));
111
+ if (i < 0) die(1, 'no ### Log section');
112
+ i += 3; // heading, header row, separator
113
+ while (i < lines.length && lines[i].startsWith('|')) i++;
114
+ lines.splice(i, 0, row);
115
+ console.log(`log ${task} ${decision}`);
116
+ } else if (verb === 'state') {
117
+ const [k, ...v] = a;
118
+ const value = cell(noSecret(v.join(' ')));
119
+ if (k === 'code') {
120
+ const i = lines.findIndex((l) => /^code: /.test(l));
121
+ if (i < 0) die(1, 'no code line');
122
+ lines[i] = `code: ${value}`;
123
+ } else {
124
+ if (!STATE_KEYS.includes(k)) die(2, `state takes ${STATE_KEYS.join(', ')} or code`);
125
+ const i = lines.findIndex((l) => l.startsWith(`- ${k}: `));
126
+ if (i < 0) die(1, `no Run state line for ${k}`);
127
+ lines[i] = `- ${k}: ${value}`;
128
+ }
129
+ console.log(`state ${k}`);
130
+ } else if (verb === 'metric') {
131
+ const i = lines.findIndex((l) => /^platform: /.test(l));
132
+ if (i < 0) die(1, 'no Metrics line');
133
+ let m = lines[i];
134
+ for (const pair of a) {
135
+ const eq = pair.indexOf('=');
136
+ if (eq < 1) die(2, `metric takes name=value, got ${pair}`);
137
+ const name = pair.slice(0, eq); let val = noSecret(pair.slice(eq + 1));
138
+ if (name === 'stopped' && val === 'now') val = t.iso;
139
+ const rx = new RegExp(`(^|· )${name.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}: ([^·]*?)( ·|$)`);
140
+ const cur = m.match(rx);
141
+ if (!cur) { m = `${m} · ${name}: ${val}`; continue; }
142
+ if (/^\+\d+$/.test(val)) val = String((parseInt(cur[2], 10) || 0) + parseInt(val.slice(1), 10));
143
+ m = m.replace(rx, (all, pre, _old, post) => `${pre}${name}: ${val}${post}`);
144
+ }
145
+ const st = m.match(/started: (\d{4}-\d\d-\d\dT\d\d:\d\d)/); const sp = m.match(/stopped: (\d{4}-\d\d-\d\dT\d\d:\d\d)/);
146
+ if (st && sp && a.some((p) => p.startsWith('stopped='))) {
147
+ const mins = Math.round((Date.parse(sp[1]) - Date.parse(st[1])) / 60000);
148
+ m = m.replace(/wall time: [^·]*?( ·|$)/, (all, post) => `wall time: ${mins} min${post}`);
149
+ }
150
+ lines[i] = m;
151
+ console.log(`metrics ${a.map((p) => p.split('=')[0]).join(', ')}`);
152
+ } else die(2, `unknown action ${verb}`);
153
+ return lines;
154
+ }
155
+
156
+ function main() {
157
+ const argv = process.argv.slice(2);
158
+ if (argv[0] === 'init') return init(argv.slice(1));
159
+ const file = argv[0];
160
+ if (!file || !fs.existsSync(file)) die(file ? 1 : 2, file ? `no run file ${file}` : 'usage: run_state.mjs <run file> <action> [+ <action> …] | init <key> …');
161
+ insideWorkspace(file, 'the run file');
162
+ const acts = [[]];
163
+ for (const x of argv.slice(1)) { if (x === '+') acts.push([]); else acts[acts.length - 1].push(x); }
164
+ if (!acts[0].length) die(2, 'no action');
165
+ const t = now();
166
+ let lines = fs.readFileSync(file, 'utf8').split('\n');
167
+ for (const act of acts) lines = apply(lines, act, t);
168
+ fs.writeFileSync(file, lines.join('\n'));
169
+ }
170
+
171
+ main();