@orion-qa/orion 3.0.0 → 3.2.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 (637) hide show
  1. package/.claude/agents/automation-strategist.md +1 -0
  2. package/.claude/agents/change-agent.md +1 -0
  3. package/.claude/agents/codebase-analyst.md +2 -1
  4. package/.claude/agents/environment-discovery.md +1 -0
  5. package/.claude/agents/evidence-validator.md +1 -0
  6. package/.claude/agents/executor.md +1 -0
  7. package/.claude/agents/failure-analyst.md +2 -1
  8. package/.claude/agents/implementer.md +2 -1
  9. package/.claude/agents/requirement-analyst.md +1 -0
  10. package/.claude/agents/reviewer.md +1 -0
  11. package/.claude/agents/test-reporter.md +1 -0
  12. package/.claude/settings.json +25 -0
  13. package/.claude/skills/appium/SKILL.md +1 -1
  14. package/.claude/skills/appium/templates/README.md +6 -9
  15. package/.claude/skills/appium/templates/ci/github-actions-android.yml +8 -2
  16. package/.claude/skills/appium/templates/ci/github-actions-ios.yml +8 -2
  17. package/.claude/skills/appium/templates/ci/github-actions-windows.yml +9 -2
  18. package/.claude/skills/appium/templates/project-java/.env.example +4 -0
  19. package/.claude/skills/appium/templates/project-java/pom.xml +2 -0
  20. package/.claude/skills/appium/templates/project-java/src/test/java/automation/{framework/Config.java → config/Env.java} +43 -52
  21. package/.claude/skills/appium/templates/project-java/src/test/java/automation/config/Flags.java +45 -0
  22. package/.claude/skills/appium/templates/project-java/src/test/java/automation/config/Paths.java +14 -0
  23. package/.claude/skills/appium/templates/project-java/src/test/java/automation/desc/SignInDesc.java +30 -0
  24. package/.claude/skills/appium/templates/project-java/src/test/java/automation/{framework → driver}/DriverFactory.java +19 -13
  25. package/.claude/skills/appium/templates/project-java/src/test/java/automation/{framework → driver}/DriverManager.java +12 -9
  26. package/.claude/skills/appium/templates/project-java/src/test/java/automation/fixtures/BaseTest.java +75 -0
  27. package/.claude/skills/appium/templates/project-java/src/test/java/automation/{screens → pageObjects}/BaseScreen.java +12 -12
  28. package/.claude/skills/appium/templates/project-java/src/test/java/automation/pageObjects/HomeScreen.java +26 -0
  29. package/.claude/skills/appium/templates/project-java/src/test/java/automation/pageObjects/LoginScreen.java +63 -0
  30. package/.claude/skills/appium/templates/project-java/src/test/java/automation/pageObjects/ShellScreen.java +26 -0
  31. package/.claude/skills/appium/templates/project-java/src/test/java/automation/setup/AuthSetup.java +49 -0
  32. package/.claude/skills/appium/templates/project-java/src/test/java/automation/testData/TestData.java +78 -0
  33. package/.claude/skills/appium/templates/project-java/src/test/java/automation/tests/ui/SignInTest.java +45 -0
  34. package/.claude/skills/appium/templates/project-java/src/test/java/automation/tests/unit/UtilsTest.java +34 -0
  35. package/.claude/skills/appium/templates/project-java/src/test/java/automation/{framework → utils}/AutomationError.java +4 -4
  36. package/.claude/skills/appium/templates/project-java/src/test/java/automation/utils/Case.java +20 -0
  37. package/.claude/skills/appium/templates/project-java/src/test/java/automation/utils/CaseTransformer.java +54 -0
  38. package/.claude/skills/appium/templates/project-java/src/test/java/automation/utils/Dates.java +42 -0
  39. package/.claude/skills/appium/templates/project-java/src/test/java/automation/utils/Log.java +45 -0
  40. package/.claude/skills/appium/templates/project-java/src/test/java/automation/utils/MissingSettingError.java +13 -0
  41. package/.claude/skills/appium/templates/project-java/src/test/java/automation/utils/RandomData.java +41 -0
  42. package/.claude/skills/appium/templates/project-java/src/test/java/automation/utils/Redact.java +33 -0
  43. package/.claude/skills/appium/templates/project-java/src/test/java/automation/utils/TestDescription.java +25 -0
  44. package/.claude/skills/appium/templates/project-java/src/test/resources/testData/testData.properties +7 -0
  45. package/.claude/skills/appium/templates/project-java/testng.xml +11 -4
  46. package/.claude/skills/architecture-analysis/SKILL.md +3 -2
  47. package/.claude/skills/automation-implementation/SKILL.md +8 -5
  48. package/.claude/skills/automation-implementation/references/patterns.md +46 -24
  49. package/.claude/skills/automation-review/references/assertion-guard.md +1 -1
  50. package/.claude/skills/code-review/SKILL.md +5 -2
  51. package/.claude/skills/code-review/references/pattern-rules.md +12 -7
  52. package/.claude/skills/documentation/SKILL.md +23 -18
  53. package/.claude/skills/execution/SKILL.md +7 -3
  54. package/.claude/skills/httpclient/templates/README.md +6 -7
  55. package/.claude/skills/httpclient/templates/csharp-nunit/.env.example +4 -0
  56. package/.claude/skills/httpclient/templates/csharp-nunit/Automation.csproj +7 -3
  57. package/.claude/skills/httpclient/templates/csharp-nunit/Config/Env.cs +62 -0
  58. package/.claude/skills/httpclient/templates/csharp-nunit/Config/Flags.cs +35 -0
  59. package/.claude/skills/httpclient/templates/csharp-nunit/Config/Paths.cs +22 -0
  60. package/.claude/skills/httpclient/templates/csharp-nunit/Fixtures/BaseTest.cs +22 -0
  61. package/.claude/skills/httpclient/templates/csharp-nunit/Resources/Desc/ProductsDesc.cs +22 -0
  62. package/.claude/skills/httpclient/templates/csharp-nunit/Resources/TestData/TestData.cs +61 -0
  63. package/.claude/skills/httpclient/templates/csharp-nunit/Resources/TestData/testData.json +9 -0
  64. package/.claude/skills/httpclient/templates/csharp-nunit/Services/ApiClient.cs +48 -0
  65. package/.claude/skills/httpclient/templates/csharp-nunit/Services/HealthApi.cs +11 -0
  66. package/.claude/skills/httpclient/templates/csharp-nunit/{Api → Services}/ProductsApi.cs +8 -5
  67. package/.claude/skills/httpclient/templates/csharp-nunit/Tests/Api/ProductsTests.cs +61 -0
  68. package/.claude/skills/httpclient/templates/csharp-nunit/Tests/Unit/UtilsTests.cs +40 -0
  69. package/.claude/skills/httpclient/templates/csharp-nunit/Utils/AutomationError.cs +15 -0
  70. package/.claude/skills/httpclient/templates/csharp-nunit/Utils/Dates.cs +18 -0
  71. package/.claude/skills/httpclient/templates/csharp-nunit/Utils/Log.cs +37 -0
  72. package/.claude/skills/httpclient/templates/csharp-nunit/Utils/RandomData.cs +26 -0
  73. package/.claude/skills/httpclient/templates/csharp-nunit/Utils/Redact.cs +22 -0
  74. package/.claude/skills/httpclient/templates/csharp-nunit/Utils/TestDescription.cs +55 -0
  75. package/.claude/skills/javascript/references/sources.md +1 -1
  76. package/.claude/skills/k6/SKILL.md +1 -1
  77. package/.claude/skills/k6/templates/README.md +5 -3
  78. package/.claude/skills/k6/templates/project/{data/cases.js → resources/desc/products.desc.js} +1 -1
  79. package/.claude/skills/k6/templates/project/resources/testData/testData.js +32 -0
  80. package/.claude/skills/k6/templates/project/{lib/config.js → src/config/env.js} +10 -5
  81. package/.claude/skills/k6/templates/project/{lib → src/services}/products-api.js +7 -5
  82. package/.claude/skills/k6/templates/project/{load → tests/load}/products.js +8 -8
  83. package/.claude/skills/karate/templates/README.md +4 -5
  84. package/.claude/skills/karate/templates/java-junit5/.env.example +2 -0
  85. package/.claude/skills/karate/templates/java-junit5/pom.xml +4 -0
  86. package/.claude/skills/karate/templates/java-junit5/src/test/java/{support → config}/EnvSettings.java +1 -1
  87. package/.claude/skills/karate/templates/java-junit5/src/test/java/karate-config.js +13 -6
  88. package/.claude/skills/karate/templates/java-junit5/src/test/java/logback-test.xml +1 -1
  89. package/.claude/skills/karate/templates/java-junit5/src/test/java/{api → tests}/ApiTest.java +7 -4
  90. package/.claude/skills/karate/templates/java-junit5/src/test/java/{api → tests/api}/health.feature +3 -3
  91. package/.claude/skills/karate/templates/java-junit5/src/test/java/tests/api/products.feature +29 -0
  92. package/.claude/skills/karate/templates/java-junit5/src/test/java/{support → utils}/MaskingLogModifier.java +1 -1
  93. package/.claude/skills/karate/templates/java-junit5/src/test/resources/testData/newProduct.js +7 -0
  94. package/.claude/skills/karate/templates/java-junit5/src/test/resources/testData/testData.json +6 -0
  95. package/.claude/skills/newman/templates/README.md +4 -5
  96. package/.claude/skills/newman/templates/collection/.env.example +2 -0
  97. package/.claude/skills/newman/templates/collection/collections/api.postman_collection.json +165 -145
  98. package/.claude/skills/newman/templates/collection/package.json +2 -1
  99. package/.claude/skills/newman/templates/collection/resources/desc/products.desc.json +53 -0
  100. package/.claude/skills/newman/templates/collection/resources/testData/testData.json +10 -0
  101. package/.claude/skills/newman/templates/collection/run.js +41 -31
  102. package/.claude/skills/newman/templates/collection/src/config/env.js +37 -0
  103. package/.claude/skills/orion/SKILL.md +19 -12
  104. package/.claude/skills/orion/references/assess-fix.md +35 -0
  105. package/.claude/skills/orion/references/batch.md +64 -0
  106. package/.claude/skills/orion/references/blockers.md +1 -1
  107. package/.claude/skills/orion/references/capabilities.md +1 -1
  108. package/.claude/skills/orion/references/conversation.md +65 -20
  109. package/.claude/skills/orion/references/delivery-formats.md +24 -36
  110. package/.claude/skills/orion/references/doctor.md +1 -1
  111. package/.claude/skills/orion/references/hosts.md +1 -0
  112. package/.claude/skills/orion/references/modes.md +7 -3
  113. package/.claude/skills/orion/references/plain-language.md +55 -0
  114. package/.claude/skills/orion/references/project-context-files.md +8 -2
  115. package/.claude/skills/orion/references/recovery-loop.md +8 -0
  116. package/.claude/skills/orion/references/setup-card.md +29 -8
  117. package/.claude/skills/orion/references/status-lines.md +9 -4
  118. package/.claude/skills/orion/references/task-brief.md +1 -0
  119. package/.claude/skills/orion/references/work-branch.md +3 -1
  120. package/.claude/skills/orion/scripts/batch_detect.mjs +98 -0
  121. package/.claude/skills/orion/scripts/batch_state.mjs +179 -0
  122. package/.claude/skills/orion/scripts/browser_setup.mjs +41 -21
  123. package/.claude/skills/orion/scripts/cases_export.py +724 -0
  124. package/.claude/skills/orion/scripts/codemap.mjs +116 -0
  125. package/.claude/skills/orion/scripts/done_check.mjs +195 -0
  126. package/.claude/skills/orion/scripts/env_check.mjs +8 -3
  127. package/.claude/skills/orion/scripts/env_check.py +12 -5
  128. package/.claude/skills/orion/scripts/fix_plan.mjs +170 -0
  129. package/.claude/skills/orion/scripts/graph.mjs +400 -0
  130. package/.claude/skills/orion/scripts/hooks/lean_guard.mjs +162 -0
  131. package/.claude/skills/orion/scripts/lib/inside.mjs +31 -0
  132. package/.claude/skills/orion/scripts/lib/scan.mjs +357 -0
  133. package/.claude/skills/orion/scripts/lib/table.mjs +116 -0
  134. package/.claude/skills/orion/scripts/parity_check.mjs +166 -0
  135. package/.claude/skills/orion/scripts/quiet.mjs +160 -0
  136. package/.claude/skills/orion/scripts/report_check.mjs +77 -0
  137. package/.claude/skills/orion/scripts/results_parse.mjs +209 -0
  138. package/.claude/skills/orion/scripts/reuse_check.mjs +251 -0
  139. package/.claude/skills/orion/scripts/rules.mjs +92 -0
  140. package/.claude/skills/orion/scripts/run_state.mjs +238 -0
  141. package/.claude/skills/orion/scripts/suite_check.mjs +267 -0
  142. package/.claude/skills/orion/scripts/timing_profile.mjs +128 -0
  143. package/.claude/skills/orion/scripts/usage_report.mjs +315 -0
  144. package/.claude/skills/orion/templates/project-context/assessment.md +45 -0
  145. package/.claude/skills/orion/templates/project-context/defects.md +5 -0
  146. package/.claude/skills/orion/templates/project-context/report.md +45 -0
  147. package/.claude/skills/orion/templates/project-context/retry-policy.md +6 -0
  148. package/.claude/skills/orion/templates/project-context/run.md +4 -1
  149. package/.claude/skills/orion/templates/project-context/test-case-map.md +5 -0
  150. package/.claude/skills/orion/templates/project-context/test-design.md +24 -0
  151. package/.claude/skills/pact/SKILL.md +2 -2
  152. package/.claude/skills/pact/templates/README.md +4 -2
  153. package/.claude/skills/pact/templates/project/package.json +2 -2
  154. package/.claude/skills/pact/templates/project/{data/cases.js → resources/desc/products.desc.js} +3 -3
  155. package/.claude/skills/pact/templates/project/resources/testData/testData.js +21 -0
  156. package/.claude/skills/pact/templates/project/src/config/env.js +32 -0
  157. package/.claude/skills/pact/templates/project/src/{products-client.js → services/products-client.js} +4 -2
  158. package/.claude/skills/pact/templates/project/tests/contract/products.contract.test.js +46 -0
  159. package/.claude/skills/pact/templates/project/{verify → tests/verify}/products.verify.js +7 -22
  160. package/.claude/skills/playwright/SKILL.md +6 -6
  161. package/.claude/skills/playwright/templates/README.md +29 -10
  162. package/.claude/skills/playwright/templates/ci/Jenkinsfile +1 -1
  163. package/.claude/skills/playwright/templates/ci/azure-pipelines.yml +1 -1
  164. package/.claude/skills/playwright/templates/ci/github-actions-javascript.yml +1 -1
  165. package/.claude/skills/playwright/templates/ci/github-actions.yml +1 -1
  166. package/.claude/skills/playwright/templates/ci/gitlab-ci.yml +1 -1
  167. package/.claude/skills/playwright/templates/dotnet/.env.example +7 -0
  168. package/.claude/skills/playwright/templates/dotnet/.runsettings +17 -0
  169. package/.claude/skills/playwright/templates/dotnet/Automation.csproj +8 -0
  170. package/.claude/skills/playwright/templates/dotnet/Config/Env.cs +89 -0
  171. package/.claude/skills/playwright/templates/dotnet/Config/Flags.cs +56 -0
  172. package/.claude/skills/playwright/templates/dotnet/Config/Paths.cs +31 -0
  173. package/.claude/skills/playwright/templates/dotnet/Fixtures/ApiBaseTest.cs +39 -0
  174. package/.claude/skills/playwright/templates/dotnet/Fixtures/BaseTest.cs +72 -0
  175. package/.claude/skills/playwright/templates/dotnet/PageObjects/BasePage.cs +63 -0
  176. package/.claude/skills/playwright/templates/dotnet/PageObjects/HomePage.cs +21 -0
  177. package/.claude/skills/playwright/templates/dotnet/PageObjects/LoginPage.cs +54 -0
  178. package/.claude/skills/playwright/templates/dotnet/PageObjects/ShellPage.cs +29 -0
  179. package/.claude/skills/playwright/templates/dotnet/Resources/Desc/SignInDesc.cs +23 -0
  180. package/.claude/skills/playwright/templates/dotnet/Resources/TestData/TestData.cs +74 -0
  181. package/.claude/skills/playwright/templates/dotnet/Resources/TestData/testData.json +19 -0
  182. package/.claude/skills/playwright/templates/dotnet/Services/ApiClient.cs +51 -0
  183. package/.claude/skills/playwright/templates/dotnet/Setup/AuthSetup.cs +63 -0
  184. package/.claude/skills/playwright/templates/dotnet/Tests/Api/SessionTests.cs +18 -0
  185. package/.claude/skills/playwright/templates/dotnet/Tests/Ui/SignInTests.cs +48 -0
  186. package/.claude/skills/playwright/templates/dotnet/Tests/Unit/UtilsTests.cs +40 -0
  187. package/.claude/skills/playwright/templates/dotnet/Utils/AutomationError.cs +15 -0
  188. package/.claude/skills/playwright/templates/dotnet/Utils/Dates.cs +18 -0
  189. package/.claude/skills/playwright/templates/dotnet/Utils/Log.cs +37 -0
  190. package/.claude/skills/playwright/templates/dotnet/Utils/RandomData.cs +26 -0
  191. package/.claude/skills/playwright/templates/dotnet/Utils/Redact.cs +22 -0
  192. package/.claude/skills/playwright/templates/dotnet/Utils/TestDescription.cs +55 -0
  193. package/.claude/skills/playwright/templates/dotnet/gitignore +6 -1
  194. package/.claude/skills/playwright/templates/javascript/.env.example +8 -0
  195. package/.claude/skills/playwright/templates/javascript/fixtures/index.js +85 -0
  196. package/.claude/skills/playwright/templates/javascript/fixtures/session.js +82 -0
  197. package/.claude/skills/playwright/templates/javascript/gitignore +7 -0
  198. package/.claude/skills/playwright/templates/javascript/jsconfig.json +12 -0
  199. package/.claude/skills/playwright/templates/javascript/package.json +7 -3
  200. package/.claude/skills/playwright/templates/javascript/pageObjects/basePage.js +62 -0
  201. package/.claude/skills/playwright/templates/javascript/pageObjects/homePage.js +19 -0
  202. package/.claude/skills/playwright/templates/javascript/pageObjects/loginPage.js +44 -0
  203. package/.claude/skills/playwright/templates/javascript/pageObjects/shellPage.js +26 -0
  204. package/.claude/skills/playwright/templates/javascript/playwright.config.js +45 -24
  205. package/.claude/skills/playwright/templates/javascript/reporters/summaryReporter.js +233 -0
  206. package/.claude/skills/playwright/templates/javascript/resources/desc/signIn.desc.js +33 -0
  207. package/.claude/skills/playwright/templates/javascript/resources/testData/testData.js +45 -0
  208. package/.claude/skills/playwright/templates/javascript/setup/auth.setup.js +17 -0
  209. package/.claude/skills/playwright/templates/javascript/setup/auth.teardown.js +16 -0
  210. package/.claude/skills/playwright/templates/javascript/src/config/env.js +107 -0
  211. package/.claude/skills/playwright/templates/javascript/src/config/flags.js +70 -0
  212. package/.claude/skills/playwright/templates/javascript/src/config/loadEnv.js +21 -0
  213. package/.claude/skills/playwright/templates/javascript/src/config/paths.js +22 -0
  214. package/.claude/skills/playwright/templates/javascript/src/services/apiClient.js +68 -0
  215. package/.claude/skills/playwright/templates/javascript/tests/api/session.spec.js +15 -0
  216. package/.claude/skills/playwright/templates/javascript/tests/ui/signIn.spec.js +35 -0
  217. package/.claude/skills/playwright/templates/javascript/tests/unit/summaryReporter.test.js +34 -0
  218. package/.claude/skills/playwright/templates/javascript/tests/unit/utils.test.js +31 -0
  219. package/.claude/skills/playwright/templates/javascript/utils/date.js +28 -0
  220. package/.claude/skills/playwright/templates/javascript/{src → utils}/errors.js +1 -0
  221. package/.claude/skills/playwright/templates/javascript/utils/formFill.js +29 -0
  222. package/.claude/skills/playwright/templates/javascript/utils/logger.js +33 -0
  223. package/.claude/skills/playwright/templates/javascript/utils/random.js +37 -0
  224. package/.claude/skills/playwright/templates/javascript/utils/redact.js +35 -0
  225. package/.claude/skills/playwright/templates/javascript/utils/titles.js +38 -0
  226. package/.claude/skills/playwright/templates/project/.env.example +8 -0
  227. package/.claude/skills/playwright/templates/project/fixtures/index.ts +86 -0
  228. package/.claude/skills/playwright/templates/project/fixtures/session.ts +78 -0
  229. package/.claude/skills/playwright/templates/project/gitignore +9 -2
  230. package/.claude/skills/playwright/templates/project/package.json +8 -6
  231. package/.claude/skills/playwright/templates/project/pageObjects/basePage.ts +57 -0
  232. package/.claude/skills/playwright/templates/project/pageObjects/homePage.ts +20 -0
  233. package/.claude/skills/playwright/templates/project/pageObjects/loginPage.ts +47 -0
  234. package/.claude/skills/playwright/templates/project/pageObjects/shellPage.ts +22 -0
  235. package/.claude/skills/playwright/templates/project/playwright.config.ts +49 -23
  236. package/.claude/skills/playwright/templates/project/reporters/summaryReporter.ts +241 -0
  237. package/.claude/skills/playwright/templates/project/resources/desc/signIn.desc.ts +32 -0
  238. package/.claude/skills/playwright/templates/project/resources/testData/testData.ts +42 -0
  239. package/.claude/skills/playwright/templates/project/setup/auth.setup.ts +16 -0
  240. package/.claude/skills/playwright/templates/project/setup/auth.teardown.ts +15 -0
  241. package/.claude/skills/playwright/templates/project/src/config/env.ts +109 -0
  242. package/.claude/skills/playwright/templates/project/src/config/flags.ts +70 -0
  243. package/.claude/skills/playwright/templates/project/src/config/loadEnv.ts +17 -0
  244. package/.claude/skills/playwright/templates/project/src/config/paths.ts +19 -0
  245. package/.claude/skills/playwright/templates/project/src/services/apiClient.ts +70 -0
  246. package/.claude/skills/playwright/templates/project/tests/api/session.spec.ts +14 -0
  247. package/.claude/skills/playwright/templates/project/tests/ui/signIn.spec.ts +34 -0
  248. package/.claude/skills/playwright/templates/project/tests/unit/summaryReporter.test.ts +33 -0
  249. package/.claude/skills/playwright/templates/project/tests/unit/utils.test.ts +30 -0
  250. package/.claude/skills/playwright/templates/project/tsconfig.json +3 -8
  251. package/.claude/skills/playwright/templates/project/utils/date.ts +25 -0
  252. package/.claude/skills/playwright/templates/project/utils/formFill.ts +27 -0
  253. package/.claude/skills/playwright/templates/project/utils/logger.ts +32 -0
  254. package/.claude/skills/playwright/templates/project/utils/random.ts +34 -0
  255. package/.claude/skills/playwright/templates/project/utils/redact.ts +32 -0
  256. package/.claude/skills/playwright/templates/project/utils/titles.ts +42 -0
  257. package/.claude/skills/playwright/templates/python/.env.example +8 -0
  258. package/.claude/skills/playwright/templates/python/conftest.py +91 -16
  259. package/.claude/skills/playwright/templates/python/gitignore +5 -0
  260. package/.claude/skills/playwright/templates/python/page_objects/__init__.py +1 -0
  261. package/.claude/skills/playwright/templates/python/page_objects/base_page.py +57 -0
  262. package/.claude/skills/playwright/templates/python/page_objects/home_page.py +22 -0
  263. package/.claude/skills/playwright/templates/python/page_objects/login_page.py +42 -0
  264. package/.claude/skills/playwright/templates/python/page_objects/shell_page.py +21 -0
  265. package/.claude/skills/playwright/templates/python/pytest.ini +5 -2
  266. package/.claude/skills/playwright/templates/python/requirements.txt +1 -0
  267. package/.claude/skills/playwright/templates/python/resources/__init__.py +1 -0
  268. package/.claude/skills/playwright/templates/python/resources/desc/__init__.py +1 -0
  269. package/.claude/skills/playwright/templates/python/resources/desc/sign_in_desc.py +27 -0
  270. package/.claude/skills/playwright/templates/python/resources/test_data/__init__.py +1 -0
  271. package/.claude/skills/playwright/templates/python/resources/test_data/test_data.py +41 -0
  272. package/.claude/skills/playwright/templates/python/setup/__init__.py +1 -0
  273. package/.claude/skills/playwright/templates/python/setup/auth.py +53 -0
  274. package/.claude/skills/playwright/templates/python/src/__init__.py +1 -0
  275. package/.claude/skills/playwright/templates/python/src/config/__init__.py +1 -0
  276. package/.claude/skills/playwright/templates/python/src/config/env.py +109 -0
  277. package/.claude/skills/playwright/templates/python/src/config/flags.py +63 -0
  278. package/.claude/skills/playwright/templates/python/src/config/load_env.py +16 -0
  279. package/.claude/skills/playwright/templates/python/src/config/paths.py +25 -0
  280. package/.claude/skills/playwright/templates/python/src/services/__init__.py +1 -0
  281. package/.claude/skills/playwright/templates/python/src/services/api_client.py +60 -0
  282. package/.claude/skills/playwright/templates/python/tests/api/test_session.py +14 -0
  283. package/.claude/skills/playwright/templates/python/tests/ui/test_sign_in.py +36 -0
  284. package/.claude/skills/playwright/templates/python/tests/unit/test_utils.py +32 -0
  285. package/.claude/skills/playwright/templates/python/utils/__init__.py +1 -0
  286. package/.claude/skills/playwright/templates/python/utils/dates.py +23 -0
  287. package/.claude/skills/playwright/templates/python/{framework → utils}/errors.py +3 -2
  288. package/.claude/skills/playwright/templates/python/utils/form_fill.py +26 -0
  289. package/.claude/skills/playwright/templates/python/utils/logger.py +40 -0
  290. package/.claude/skills/playwright/templates/python/utils/markers.py +6 -0
  291. package/.claude/skills/playwright/templates/python/utils/random_data.py +35 -0
  292. package/.claude/skills/playwright/templates/python/utils/redact.py +30 -0
  293. package/.claude/skills/playwright/templates/python/utils/titles.py +53 -0
  294. package/.claude/skills/quality-checks/SKILL.md +11 -11
  295. package/.claude/skills/quality-checks/templates/README.md +14 -12
  296. package/.claude/skills/quality-checks/templates/playwright-js/pageObjects/scannedPage.js +21 -0
  297. package/.claude/skills/quality-checks/templates/playwright-js/resources/desc/quality.desc.js +63 -0
  298. package/.claude/skills/quality-checks/templates/playwright-js/resources/testData/qualityData.js +32 -0
  299. package/.claude/skills/quality-checks/templates/playwright-js/src/checks/accessibility.js +50 -0
  300. package/.claude/skills/quality-checks/templates/playwright-js/src/checks/pageHealth.js +38 -0
  301. package/.claude/skills/quality-checks/templates/playwright-js/src/checks/performance.js +21 -0
  302. package/.claude/skills/quality-checks/templates/playwright-js/src/services/graphqlClient.js +28 -0
  303. package/.claude/skills/quality-checks/templates/playwright-js/tests/api/graphql.spec.js +23 -0
  304. package/.claude/skills/quality-checks/templates/playwright-js/tests/ui/quality.spec.js +50 -0
  305. package/.claude/skills/quality-checks/templates/playwright-ts/pageObjects/scannedPage.ts +20 -0
  306. package/.claude/skills/quality-checks/templates/playwright-ts/resources/desc/quality.desc.ts +59 -0
  307. package/.claude/skills/quality-checks/templates/playwright-ts/{src/data/quality.data.ts → resources/testData/qualityData.ts} +3 -2
  308. package/.claude/skills/quality-checks/templates/playwright-ts/tests/api/graphql.spec.ts +22 -0
  309. package/.claude/skills/quality-checks/templates/playwright-ts/tests/ui/quality.spec.ts +49 -0
  310. package/.claude/skills/requests/templates/README.md +6 -7
  311. package/.claude/skills/requests/templates/python-pytest/.env.example +4 -0
  312. package/.claude/skills/requests/templates/python-pytest/conftest.py +24 -9
  313. package/.claude/skills/requests/templates/python-pytest/pytest.ini +6 -3
  314. package/.claude/skills/requests/templates/python-pytest/requirements.txt +1 -0
  315. package/.claude/skills/requests/templates/python-pytest/resources/__init__.py +1 -0
  316. package/.claude/skills/requests/templates/python-pytest/resources/desc/__init__.py +1 -0
  317. package/.claude/skills/requests/templates/python-pytest/resources/desc/products_desc.py +27 -0
  318. package/.claude/skills/requests/templates/python-pytest/resources/test_data/__init__.py +1 -0
  319. package/.claude/skills/requests/templates/python-pytest/resources/test_data/test_data.py +27 -0
  320. package/.claude/skills/requests/templates/python-pytest/src/__init__.py +1 -0
  321. package/.claude/skills/requests/templates/python-pytest/src/config/__init__.py +1 -0
  322. package/.claude/skills/requests/templates/python-pytest/src/config/env.py +39 -0
  323. package/.claude/skills/requests/templates/python-pytest/src/config/flags.py +35 -0
  324. package/.claude/skills/requests/templates/python-pytest/src/config/load_env.py +16 -0
  325. package/.claude/skills/requests/templates/python-pytest/src/config/paths.py +16 -0
  326. package/.claude/skills/requests/templates/python-pytest/src/services/__init__.py +1 -0
  327. package/.claude/skills/requests/templates/python-pytest/{api/client.py → src/services/api_client.py} +19 -10
  328. package/.claude/skills/requests/templates/python-pytest/{api → src/services}/products_api.py +3 -9
  329. package/.claude/skills/requests/templates/python-pytest/tests/api/test_products.py +35 -0
  330. package/.claude/skills/requests/templates/python-pytest/tests/unit/test_utils.py +32 -0
  331. package/.claude/skills/requests/templates/python-pytest/utils/__init__.py +1 -0
  332. package/.claude/skills/requests/templates/python-pytest/utils/dates.py +23 -0
  333. package/.claude/skills/{selenium/templates/python-pytest/framework → requests/templates/python-pytest/utils}/errors.py +4 -3
  334. package/.claude/skills/requests/templates/python-pytest/utils/logger.py +40 -0
  335. package/.claude/skills/requests/templates/python-pytest/utils/random_data.py +35 -0
  336. package/.claude/skills/requests/templates/python-pytest/utils/redact.py +30 -0
  337. package/.claude/skills/requests/templates/python-pytest/utils/titles.py +53 -0
  338. package/.claude/skills/requirement-analysis/SKILL.md +1 -1
  339. package/.claude/skills/rest-assured/SKILL.md +1 -1
  340. package/.claude/skills/rest-assured/templates/README.md +6 -7
  341. package/.claude/skills/rest-assured/templates/ci/github-actions.yml +5 -2
  342. package/.claude/skills/rest-assured/templates/java-testng/.env.example +3 -0
  343. package/.claude/skills/rest-assured/templates/java-testng/pom.xml +7 -0
  344. package/.claude/skills/rest-assured/templates/java-testng/src/test/java/automation/{api/ApiConfig.java → config/Env.java} +35 -22
  345. package/.claude/skills/rest-assured/templates/java-testng/src/test/java/automation/config/Flags.java +17 -0
  346. package/.claude/skills/rest-assured/templates/java-testng/src/test/java/automation/config/Paths.java +14 -0
  347. package/.claude/skills/rest-assured/templates/java-testng/src/test/java/automation/desc/ProductsDesc.java +26 -0
  348. package/.claude/skills/rest-assured/templates/java-testng/src/test/java/automation/fixtures/BaseTest.java +29 -0
  349. package/.claude/skills/rest-assured/templates/java-testng/src/test/java/automation/services/ApiSpec.java +31 -0
  350. package/.claude/skills/rest-assured/templates/java-testng/src/test/java/automation/services/HealthApi.java +17 -0
  351. package/.claude/skills/rest-assured/templates/java-testng/src/test/java/automation/{api → services}/ProductsApi.java +19 -14
  352. package/.claude/skills/rest-assured/templates/java-testng/src/test/java/automation/{data → testData}/ProductBuilder.java +4 -8
  353. package/.claude/skills/rest-assured/templates/java-testng/src/test/java/automation/testData/TestData.java +64 -0
  354. package/.claude/skills/rest-assured/templates/java-testng/src/test/java/automation/tests/api/ProductsTest.java +49 -0
  355. package/.claude/skills/rest-assured/templates/java-testng/src/test/java/automation/tests/unit/UtilsTest.java +34 -0
  356. 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
  357. package/.claude/skills/rest-assured/templates/java-testng/src/test/java/automation/utils/Case.java +20 -0
  358. package/.claude/skills/rest-assured/templates/java-testng/src/test/java/automation/utils/CaseTransformer.java +54 -0
  359. package/.claude/skills/rest-assured/templates/java-testng/src/test/java/automation/utils/Dates.java +42 -0
  360. package/.claude/skills/rest-assured/templates/java-testng/src/test/java/automation/utils/Log.java +45 -0
  361. package/.claude/skills/rest-assured/templates/java-testng/src/test/java/automation/utils/MissingSettingError.java +13 -0
  362. package/.claude/skills/rest-assured/templates/java-testng/src/test/java/automation/utils/RandomData.java +41 -0
  363. package/.claude/skills/rest-assured/templates/java-testng/src/test/java/automation/utils/Redact.java +33 -0
  364. package/.claude/skills/rest-assured/templates/java-testng/src/test/java/automation/utils/TestDescription.java +25 -0
  365. package/.claude/skills/rest-assured/templates/java-testng/src/test/resources/testData/testData.properties +14 -0
  366. package/.claude/skills/rest-assured/templates/java-testng/testng.xml +14 -0
  367. package/.claude/skills/selenium/SKILL.md +1 -1
  368. package/.claude/skills/selenium/templates/README.md +25 -13
  369. package/.claude/skills/selenium/templates/ci/github-actions-java.yml +5 -2
  370. package/.claude/skills/selenium/templates/csharp-nunit/.env.example +15 -0
  371. package/.claude/skills/selenium/templates/csharp-nunit/Automation.csproj +7 -0
  372. package/.claude/skills/selenium/templates/csharp-nunit/{Framework/Config.cs → Config/Env.cs} +33 -34
  373. package/.claude/skills/selenium/templates/csharp-nunit/Config/Flags.cs +39 -0
  374. package/.claude/skills/selenium/templates/csharp-nunit/Config/Paths.cs +31 -0
  375. package/.claude/skills/selenium/templates/csharp-nunit/{Framework → Driver}/DriverFactory.cs +16 -13
  376. package/.claude/skills/selenium/templates/csharp-nunit/Driver/DriverManager.cs +27 -0
  377. package/.claude/skills/selenium/templates/csharp-nunit/Fixtures/BaseTest.cs +56 -0
  378. package/.claude/skills/selenium/templates/csharp-nunit/{Pages → PageObjects}/BasePage.cs +44 -14
  379. package/.claude/skills/selenium/templates/csharp-nunit/PageObjects/HomePage.cs +21 -0
  380. package/.claude/skills/selenium/templates/csharp-nunit/PageObjects/LoginPage.cs +53 -0
  381. package/.claude/skills/selenium/templates/csharp-nunit/PageObjects/ShellPage.cs +22 -0
  382. package/.claude/skills/selenium/templates/csharp-nunit/Resources/Desc/SignInDesc.cs +23 -0
  383. package/.claude/skills/selenium/templates/csharp-nunit/Resources/TestData/TestData.cs +74 -0
  384. package/.claude/skills/selenium/templates/csharp-nunit/Resources/TestData/testData.json +14 -0
  385. package/.claude/skills/selenium/templates/csharp-nunit/Services/ApiClient.cs +71 -0
  386. package/.claude/skills/selenium/templates/csharp-nunit/Setup/AuthSetup.cs +104 -0
  387. package/.claude/skills/selenium/templates/csharp-nunit/Tests/Api/SessionTests.cs +23 -0
  388. package/.claude/skills/selenium/templates/csharp-nunit/Tests/Ui/SignInTests.cs +42 -0
  389. package/.claude/skills/selenium/templates/csharp-nunit/Tests/Unit/UtilsTests.cs +40 -0
  390. package/.claude/skills/selenium/templates/csharp-nunit/Utils/AutomationError.cs +15 -0
  391. package/.claude/skills/selenium/templates/csharp-nunit/Utils/Dates.cs +18 -0
  392. package/.claude/skills/selenium/templates/csharp-nunit/Utils/FormFill.cs +20 -0
  393. package/.claude/skills/selenium/templates/csharp-nunit/Utils/Log.cs +37 -0
  394. package/.claude/skills/selenium/templates/csharp-nunit/Utils/RandomData.cs +26 -0
  395. package/.claude/skills/selenium/templates/csharp-nunit/Utils/Redact.cs +22 -0
  396. package/.claude/skills/selenium/templates/csharp-nunit/Utils/TestDescription.cs +55 -0
  397. package/.claude/skills/selenium/templates/csharp-nunit/gitignore +6 -2
  398. package/.claude/skills/selenium/templates/java-testng/.env.example +12 -0
  399. package/.claude/skills/selenium/templates/java-testng/gitignore +5 -2
  400. package/.claude/skills/selenium/templates/java-testng/pom.xml +2 -0
  401. package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/{framework/Config.java → config/Env.java} +45 -55
  402. package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/config/Flags.java +50 -0
  403. package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/config/Paths.java +20 -0
  404. package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/desc/SignInDesc.java +30 -0
  405. package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/{framework → driver}/DriverFactory.java +15 -12
  406. package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/{framework → driver}/DriverManager.java +4 -7
  407. package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/fixtures/BaseTest.java +87 -0
  408. package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/{pages → pageObjects}/BasePage.java +41 -17
  409. package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/pageObjects/HomePage.java +32 -0
  410. package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/pageObjects/LoginPage.java +69 -0
  411. package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/pageObjects/ShellPage.java +34 -0
  412. package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/services/ApiClient.java +93 -0
  413. package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/setup/AuthSetup.java +125 -0
  414. package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/testData/TestData.java +88 -0
  415. package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/tests/api/SessionTest.java +23 -0
  416. package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/tests/ui/SignInTest.java +46 -0
  417. package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/tests/unit/UtilsTest.java +34 -0
  418. package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/utils/AutomationError.java +18 -0
  419. package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/utils/Case.java +20 -0
  420. package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/utils/CaseTransformer.java +54 -0
  421. package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/utils/Dates.java +42 -0
  422. package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/utils/FormFill.java +25 -0
  423. package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/utils/Log.java +45 -0
  424. package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/utils/MissingSettingError.java +13 -0
  425. package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/utils/RandomData.java +41 -0
  426. package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/utils/Redact.java +33 -0
  427. package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/utils/TestDescription.java +25 -0
  428. package/.claude/skills/selenium/templates/java-testng/src/test/resources/testData/testData.properties +11 -0
  429. package/.claude/skills/selenium/templates/java-testng/testng.xml +15 -5
  430. package/.claude/skills/selenium/templates/python-pytest/.env.example +12 -0
  431. package/.claude/skills/selenium/templates/python-pytest/conftest.py +63 -12
  432. package/.claude/skills/selenium/templates/python-pytest/gitignore +7 -2
  433. package/.claude/skills/selenium/templates/python-pytest/page_objects/__init__.py +1 -0
  434. package/.claude/skills/selenium/templates/python-pytest/{pages → page_objects}/base_page.py +20 -20
  435. package/.claude/skills/selenium/templates/python-pytest/page_objects/home_page.py +17 -0
  436. package/.claude/skills/selenium/templates/python-pytest/{pages → page_objects}/login_page.py +12 -14
  437. package/.claude/skills/selenium/templates/python-pytest/page_objects/shell_page.py +16 -0
  438. package/.claude/skills/selenium/templates/python-pytest/pytest.ini +6 -2
  439. package/.claude/skills/selenium/templates/python-pytest/requirements.txt +1 -0
  440. package/.claude/skills/selenium/templates/python-pytest/resources/__init__.py +1 -0
  441. package/.claude/skills/selenium/templates/python-pytest/resources/desc/__init__.py +1 -0
  442. package/.claude/skills/selenium/templates/python-pytest/resources/desc/sign_in_desc.py +27 -0
  443. package/.claude/skills/selenium/templates/python-pytest/resources/test_data/__init__.py +1 -0
  444. package/.claude/skills/selenium/templates/python-pytest/resources/test_data/test_data.py +25 -0
  445. package/.claude/skills/selenium/templates/python-pytest/setup/__init__.py +1 -0
  446. package/.claude/skills/selenium/templates/python-pytest/setup/auth.py +60 -0
  447. package/.claude/skills/selenium/templates/python-pytest/src/__init__.py +1 -0
  448. package/.claude/skills/selenium/templates/python-pytest/src/config/__init__.py +1 -0
  449. package/.claude/skills/selenium/templates/python-pytest/src/config/env.py +68 -0
  450. package/.claude/skills/selenium/templates/python-pytest/src/config/flags.py +40 -0
  451. package/.claude/skills/selenium/templates/python-pytest/src/config/load_env.py +16 -0
  452. package/.claude/skills/selenium/templates/python-pytest/src/config/paths.py +25 -0
  453. package/.claude/skills/selenium/templates/python-pytest/src/driver/__init__.py +1 -0
  454. package/.claude/skills/selenium/templates/python-pytest/{framework → src/driver}/driver_factory.py +11 -18
  455. package/.claude/skills/selenium/templates/python-pytest/{framework → src/driver}/driver_manager.py +3 -3
  456. package/.claude/skills/selenium/templates/python-pytest/src/services/__init__.py +1 -0
  457. package/.claude/skills/selenium/templates/python-pytest/src/services/api_client.py +89 -0
  458. package/.claude/skills/selenium/templates/python-pytest/tests/api/test_session.py +11 -0
  459. package/.claude/skills/selenium/templates/python-pytest/tests/ui/test_sign_in.py +34 -0
  460. package/.claude/skills/selenium/templates/python-pytest/tests/unit/test_utils.py +32 -0
  461. package/.claude/skills/selenium/templates/python-pytest/utils/__init__.py +1 -0
  462. package/.claude/skills/selenium/templates/python-pytest/utils/dates.py +23 -0
  463. package/.claude/skills/selenium/templates/python-pytest/utils/errors.py +28 -0
  464. package/.claude/skills/selenium/templates/python-pytest/utils/form_fill.py +29 -0
  465. package/.claude/skills/selenium/templates/python-pytest/utils/logger.py +40 -0
  466. package/.claude/skills/selenium/templates/python-pytest/utils/markers.py +6 -0
  467. package/.claude/skills/selenium/templates/python-pytest/utils/random_data.py +35 -0
  468. package/.claude/skills/selenium/templates/python-pytest/utils/redact.py +30 -0
  469. package/.claude/skills/selenium/templates/python-pytest/utils/titles.py +53 -0
  470. package/.claude/skills/self-healing/SKILL.md +2 -2
  471. package/.claude/skills/test-design/SKILL.md +1 -1
  472. package/.claude/skills/test-reporting/references/tool-mapping.md +13 -9
  473. package/.claude/skills/ui-observation/SKILL.md +8 -6
  474. package/.claude/skills/ui-observation/references/login-methods.md +1 -1
  475. package/.claude-plugin/plugin.json +15 -2
  476. package/.codex/agents/automation-strategist.toml +1 -0
  477. package/.codex/agents/change-agent.toml +1 -0
  478. package/.codex/agents/codebase-analyst.toml +1 -0
  479. package/.codex/agents/environment-discovery.toml +1 -0
  480. package/.codex/agents/evidence-validator.toml +1 -0
  481. package/.codex/agents/executor.toml +1 -0
  482. package/.codex/agents/failure-analyst.toml +1 -0
  483. package/.codex/agents/implementer.toml +2 -1
  484. package/.codex/agents/requirement-analyst.toml +1 -0
  485. package/.codex/agents/reviewer.toml +1 -0
  486. package/.codex/agents/test-reporter.toml +1 -0
  487. package/.codex/hooks.json +15 -0
  488. package/.cursor/commands/orion.md +1 -1
  489. package/.cursor/hooks.json +10 -0
  490. package/.devin/hooks.v1.json +13 -0
  491. package/.gemini/agents/automation-strategist.md +1 -0
  492. package/.gemini/agents/change-agent.md +1 -0
  493. package/.gemini/agents/codebase-analyst.md +1 -0
  494. package/.gemini/agents/environment-discovery.md +1 -0
  495. package/.gemini/agents/evidence-validator.md +1 -0
  496. package/.gemini/agents/executor.md +1 -0
  497. package/.gemini/agents/failure-analyst.md +1 -0
  498. package/.gemini/agents/implementer.md +2 -1
  499. package/.gemini/agents/requirement-analyst.md +1 -0
  500. package/.gemini/agents/reviewer.md +1 -0
  501. package/.gemini/agents/test-reporter.md +1 -0
  502. package/.gemini/commands/orion.toml +2 -2
  503. package/.github/hooks/orion-lean.json +13 -0
  504. package/.github/prompts/orion.prompt.md +2 -2
  505. package/.windsurf/workflows/orion.md +2 -2
  506. package/AGENTS.md +6 -6
  507. package/README.md +55 -140
  508. package/assets/architecture.svg +104 -0
  509. package/assets/run-flow.svg +1 -1
  510. package/bin/orion.mjs +6 -6
  511. package/hosts/gemini-extension/gemini-extension.json +1 -1
  512. package/hosts/gemini-extension/hooks/hooks.json +16 -0
  513. package/hosts/gemini-extension/policies/platform.toml +5 -0
  514. package/package.json +6 -1
  515. package/.claude/skills/appium/templates/project-java/src/test/java/automation/data/Cases.java +0 -37
  516. package/.claude/skills/appium/templates/project-java/src/test/java/automation/data/SignInData.java +0 -25
  517. package/.claude/skills/appium/templates/project-java/src/test/java/automation/flows/SignInFlow.java +0 -34
  518. package/.claude/skills/appium/templates/project-java/src/test/java/automation/framework/Account.java +0 -19
  519. package/.claude/skills/appium/templates/project-java/src/test/java/automation/screens/HomeScreen.java +0 -36
  520. package/.claude/skills/appium/templates/project-java/src/test/java/automation/screens/LoginScreen.java +0 -57
  521. package/.claude/skills/appium/templates/project-java/src/test/java/automation/tests/BaseTest.java +0 -33
  522. package/.claude/skills/appium/templates/project-java/src/test/java/automation/tests/SmokeTest.java +0 -17
  523. package/.claude/skills/httpclient/templates/csharp-nunit/Api/ApiClient.cs +0 -61
  524. package/.claude/skills/httpclient/templates/csharp-nunit/Api/ApiConfig.cs +0 -61
  525. package/.claude/skills/httpclient/templates/csharp-nunit/Api/ApiError.cs +0 -17
  526. package/.claude/skills/httpclient/templates/csharp-nunit/Data/Cases.cs +0 -41
  527. package/.claude/skills/httpclient/templates/csharp-nunit/Data/HealthData.cs +0 -11
  528. package/.claude/skills/httpclient/templates/csharp-nunit/Data/ProductBuilder.cs +0 -16
  529. package/.claude/skills/httpclient/templates/csharp-nunit/Data/ProductsData.cs +0 -17
  530. package/.claude/skills/httpclient/templates/csharp-nunit/Tests/HealthTests.cs +0 -18
  531. package/.claude/skills/httpclient/templates/csharp-nunit/Tests/ProductsTests.cs +0 -48
  532. package/.claude/skills/k6/templates/project/data/builders.js +0 -8
  533. package/.claude/skills/karate/templates/java-junit5/src/test/java/api/products.feature +0 -33
  534. package/.claude/skills/pact/templates/project/test/contract/products.contract.test.js +0 -45
  535. package/.claude/skills/playwright/templates/dotnet/Components/AccountMenu.cs +0 -23
  536. package/.claude/skills/playwright/templates/dotnet/Data/Cases.cs +0 -43
  537. package/.claude/skills/playwright/templates/dotnet/Data/SignInData.cs +0 -24
  538. package/.claude/skills/playwright/templates/dotnet/Flows/SignInFlow.cs +0 -51
  539. package/.claude/skills/playwright/templates/dotnet/Framework/AutomationError.cs +0 -17
  540. package/.claude/skills/playwright/templates/dotnet/Framework/Config.cs +0 -91
  541. package/.claude/skills/playwright/templates/dotnet/Pages/BasePage.cs +0 -57
  542. package/.claude/skills/playwright/templates/dotnet/Pages/HomePage.cs +0 -26
  543. package/.claude/skills/playwright/templates/dotnet/Pages/LoginPage.cs +0 -45
  544. package/.claude/skills/playwright/templates/dotnet/Tests/SmokeTests.cs +0 -47
  545. package/.claude/skills/playwright/templates/javascript/src/components/account-menu.component.js +0 -30
  546. package/.claude/skills/playwright/templates/javascript/src/config.js +0 -53
  547. package/.claude/skills/playwright/templates/javascript/src/data/accounts.js +0 -23
  548. package/.claude/skills/playwright/templates/javascript/src/data/cases.js +0 -49
  549. package/.claude/skills/playwright/templates/javascript/src/data/sign-in.data.js +0 -12
  550. package/.claude/skills/playwright/templates/javascript/src/flows/sign-in.flow.js +0 -53
  551. package/.claude/skills/playwright/templates/javascript/src/pages/base.page.js +0 -59
  552. package/.claude/skills/playwright/templates/javascript/src/pages/home.page.js +0 -31
  553. package/.claude/skills/playwright/templates/javascript/src/pages/login.page.js +0 -56
  554. package/.claude/skills/playwright/templates/javascript/tests/fixtures.js +0 -20
  555. package/.claude/skills/playwright/templates/javascript/tests/smoke.spec.js +0 -22
  556. package/.claude/skills/playwright/templates/project/src/components/account-menu.component.ts +0 -27
  557. package/.claude/skills/playwright/templates/project/src/config.ts +0 -56
  558. package/.claude/skills/playwright/templates/project/src/data/accounts.ts +0 -21
  559. package/.claude/skills/playwright/templates/project/src/data/cases.ts +0 -55
  560. package/.claude/skills/playwright/templates/project/src/data/sign-in.data.ts +0 -10
  561. package/.claude/skills/playwright/templates/project/src/flows/sign-in.flow.ts +0 -51
  562. package/.claude/skills/playwright/templates/project/src/pages/base.page.ts +0 -52
  563. package/.claude/skills/playwright/templates/project/src/pages/home.page.ts +0 -30
  564. package/.claude/skills/playwright/templates/project/src/pages/login.page.ts +0 -53
  565. package/.claude/skills/playwright/templates/project/tests/fixtures.ts +0 -25
  566. package/.claude/skills/playwright/templates/project/tests/smoke.spec.ts +0 -22
  567. package/.claude/skills/playwright/templates/python/components/__init__.py +0 -1
  568. package/.claude/skills/playwright/templates/python/components/account_menu.py +0 -22
  569. package/.claude/skills/playwright/templates/python/data/accounts.py +0 -14
  570. package/.claude/skills/playwright/templates/python/data/cases.py +0 -33
  571. package/.claude/skills/playwright/templates/python/data/sign_in_data.py +0 -9
  572. package/.claude/skills/playwright/templates/python/flows/sign_in.py +0 -63
  573. package/.claude/skills/playwright/templates/python/framework/config.py +0 -86
  574. package/.claude/skills/playwright/templates/python/pages/base_page.py +0 -51
  575. package/.claude/skills/playwright/templates/python/pages/home_page.py +0 -21
  576. package/.claude/skills/playwright/templates/python/pages/login_page.py +0 -40
  577. package/.claude/skills/playwright/templates/python/tests/test_smoke.py +0 -26
  578. package/.claude/skills/quality-checks/templates/playwright-ts/src/pages/scanned.page.ts +0 -16
  579. package/.claude/skills/quality-checks/templates/playwright-ts/tests/quality.spec.ts +0 -58
  580. package/.claude/skills/requests/templates/python-pytest/api/config.py +0 -43
  581. package/.claude/skills/requests/templates/python-pytest/api/errors.py +0 -15
  582. package/.claude/skills/requests/templates/python-pytest/data/builders.py +0 -16
  583. package/.claude/skills/requests/templates/python-pytest/data/cases.py +0 -30
  584. package/.claude/skills/requests/templates/python-pytest/data/health_data.py +0 -6
  585. package/.claude/skills/requests/templates/python-pytest/data/products_data.py +0 -10
  586. package/.claude/skills/requests/templates/python-pytest/tests/test_health.py +0 -12
  587. package/.claude/skills/requests/templates/python-pytest/tests/test_products.py +0 -25
  588. package/.claude/skills/rest-assured/templates/java-testng/src/test/java/automation/api/ApiError.java +0 -18
  589. package/.claude/skills/rest-assured/templates/java-testng/src/test/java/automation/api/ApiSpec.java +0 -29
  590. package/.claude/skills/rest-assured/templates/java-testng/src/test/java/automation/api/HealthApi.java +0 -21
  591. package/.claude/skills/rest-assured/templates/java-testng/src/test/java/automation/data/Cases.java +0 -45
  592. package/.claude/skills/rest-assured/templates/java-testng/src/test/java/automation/data/HealthData.java +0 -12
  593. package/.claude/skills/rest-assured/templates/java-testng/src/test/java/automation/data/ProductsData.java +0 -16
  594. package/.claude/skills/rest-assured/templates/java-testng/src/test/java/automation/tests/HealthTest.java +0 -15
  595. package/.claude/skills/rest-assured/templates/java-testng/src/test/java/automation/tests/ProductsTest.java +0 -37
  596. package/.claude/skills/selenium/templates/csharp-nunit/Components/AccountMenu.cs +0 -26
  597. package/.claude/skills/selenium/templates/csharp-nunit/Data/Cases.cs +0 -43
  598. package/.claude/skills/selenium/templates/csharp-nunit/Data/SignInData.cs +0 -24
  599. package/.claude/skills/selenium/templates/csharp-nunit/Flows/SignInFlow.cs +0 -51
  600. package/.claude/skills/selenium/templates/csharp-nunit/Framework/AutomationError.cs +0 -17
  601. package/.claude/skills/selenium/templates/csharp-nunit/Framework/DriverManager.cs +0 -26
  602. package/.claude/skills/selenium/templates/csharp-nunit/Pages/HomePage.cs +0 -28
  603. package/.claude/skills/selenium/templates/csharp-nunit/Pages/LoginPage.cs +0 -58
  604. package/.claude/skills/selenium/templates/csharp-nunit/Tests/BaseTest.cs +0 -22
  605. package/.claude/skills/selenium/templates/csharp-nunit/Tests/SmokeTests.cs +0 -37
  606. package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/components/AccountMenu.java +0 -37
  607. package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/data/Cases.java +0 -48
  608. package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/data/SignInData.java +0 -36
  609. package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/flows/SignInFlow.java +0 -60
  610. package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/framework/Account.java +0 -19
  611. package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/pages/HomePage.java +0 -45
  612. package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/pages/LoginPage.java +0 -78
  613. package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/tests/BaseTest.java +0 -33
  614. package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/tests/SmokeTest.java +0 -33
  615. package/.claude/skills/selenium/templates/python-pytest/components/__init__.py +0 -1
  616. package/.claude/skills/selenium/templates/python-pytest/components/account_menu.py +0 -19
  617. package/.claude/skills/selenium/templates/python-pytest/data/accounts.py +0 -14
  618. package/.claude/skills/selenium/templates/python-pytest/data/cases.py +0 -33
  619. package/.claude/skills/selenium/templates/python-pytest/data/sign_in_data.py +0 -9
  620. package/.claude/skills/selenium/templates/python-pytest/flows/__init__.py +0 -0
  621. package/.claude/skills/selenium/templates/python-pytest/flows/sign_in.py +0 -61
  622. package/.claude/skills/selenium/templates/python-pytest/framework/__init__.py +0 -0
  623. package/.claude/skills/selenium/templates/python-pytest/framework/config.py +0 -90
  624. package/.claude/skills/selenium/templates/python-pytest/pages/__init__.py +0 -0
  625. package/.claude/skills/selenium/templates/python-pytest/pages/home_page.py +0 -23
  626. package/.claude/skills/selenium/templates/python-pytest/tests/test_smoke.py +0 -25
  627. /package/.claude/skills/karate/templates/java-junit5/src/test/java/{api → tests/api}/delete-product.feature +0 -0
  628. /package/.claude/skills/playwright/templates/{python/data/__init__.py → dotnet/auth/.gitkeep} +0 -0
  629. /package/.claude/skills/playwright/templates/{python/flows/__init__.py → javascript/auth/.gitkeep} +0 -0
  630. /package/.claude/skills/playwright/templates/{python/framework/__init__.py → project/auth/.gitkeep} +0 -0
  631. /package/.claude/skills/playwright/templates/project/{src → utils}/errors.ts +0 -0
  632. /package/.claude/skills/playwright/templates/python/{pages/__init__.py → auth/.gitkeep} +0 -0
  633. /package/.claude/skills/quality-checks/templates/playwright-ts/src/checks/{page-health.ts → pageHealth.ts} +0 -0
  634. /package/.claude/skills/quality-checks/templates/playwright-ts/src/{api/graphql.ts → services/graphqlClient.ts} +0 -0
  635. /package/.claude/skills/{requests/templates/python-pytest/api/__init__.py → selenium/templates/csharp-nunit/auth/.gitkeep} +0 -0
  636. /package/.claude/skills/{requests/templates/python-pytest/data/__init__.py → selenium/templates/java-testng/auth/.gitkeep} +0 -0
  637. /package/.claude/skills/selenium/templates/python-pytest/{data/__init__.py → auth/.gitkeep} +0 -0
@@ -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,92 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Rules digest: prints only the section of a skill or reference file that a step needs, instead of the whole file.
4
+ * In measured runs the agent's largest tool output was Orion's own rule files dumped whole (`conversation.md`,
5
+ * `setup-card.md`, 9–24 KB per read) and then re-read on every later turn (evals/workflows/runs/2026-11-18-cost-
6
+ * breakdown.md). Orion's own version of the "knowledge graph instead of whole files" idea, for its rules.
7
+ *
8
+ * Usage (from the workspace root; a plugin install: run it from the skill's own folder):
9
+ * node .claude/skills/orion/scripts/rules.mjs <file> --list the sections, each with its size
10
+ * node .claude/skills/orion/scripts/rules.mjs <file> <words>... the section(s) whose title holds all the words
11
+ * node .claude/skills/orion/scripts/rules.mjs <file> --all the whole file (only when you need all of it)
12
+ * <file>: a path, or a short name looked up under .claude/skills/ (`conversation`, `setup-card`, `orion/SKILL`,
13
+ * `execution/SKILL`, `delivery-formats`, …).
14
+ * Sections are the Markdown headings (##, ###) and the top-level numbered items of a list (`3.`, `3b.`, `10.`), whose
15
+ * title is their bold text. Fenced code blocks inside a section stay with it. Output is capped at 8 KB unless --all.
16
+ * Exit code: 0 printed · 1 no section matched (the list is printed instead) · 2 wrong arguments or no such file.
17
+ */
18
+ import fs from 'node:fs';
19
+ import path from 'node:path';
20
+ import { fileURLToPath, pathToFileURL } from 'node:url';
21
+
22
+ const CAP = 8 * 1024;
23
+
24
+ function resolve(name) {
25
+ if (fs.existsSync(name) && fs.statSync(name).isFile()) return name;
26
+ const roots = ['.claude/skills', path.join(path.dirname(fileURLToPath(import.meta.url)), '..', '..')];
27
+ for (const root of roots) {
28
+ if (!fs.existsSync(root)) continue;
29
+ const want = name.replace(/\.md$/, '').toLowerCase();
30
+ const hits = [];
31
+ const walk = (d) => {
32
+ for (const e of fs.readdirSync(d, { withFileTypes: true })) {
33
+ const p = path.join(d, e.name);
34
+ if (e.isDirectory()) { if (!['templates', 'node_modules', 'scripts'].includes(e.name)) walk(p); }
35
+ else if (e.name.endsWith('.md')) {
36
+ const rel = p.replace(/\\/g, '/').toLowerCase().replace(/\.md$/, '');
37
+ if (rel.endsWith(`/${want}`)) hits.push(p);
38
+ }
39
+ }
40
+ };
41
+ walk(root);
42
+ if (hits.length === 1) return hits[0];
43
+ if (hits.length > 1) { console.log(`rules: "${name}" is ambiguous: ${hits.join(', ')}`); process.exit(2); }
44
+ }
45
+ return null;
46
+ }
47
+
48
+ /** Sections of a Markdown file: headings and top-level numbered items, with their line ranges. */
49
+ export function sections(text) {
50
+ const lines = text.split('\n');
51
+ const starts = [];
52
+ let fence = false;
53
+ lines.forEach((l, i) => {
54
+ if (/^\s*(```|~~~)/.test(l)) fence = !fence;
55
+ if (fence) return;
56
+ const h = l.match(/^(#{2,4})\s+(.*)/);
57
+ const n = l.match(/^(\d+[a-z]?)\.\s+(?:\*\*(.+?)\*\*)?(.*)/);
58
+ if (h) starts.push({ line: i, level: h[1].length, title: h[2].trim() });
59
+ else if (n) starts.push({ line: i, level: 9, title: `${n[1]}. ${(n[2] || n[3]).trim().slice(0, 90)}` });
60
+ });
61
+ return starts.map((s, k) => {
62
+ let end = lines.length;
63
+ for (let j = k + 1; j < starts.length; j++) {
64
+ if (starts[j].level <= s.level || (s.level === 9 && starts[j].level === 9) || (s.level < 9 && starts[j].level < 9 && starts[j].level <= s.level)) { end = starts[j].line; break; }
65
+ }
66
+ const body = lines.slice(s.line, end).join('\n').replace(/\s+$/, '');
67
+ return { title: s.title, start: s.line + 1, bytes: Buffer.byteLength(body), body };
68
+ });
69
+ }
70
+
71
+ function main() {
72
+ const [name, ...rest] = process.argv.slice(2);
73
+ if (!name) { console.log('usage: node .claude/skills/orion/scripts/rules.mjs <file> (--list | --all | <words>...)'); process.exit(2); }
74
+ const file = resolve(name);
75
+ if (!file) { console.log(`rules: no such file: ${name}`); process.exit(2); }
76
+ const text = fs.readFileSync(file, 'utf8');
77
+ if (rest[0] === '--all') { process.stdout.write(text); return; }
78
+ const secs = sections(text);
79
+ const list = () => {
80
+ console.log(`${file} · ${Buffer.byteLength(text)} bytes · ${secs.length} sections (read one with: rules.mjs ${name} <words from its title>)`);
81
+ for (const s of secs) console.log(` ${String(s.start).padStart(4)} ${(s.bytes / 1024).toFixed(1).padStart(5)} KB ${s.title}`);
82
+ };
83
+ if (!rest.length || rest[0] === '--list') { list(); return; }
84
+ const words = rest.join(' ').toLowerCase().split(/\s+/).filter(Boolean);
85
+ const hits = secs.filter((s) => words.every((w) => s.title.toLowerCase().includes(w)));
86
+ if (!hits.length) { console.log(`rules: no section of ${file} has "${rest.join(' ')}" in its title`); list(); process.exit(1); }
87
+ let out = hits.map((s) => `<!-- ${file}:${s.start} · ${s.title} -->\n${s.body}`).join('\n\n');
88
+ if (Buffer.byteLength(out) > CAP) out = `${out.slice(0, CAP)}\n… cut at 8 KB: narrow the words, or use --all`;
89
+ console.log(out);
90
+ }
91
+
92
+ if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) main();
@@ -0,0 +1,238 @@
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
+ * Read-only (nothing is written; use them alone, not with `+`):
24
+ * status where the run stands, for a run cut off or picked up in a new session:
25
+ * each gate's state, the first gate not ✓ (the loop's next step), the
26
+ * gates already passed (not redone unless their inputs changed), the Run
27
+ * state lines and the last 3 log rows. Exit 0 open · 4 COMPLETE (gate 8 ✓)
28
+ * budget [--usage <usage.json>] minutes since the run started (and est. USD from usage_report.mjs's
29
+ * totals.usd_est, Claude Code only; else "unknown") against the run budget
30
+ * in project-context/retry-policy.md ("Run budget"; defaults 60 min, USD 10).
31
+ * Minutes are wall time since the run started, waits for the user included.
32
+ * Exit 0 within · 3 over (ask the user at the next gate: carry on or stop)
33
+ * Output: one line per action. Exit code: 0 done · 1 the run file or a row wasn't found · 2 wrong arguments.
34
+ * Never writes secrets: refuses a value that looks like `password=…`, a bearer token or a JWT.
35
+ */
36
+ import fs from 'node:fs';
37
+ import path from 'node:path';
38
+ import { fileURLToPath } from 'node:url';
39
+ import { insideWorkspace } from './lib/inside.mjs';
40
+
41
+ const HERE = path.dirname(fileURLToPath(import.meta.url));
42
+ const TEMPLATE = path.join(HERE, '..', 'templates', 'project-context', 'run.md');
43
+ const BOARD = { 1: ['Requirement'], 2: ['Environment'], 3: ['Codebase'], 4: ['Strategy'], 5: ['Implementation', 'Review'],
44
+ 6: ['Execution'], 7: ['Evidence'], 8: ['Final'] };
45
+ const STATE_KEYS = ['stack', 'ui_map', 'design', 'build', 'run', 'heals'];
46
+
47
+ const pad = (n) => String(n).padStart(2, '0');
48
+ function now() {
49
+ const d = new Date();
50
+ return { hm: `${pad(d.getHours())}:${pad(d.getMinutes())}`, id: `${d.getFullYear()}${pad(d.getMonth() + 1)}${pad(d.getDate())}-${pad(d.getHours())}${pad(d.getMinutes())}`,
51
+ iso: `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}T${pad(d.getHours())}:${pad(d.getMinutes())}` };
52
+ }
53
+ function die(code, msg) { console.log(msg); process.exit(code); }
54
+ const cell = (s) => String(s).replace(/\|/g, '/').replace(/\n/g, ' ').trim();
55
+ function noSecret(s) {
56
+ 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)) {
57
+ die(2, `refused: the value looks like it holds a secret (AGENTS.md rule 5): ${s.slice(0, 40)}…`);
58
+ }
59
+ return s;
60
+ }
61
+
62
+ function init(argv) {
63
+ const key = argv[0];
64
+ const opt = {};
65
+ for (let i = 1; i < argv.length; i += 2) opt[argv[i].replace(/^--/, '')] = argv[i + 1];
66
+ if (!key || !/^[\w.-]+$/.test(key) || !opt.requirement) die(2, 'usage: run_state.mjs init <key> --requirement "<text>" --workflow <workflow>');
67
+ const t = now();
68
+ const dir = path.join('project-context', 'runs');
69
+ fs.mkdirSync(dir, { recursive: true });
70
+ const file = path.join(dir, `R-${t.id}-${key}.md`);
71
+ if (fs.existsSync(file)) die(1, `exists: ${file}`);
72
+ let text = fs.readFileSync(TEMPLATE, 'utf8')
73
+ .replace('# Run R-<YYYYMMDD>-<HHMM>-<key>', `# Run R-${t.id}-${key}`)
74
+ .replace(/^requirement: .*$/m, `requirement: ${cell(noSecret(opt.requirement))} · started ${t.iso} · workflow: ${opt.workflow || 'new'}`)
75
+ .replace('started: <ISO>', `started: ${t.iso}`);
76
+ fs.writeFileSync(file, text);
77
+ const hist = path.join('project-context', 'execution-history.md');
78
+ 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`);
79
+ console.log(file);
80
+ }
81
+
82
+ /** Rewrite the board line(s) from the gate table's State column. */
83
+ function syncBoard(lines) {
84
+ const states = {};
85
+ for (const l of lines) { const m = l.match(/^\| ([1-8]) \| (\S+) \|/); if (m) states[m[1]] = m[2]; }
86
+ return lines.map((l) => (/^(Requirement|Review) /.test(l)
87
+ ? l.replace(/(Requirement|Environment|Codebase|Strategy|Implementation|Review|Execution|Evidence|Final) (\S+)/g, (all, label) => {
88
+ const gate = Object.keys(BOARD).find((g) => BOARD[g].includes(label));
89
+ return `${label} ${states[gate] || '○'}`;
90
+ }) : l));
91
+ }
92
+
93
+ function apply(lines, act, t) {
94
+ const [verb, ...a] = act;
95
+ const gateRow = (g) => lines.findIndex((l) => new RegExp(`^\\| ${g} \\|`).test(l));
96
+ if (verb === 'gate') {
97
+ const [g, what, ...rest] = a;
98
+ const i = gateRow(g);
99
+ if (i < 0 || !/^[1-8]$/.test(g)) die(1, `no gate row ${g}`);
100
+ const c = lines[i].split('|').map((x) => x.trim());
101
+ // c: ['', gate, state, agent, task, start, end, status, retries, '']
102
+ if (what === 'start') { c[2] = '▶'; c[4] = cell(noSecret(rest.join(' ') || c[4])); c[5] = t.hm; c[6] = ''; }
103
+ 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(' '))); }
104
+ else die(2, `gate ${g} start|end`);
105
+ lines[i] = `| ${c.slice(1, -1).join(' | ')} |`;
106
+ lines = syncBoard(lines);
107
+ console.log(`gate ${g} ${what} at ${t.hm}`);
108
+ } else if (verb === 'retry') {
109
+ const i = gateRow(a[0]);
110
+ if (i < 0) die(1, `no gate row ${a[0]}`);
111
+ const c = lines[i].split('|').map((x) => x.trim());
112
+ c[8] = String((parseInt(c[8], 10) || 0) + 1);
113
+ lines[i] = `| ${c.slice(1, -1).join(' | ')} |`;
114
+ console.log(`gate ${a[0]} retries ${c[8]}`);
115
+ } else if (verb === 'log') {
116
+ if (a.length < 6) die(2, 'log <task> <agent> <decision> <status> <failure_class> <accepted> ["<note>"]');
117
+ a.forEach(noSecret);
118
+ const [task, agent, decision, status, fc, accepted, ...note] = a;
119
+ const row = `| ${t.hm} | ${cell(noSecret([task, ...note].join(' ')))} | ${cell(agent)} | ${cell(decision)} | ${cell(status)} | ${cell(fc)} | ${cell(accepted)} |`;
120
+ let i = lines.findIndex((l) => /^### Log/.test(l));
121
+ if (i < 0) die(1, 'no ### Log section');
122
+ i += 3; // heading, header row, separator
123
+ while (i < lines.length && lines[i].startsWith('|')) i++;
124
+ lines.splice(i, 0, row);
125
+ console.log(`log ${task} ${decision}`);
126
+ } else if (verb === 'state') {
127
+ const [k, ...v] = a;
128
+ const value = cell(noSecret(v.join(' ')));
129
+ if (k === 'code') {
130
+ const i = lines.findIndex((l) => /^code: /.test(l));
131
+ if (i < 0) die(1, 'no code line');
132
+ lines[i] = `code: ${value}`;
133
+ } else {
134
+ if (!STATE_KEYS.includes(k)) die(2, `state takes ${STATE_KEYS.join(', ')} or code`);
135
+ const i = lines.findIndex((l) => l.startsWith(`- ${k}: `));
136
+ if (i < 0) die(1, `no Run state line for ${k}`);
137
+ lines[i] = `- ${k}: ${value}`;
138
+ }
139
+ console.log(`state ${k}`);
140
+ } else if (verb === 'metric') {
141
+ const i = lines.findIndex((l) => /^platform: /.test(l));
142
+ if (i < 0) die(1, 'no Metrics line');
143
+ let m = lines[i];
144
+ for (const pair of a) {
145
+ const eq = pair.indexOf('=');
146
+ if (eq < 1) die(2, `metric takes name=value, got ${pair}`);
147
+ const name = pair.slice(0, eq); let val = noSecret(pair.slice(eq + 1));
148
+ if (name === 'stopped' && val === 'now') val = t.iso;
149
+ const rx = new RegExp(`(^|· )${name.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}: ([^·]*?)( ·|$)`);
150
+ const cur = m.match(rx);
151
+ if (!cur) { m = `${m} · ${name}: ${val}`; continue; }
152
+ if (/^\+\d+$/.test(val)) val = String((parseInt(cur[2], 10) || 0) + parseInt(val.slice(1), 10));
153
+ m = m.replace(rx, (all, pre, _old, post) => `${pre}${name}: ${val}${post}`);
154
+ }
155
+ 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)/);
156
+ if (st && sp && a.some((p) => p.startsWith('stopped='))) {
157
+ const mins = Math.round((Date.parse(sp[1]) - Date.parse(st[1])) / 60000);
158
+ m = m.replace(/wall time: [^·]*?( ·|$)/, (all, post) => `wall time: ${mins} min${post}`);
159
+ }
160
+ lines[i] = m;
161
+ console.log(`metrics ${a.map((p) => p.split('=')[0]).join(', ')}`);
162
+ } else die(2, `unknown action ${verb}`);
163
+ return lines;
164
+ }
165
+
166
+ /** `status`: where a run stands, so a new session continues it instead of starting over. */
167
+ function status(file, lines) {
168
+ const gates = [];
169
+ for (const l of lines) {
170
+ const m = l.match(/^\| ([1-8]) \| (\S+) \| ([^|]*)\| ([^|]*)\| ([^|]*)\| ([^|]*)\| ([^|]*)\|/);
171
+ if (m) gates.push({ gate: +m[1], state: m[2], agent: m[3].trim(), task: m[4].trim(), status: m[7].trim() });
172
+ }
173
+ if (gates.length !== 8) die(1, `${file}: expected 8 gate rows, found ${gates.length}`);
174
+ const req = (lines.find((l) => /^requirement: /.test(l)) || '').slice(13);
175
+ console.log(`run: ${path.basename(file, '.md')} · ${req}`);
176
+ console.log(`gates: ${gates.map((g) => `${g.gate} ${g.state}`).join(' ')}`);
177
+ const done = gates.filter((g) => g.state === '✓').map((g) => g.gate);
178
+ const next = gates.find((g) => g.state !== '✓');
179
+ if (!next) { console.log('state: COMPLETE (gate 8 ✓): nothing to resume'); process.exit(4); }
180
+ console.log(`passed: ${done.length ? done.join(', ') : 'none'} (not redone unless the requirement, the code or the app changed since)`);
181
+ console.log(`next: gate ${next.gate} (${next.state}${next.task ? `, task: ${next.task}` : ''}${next.status ? `, last status: ${next.status}` : ''}) · ${next.agent}`);
182
+ for (const l of lines.filter((x) => /^- (stack|ui_map|design|build|run|heals): /.test(x))) {
183
+ console.log(`state ${/<[^>]+>/.test(l) ? `${l.slice(2, l.indexOf(':'))}: not recorded` : l.slice(2)}`);
184
+ }
185
+ const i = lines.findIndex((l) => /^### Log/.test(l));
186
+ const log = i < 0 ? [] : lines.slice(i + 3).filter((l, k, arr) => l.startsWith('|') && arr.slice(0, k).every((x) => x.startsWith('|')));
187
+ for (const l of log.slice(-3)) console.log(`log ${l}`);
188
+ }
189
+
190
+ /** `budget`: minutes (and est. USD where known) against the run budget in retry-policy.md. */
191
+ function budget(file, lines, rest) {
192
+ const req = (lines.find((l) => /^requirement: /.test(l)) || '');
193
+ const st = req.match(/started (\d{4}-\d\d-\d\dT\d\d:\d\d)/);
194
+ if (!st) die(1, `${file}: no start time on the requirement line`);
195
+ const mins = Math.round((Date.now() - new Date(st[1]).getTime()) / 60000);
196
+ const policy = path.join('project-context', 'retry-policy.md');
197
+ const ptext = fs.existsSync(policy) ? fs.readFileSync(policy, 'utf8') : '';
198
+ const limMin = +((ptext.match(/^- minutes:\s*(\d+)/m) || [])[1] || 60);
199
+ const limUsd = +((ptext.match(/^- usd:\s*([\d.]+)/m) || [])[1] || 10);
200
+ let usd = 'unknown';
201
+ const ui = rest.indexOf('--usage');
202
+ if (ui >= 0) {
203
+ const f = rest[ui + 1];
204
+ try { const v = JSON.parse(fs.readFileSync(f, 'utf8')).totals?.usd_est; if (typeof v === 'number') usd = v; } catch { /* stays unknown */ }
205
+ }
206
+ const over = [];
207
+ if (mins > limMin) over.push(`${mins} min of ${limMin}`);
208
+ if (typeof usd === 'number' && usd > limUsd) over.push(`est. USD ${usd.toFixed(2)} of ${limUsd}`);
209
+ console.log(`budget: ${mins} min of ${limMin} (wall time, waits included) · est. USD ${typeof usd === 'number' ? usd.toFixed(2) : 'unknown'} of ${limUsd}${ptext ? '' : ' (defaults: no project-context/retry-policy.md)'}`);
210
+ if (over.length) {
211
+ console.log(`over: ${over.join(', ')}: at the next gate, ask the user one line: carry on (and by how much) or stop here with what exists`);
212
+ process.exit(3);
213
+ }
214
+ }
215
+
216
+ function main() {
217
+ const argv = process.argv.slice(2);
218
+ if (['status', 'budget'].includes(argv[1])) {
219
+ const file = argv[0];
220
+ if (!file || !fs.existsSync(file)) die(file ? 1 : 2, file ? `no run file ${file}` : 'usage: run_state.mjs <run file> status | budget [--usage <usage.json>]');
221
+ insideWorkspace(file, 'the run file');
222
+ const lines = fs.readFileSync(file, 'utf8').split('\n');
223
+ return argv[1] === 'status' ? status(file, lines) : budget(file, lines, argv.slice(2));
224
+ }
225
+ if (argv[0] === 'init') return init(argv.slice(1));
226
+ const file = argv[0];
227
+ if (!file || !fs.existsSync(file)) die(file ? 1 : 2, file ? `no run file ${file}` : 'usage: run_state.mjs <run file> <action> [+ <action> …] | init <key> …');
228
+ insideWorkspace(file, 'the run file');
229
+ const acts = [[]];
230
+ for (const x of argv.slice(1)) { if (x === '+') acts.push([]); else acts[acts.length - 1].push(x); }
231
+ if (!acts[0].length) die(2, 'no action');
232
+ const t = now();
233
+ let lines = fs.readFileSync(file, 'utf8').split('\n');
234
+ for (const act of acts) lines = apply(lines, act, t);
235
+ fs.writeFileSync(file, lines.join('\n'));
236
+ }
237
+
238
+ main();