@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,400 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * The Orion graph: story → acceptance criterion → test case → desc entry → test → page object → screen → result →
4
+ * defect, built by a script from files the run already has (no model call, no tokens). Agents read small slices of it
5
+ * instead of whole maps and suites; the reviewer and Gate 8 use its gap check.
6
+ *
7
+ * Usage (from the workspace root):
8
+ * node .claude/skills/orion/scripts/graph.mjs build [--suite <folder>] [--context project-context]
9
+ * node .claude/skills/orion/scripts/graph.mjs query (--story <KEY> | --page <file or name> | --test <file>) [--max-bytes 8000]
10
+ * node .claude/skills/orion/scripts/graph.mjs check [--story <KEY>]
11
+ * `--suite` defaults to the only `sut/<app>/` folder, else the workspace root. query and check rebuild first when any
12
+ * source file changed since the last build (a sha1 per file in manifest.json), so the graph is never stale.
13
+ *
14
+ * Sources: the suite (lib/scan.mjs: tests, page objects, fixtures and which files each test uses; desc files: case id,
15
+ * AC(s), story, title), project-context/test-designs/<story>/design.md (accepted cases, screens, status),
16
+ * ui-maps/*.md (screen key and page object per row), results/*.json (results_parse.mjs), defects.md.
17
+ * Writes project-context/graph/graph.json (sorted, no timestamps: the same inputs give the same bytes) and
18
+ * manifest.json. Every edge says where it came from and whether it is `confirmed` (an id, import or table row) or
19
+ * `inferred` (a name match).
20
+ * check reports: an AC with no test case, a case with no desc entry, a desc entry no test uses, an automated case with
21
+ * no result, a test linked to no case, a page object with no screen key. Exit code: 0 · 1 gaps (check) or nothing
22
+ * found (query) · 2 wrong arguments.
23
+ */
24
+ import fs from 'node:fs';
25
+ import { insideWorkspace } from './lib/inside.mjs';
26
+ import path from 'node:path';
27
+ import crypto from 'node:crypto';
28
+ import { scan } from './lib/scan.mjs';
29
+
30
+ const FORMAT = 'orion-graph/1';
31
+ const KEY = /\b(?!(?:TS|AC|HL|TC)-)([A-Z][A-Z0-9]+-\d+)\b/;
32
+
33
+ function args() {
34
+ const [cmd, ...rest] = process.argv.slice(2);
35
+ const o = { cmd };
36
+ for (let i = 0; i < rest.length; i++) {
37
+ if (!rest[i].startsWith('--')) usage();
38
+ o[rest[i].slice(2)] = rest[i + 1]; i++;
39
+ }
40
+ if (!['build', 'query', 'check'].includes(cmd)) usage();
41
+ o.context = o.context || 'project-context';
42
+ insideWorkspace(o.context, '--context');
43
+ if (!o.suite) {
44
+ const sut = fs.existsSync('sut') ? fs.readdirSync('sut', { withFileTypes: true }).filter((d) => d.isDirectory()) : [];
45
+ // A suite at the workspace root (an existing framework) wins over a stray sut/<app>/ folder beside it.
46
+ // Only test-runner configs count: an app repo's pom.xml or .sln beside a generated sut/<app>/ is not a suite.
47
+ const rootSuite = ['playwright.config.ts', 'playwright.config.js', 'playwright.config.mjs', 'cypress.config.js', 'cypress.config.ts',
48
+ 'wdio.conf.ts', 'wdio.conf.js', 'testng.xml', 'pytest.ini'].some((f) => fs.existsSync(f));
49
+ o.suite = !rootSuite && sut.length === 1 ? path.join('sut', sut[0].name) : '.';
50
+ }
51
+ return o;
52
+ }
53
+ function usage() {
54
+ console.log('usage: graph.mjs build [--suite DIR] | query (--story KEY | --page NAME | --test FILE) | check [--story KEY]');
55
+ process.exit(2);
56
+ }
57
+
58
+ const read = (f) => { try { return fs.readFileSync(f, 'utf8'); } catch { return null; } };
59
+ const list = (dir, rx) => (fs.existsSync(dir) ? fs.readdirSync(dir, { recursive: true }).map(String).filter((f) => rx.test(f)).map((f) => path.join(dir, f)) : []);
60
+ const rel = (f) => f.split(path.sep).join('/');
61
+
62
+ /** Markdown tables in a file: [{header:[...], rows:[[...]], line}] */
63
+ function tables(text) {
64
+ const out = []; const lines = text.split('\n');
65
+ for (let i = 0; i < lines.length - 1; i++) {
66
+ if (/^\|.*\|\s*$/.test(lines[i]) && /^\|[\s:|-]+\|\s*$/.test(lines[i + 1])) {
67
+ const cells = (l) => l.trim().replace(/^\||\|$/g, '').split('|').map((c) => c.trim());
68
+ const t = { header: cells(lines[i]).map((h) => h.toLowerCase()), rows: [], line: i + 1 };
69
+ let j = i + 2;
70
+ for (; j < lines.length && /^\|/.test(lines[j]); j++) t.rows.push({ cells: cells(lines[j]), line: j + 1 });
71
+ out.push(t); i = j;
72
+ }
73
+ }
74
+ return out;
75
+ }
76
+ const col = (t, rx) => t.header.findIndex((h) => rx.test(h));
77
+
78
+ /** Desc entries in a desc file: id, ACs, story, title, line. */
79
+ function descEntries(text) {
80
+ const lines = text.split('\n'); const starts = [];
81
+ lines.forEach((l, i) => {
82
+ const m = l.match(/(?:^|[\s{(,[])["']((?:TS|CT)-\d+)["']\s*(?:[:,\]]|\)?\s*:)/) || l.match(/new\s+(?:TestDescription|\w*Desc\w*)\(\s*"((?:TS|CT)-\d+)"/)
83
+ || l.match(/^\s*\w+\s*:\s*\{\s*id\s*:\s*['"]((?:TS|CT)-\d+)['"]/) || l.match(/^\s*id\s*:\s*['"]((?:TS|CT)-\d+)['"]/);
84
+ if (m && !starts.some((s) => s.id === m[1])) starts.push({ id: m[1], line: i + 1 });
85
+ });
86
+ return starts.map((s, k) => {
87
+ const body = lines.slice(s.line - 1, k + 1 < starts.length ? starts[k + 1].line - 1 : lines.length).join('\n');
88
+ const acs = [...new Set((body.match(/\bAC-\d+\b/g) || []))];
89
+ const story = (body.match(KEY) || [])[1] || null;
90
+ const title = (body.match(/title\s*[:=]\s*(['"])(.+?)\1/) || body.match(/"TS-\d+",\s*"AC-\d+",\s*"[^"]*",\s*"([^"]+)"/) || [])[2] ?? (body.match(/"TS-\d+",\s*"AC-\d+",\s*"[^"]*",\s*"([^"]+)"/) || [])[1] ?? null;
91
+ return { ...s, acs, story, title };
92
+ });
93
+ }
94
+
95
+ /** Test → case ids, per test function, from the lines that declare the test. */
96
+ function testCases(text, lang) {
97
+ const lines = text.split('\n'); const out = [];
98
+ const vars = {};
99
+ for (const m of text.matchAll(/(?:const|let|var)\s+(\w+)\s*=\s*\w+\[\s*['"](TS-\d+)['"]\s*\]/g)) vars[m[1]] = m[2];
100
+ lines.forEach((l, i) => {
101
+ let m;
102
+ if ((lang === 'js' || lang === 'ts') && (m = l.match(/\b(?:test|it|group)(?:\.(?!describe\b)\w+)?\(\s*(?:(['"`])(.+?)\1|titleOf\((\w+)\))/))) {
103
+ const key = (m[2] || '').match(/\w+\.((?:TS|CT)\d+)\b/);
104
+ const id = m[3] ? vars[m[3]] : key ? key[1].replace(/^(TS|CT)/, '$1-') : (m[2].match(/\b(?:TS|CT)-\d+\b/) || [])[0];
105
+ out.push({ name: m[2] || (id ? `${id} (title from desc)` : m[3]), line: i + 1, ids: id ? [id] : [] });
106
+ } else if (lang === 'py' && (m = l.match(/^\s*(?:async\s+)?def\s+(test_\w+)/))) {
107
+ const above = lines.slice(Math.max(0, i - 3), i).join(' ');
108
+ const ids = (above.match(/\bTS-\d+\b/g) || []).concat((m[1].match(/_ts(\d+)(?:_|$)/) || []).slice(1).map((n) => `TS-${n}`));
109
+ out.push({ name: m[1], line: i + 1, ids: [...new Set(ids)] });
110
+ } else if ((lang === 'java' || lang === 'cs') && (m = l.match(/public\s+(?:async\s+)?(?:void|Task)\s+(\w+)\s*\(/))) {
111
+ const above = lines.slice(Math.max(0, i - 4), i).join(' ');
112
+ if (!/@Test|\[Test|\[Fact|\[TestCase|@Case|\[Case/.test(above)) return;
113
+ out.push({ name: m[1], line: i + 1, ids: [...new Set(above.match(/\bTS-\d+\b/g) || [])] });
114
+ }
115
+ });
116
+ return out;
117
+ }
118
+
119
+ const LANG = (f) => (/\.m?tsx?$/.test(f) ? 'ts' : /\.m?jsx?$/.test(f) ? 'js' : /\.py$/.test(f) ? 'py' : /\.java$/.test(f) ? 'java' : /\.cs$/.test(f) ? 'cs' : null);
120
+
121
+ /** The source files the graph is built from, with their sha1 (the freshness manifest). */
122
+ function sources(o) {
123
+ const s = scan(o.suite);
124
+ const suiteFiles = [...new Set([...s.tests.map((t) => t.file), ...Object.values(s.files).flat(),
125
+ ...list(o.suite, /(^|[\\/])(desc|Desc)[\\/].+\.(m?[jt]s|py|java|cs|json)$/).map((f) => rel(path.relative(o.suite, f)))])]
126
+ .map((f) => rel(path.join(o.suite, f)));
127
+ const ctx = [...list(path.join(o.context, 'assessments'), /(assessment|fix-plan)\.md$/), ...list(path.join(o.context, 'test-designs'), /design\.md$/), ...list(path.join(o.context, 'ui-maps'), /\.md$/),
128
+ ...list(path.join(o.context, 'results'), /\.json$/), ...[path.join(o.context, 'defects.md')].filter((f) => fs.existsSync(f))].map(rel);
129
+ const files = [...new Set([...suiteFiles, ...ctx])].sort();
130
+ const manifest = {};
131
+ // The scripts that build the graph are sources too: an Orion upgrade rebuilds it.
132
+ for (const f of ['graph.mjs', 'lib/scan.mjs']) manifest[`(orion)/${f}`] = crypto.createHash('sha1').update(read(path.join(path.dirname(new URL(import.meta.url).pathname), f)) || '').digest('hex');
133
+ for (const f of files) { const t = read(f); if (t != null) manifest[f] = crypto.createHash('sha1').update(t).digest('hex'); }
134
+ return { scan: s, manifest };
135
+ }
136
+
137
+ function build(o, pre) {
138
+ const { scan: s, manifest } = pre || sources(o);
139
+ const nodes = new Map(); const edges = [];
140
+ const node = (id, type, attrs = {}) => { if (!nodes.has(id)) nodes.set(id, { id, type, ...attrs }); else Object.assign(nodes.get(id), attrs); return id; };
141
+ const edge = (from, to, type, tag, source) => edges.push({ from, to, type, tag, source });
142
+ const at = (f, line) => (line ? `${f}:${line}` : f);
143
+ const sfile = (f) => rel(path.join(o.suite, f));
144
+
145
+ // desc entries → story, AC, case
146
+ const caseIdsByFile = {};
147
+ for (const f of Object.keys(manifest).filter((x) => /(^|\/)(desc|Desc)\//.test(x) && LANG(x))) {
148
+ for (const d of descEntries(read(f))) {
149
+ const story = d.story || 'UNKNOWN';
150
+ const ts = node(`ts:${story}:${d.id}`, 'ts', { key: `${story}:${d.id}`, title: d.title, desc: at(f, d.line) });
151
+ node(`story:${story}`, 'story', { key: story });
152
+ for (const ac of d.acs.length ? d.acs : []) {
153
+ const a = node(`ac:${story}:${ac}`, 'ac', { key: `${story}:${ac}` });
154
+ edge(`story:${story}`, a, 'has', 'confirmed', at(f, d.line));
155
+ edge(a, ts, 'covered_by', 'confirmed', at(f, d.line));
156
+ }
157
+ (caseIdsByFile[f] ||= {})[d.id] = ts;
158
+ }
159
+ }
160
+ const caseById = (id) => Object.values(caseIdsByFile).map((m) => m[id]).filter(Boolean);
161
+
162
+ // design.md → cases (planned too), screens, status
163
+ for (const f of Object.keys(manifest).filter((x) => /design\.md$/.test(x))) {
164
+ const story = (f.match(/test-designs\/([^/]+)\//) || [])[1];
165
+ for (const t of tables(read(f))) {
166
+ const cTs = col(t, /^ts$|test case/); const cAc = col(t, /^ac/); const cSc = col(t, /screen/); const cSt = col(t, /status/);
167
+ if (cTs < 0 && cAc >= 0 && story) { // the acceptance criteria table: every AC, covered or not
168
+ for (const r of t.rows) for (const ac of (r.cells[cAc] || '').match(/AC-\d+/g) || []) {
169
+ edge(node(`story:${story}`, 'story', { key: story }), node(`ac:${story}:${ac}`, 'ac', { key: `${story}:${ac}`, text: r.cells[1] || undefined }), 'has', 'confirmed', at(f, r.line));
170
+ }
171
+ continue;
172
+ }
173
+ if (cTs < 0) continue;
174
+ for (const r of t.rows) {
175
+ const idm = (r.cells[cTs] || '').match(/(?:([A-Z][A-Z0-9]+-\d+):)?(TS-\d+)/);
176
+ if (!idm) continue;
177
+ const key = idm[1] || (r.cells[cTs].match(KEY) || [])[1] || story;
178
+ const ts = node(`ts:${key}:${idm[2]}`, 'ts', { key: `${key}:${idm[2]}`, status: cSt >= 0 ? r.cells[cSt] : undefined, design: at(f, r.line) });
179
+ node(`story:${key}`, 'story', { key });
180
+ for (const ac of (r.cells[cAc] || '').match(/AC-\d+/g) || []) {
181
+ const a = node(`ac:${key}:${ac}`, 'ac', { key: `${key}:${ac}` });
182
+ edge(`story:${key}`, a, 'has', 'confirmed', at(f, r.line));
183
+ edge(a, ts, 'covered_by', 'confirmed', at(f, r.line));
184
+ }
185
+ for (const sc of (cSc >= 0 ? r.cells[cSc] : '').split(/[,;]/).map((x) => x.trim()).filter((x) => x && x !== '—')) {
186
+ edge(ts, node(`screen:${sc}`, 'screen', { key: sc }), 'uses_screen', 'confirmed', at(f, r.line));
187
+ }
188
+ }
189
+ }
190
+ }
191
+
192
+ // tests, and what they use
193
+ const roleOf = {};
194
+ for (const [role, fl] of Object.entries(s.files)) for (const f of fl) roleOf[f] = role;
195
+ for (const t of s.tests) {
196
+ const f = sfile(t.file); const text = read(f) || '';
197
+ const decls = testCases(text, LANG(t.file));
198
+ for (const [k, tc] of decls.entries()) {
199
+ const near = text.split('\n').slice(Math.max(0, tc.line - 4), tc.line + 1).join(' ');
200
+ if (/(^|\/)(tests?\/unit|Tests\/Unit|unit)\//.test(t.file) || /framework check/i.test(near)) continue; // not story cases
201
+ const id = node(`test:${f}#${tc.name}`, 'test', { file: at(f, tc.line), name: tc.name });
202
+ for (const cid of tc.ids) {
203
+ const matches = caseById(cid);
204
+ for (const ts of matches) edge(ts, id, 'implemented_by', 'confirmed', at(f, tc.line));
205
+ if (!matches.length) edge(node(`ts:UNKNOWN:${cid}`, 'ts', { key: `UNKNOWN:${cid}` }), id, 'implemented_by', 'confirmed', at(f, tc.line));
206
+ }
207
+ const window = text.split('\n').slice(tc.line - 1, Math.min(tc.line + 15, k + 1 < decls.length ? decls[k + 1].line - 1 : Infinity)).join('\n').toLowerCase().replace(/_/g, '');
208
+ for (const p of s.files.pages) {
209
+ const stem = path.basename(p).replace(/\.\w+$/, '').toLowerCase().replace(/_/g, '');
210
+ if (!/^base/.test(stem) && new RegExp(`\\b${stem}\\b`).test(window)) edge(id, node(`page:${sfile(p)}`, 'page', { file: sfile(p) }), 'names_page', 'inferred', at(f, tc.line));
211
+ }
212
+ for (const e of s.edges.filter((x) => x.from === t.file)) {
213
+ const type = { page: 'page', fixture: 'fixture', helper: 'helper', service: 'service', data: 'data', config: 'config' }[e.to_role] || 'file';
214
+ edge(id, node(`${type}:${sfile(e.to)}`, type, { file: sfile(e.to) }), 'uses', e.tag, at(f, null));
215
+ }
216
+ }
217
+ }
218
+ // pages a fixture hands to tests (fixture → page), so tests reach pages through fixtures
219
+ for (const e of s.edges.filter((x) => roleOf[x.from] === 'fixtures' && x.to_role === 'page')) {
220
+ edge(node(`fixture:${sfile(e.from)}`, 'fixture', { file: sfile(e.from) }), node(`page:${sfile(e.to)}`, 'page', { file: sfile(e.to) }), 'uses', e.tag, sfile(e.from));
221
+ }
222
+ for (const p of s.files.pages) node(`page:${sfile(p)}`, 'page', { file: sfile(p) });
223
+
224
+ // UI maps → screen ↔ page object
225
+ for (const f of Object.keys(manifest).filter((x) => /ui-maps\/.+\.md$/.test(x))) {
226
+ for (const t of tables(read(f))) {
227
+ const cSc = col(t, /screen key/); const cPo = col(t, /page object/);
228
+ if (cSc < 0) continue;
229
+ for (const r of t.rows) {
230
+ const sc = r.cells[cSc]; if (!sc || sc === '—') continue;
231
+ const scr = node(`screen:${sc}`, 'screen', { key: sc, map: at(f, r.line) });
232
+ const po = cPo >= 0 ? (r.cells[cPo] || '').replace(/^\(Gate 5\)\s*/, '') : '';
233
+ const page = po && [...nodes.values()].find((n) => n.type === 'page' && path.basename(n.file).replace(/\.\w+$/, '').toLowerCase() === po.toLowerCase().replace(/\.\w+$/, ''));
234
+ if (page) edge(page.id, scr, 'models', 'confirmed', at(f, r.line));
235
+ }
236
+ }
237
+ }
238
+
239
+ // results → tests (file + case id or name)
240
+ for (const f of Object.keys(manifest).filter((x) => /results\/.+\.json$/.test(x))) {
241
+ let r; try { r = JSON.parse(read(f)); } catch { continue; }
242
+ for (const t of r.tests || []) {
243
+ const rid = node(`result:${r.run_id}#${t.file}#${t.title}`, 'result', { run: r.run_id, status: t.status, failure_sig: t.failure_sig || undefined, source: f });
244
+ const rfile = t.file.replace(/\\/g, '/').replace(/^\.\//, '');
245
+ const sameFile = (n) => { const f = n.file.split(':')[0]; return f.endsWith(`/${rfile}`) || f === rfile || path.basename(f) === path.basename(rfile) || path.basename(f).replace(/\.\w+$/, '') === rfile.split('.').pop(); };
246
+ const byId = (n) => t.test_id && edges.some((e) => e.to === n.id && e.type === 'implemented_by' && e.from.endsWith(`:${t.test_id}`));
247
+ const target = [...nodes.values()].find((n) => n.type === 'test' && sameFile(n) && (byId(n) || t.title.includes(n.name) || n.name.includes(t.title)));
248
+ if (target) edge(target.id, rid, 'produced', t.test_id ? 'confirmed' : 'inferred', f);
249
+ }
250
+ }
251
+
252
+ // assessments → findings on the files they name; a fixed or reverted state comes from the fix plan next to them
253
+ for (const f of Object.keys(manifest).filter((x) => /assessments\/[^/]+\/assessment\.md$/.test(x))) {
254
+ const aid = f.split('/').slice(-2)[0];
255
+ const plan = read(f.replace(/assessment\.md$/, 'fix-plan.md')) || '';
256
+ const stateOf = {};
257
+ let batch = null;
258
+ for (const l of plan.split('\n')) {
259
+ const b = l.match(/^## Batch \d+ · state: (\w+)/); if (b) batch = b[1];
260
+ const it = l.match(/^- \[([ xX])\] (F-\d+) /); if (it) stateOf[it[2]] = it[1] === ' ' ? 'open' : batch === 'verified' ? 'fixed' : batch === 'reverted' ? 'open (fix reverted)' : 'ticked';
261
+ }
262
+ for (const t of tables(read(f))) {
263
+ const cF = col(t, /^f$/); const cR = col(t, /^rule/); const cS = col(t, /^severity/); const cL = col(t, /^file/);
264
+ if (cF < 0 || cL < 0) continue;
265
+ for (const r of t.rows) {
266
+ const id = r.cells[cF]; if (!/^F-\d+$/.test(id || '')) continue;
267
+ const [file, line] = (r.cells[cL] || '').replace(/`/g, '').split(':');
268
+ const fid = node(`finding:${aid}:${id}`, 'finding', { key: `${aid}:${id}`, rule: r.cells[cR], severity: r.cells[cS], file: `${file}${line ? `:${line}` : ''}`, status: stateOf[id] || 'open' });
269
+ const full = rel(path.join(o.suite, file));
270
+ const target = [...nodes.values()].find((n) => ['page', 'fixture', 'helper', 'service', 'data', 'config', 'file'].includes(n.type) && n.file === full)
271
+ || [...nodes.values()].filter((n) => n.type === 'test' && n.file.split(':')[0] === full && Number(n.file.split(':')[1]) <= Number(line || 1e9))
272
+ .sort((a, b) => Number(b.file.split(':')[1]) - Number(a.file.split(':')[1]))[0];
273
+ edge(target ? target.id : node(`file:${full}`, 'file', { file: full }), fid, 'has_finding', 'confirmed', at(f, r.line));
274
+ }
275
+ }
276
+ }
277
+
278
+ // defects.md → result (by test file and failure signature)
279
+ const dpath = Object.keys(manifest).find((x) => /defects\.md$/.test(x));
280
+ if (dpath) for (const t of tables(read(dpath))) {
281
+ const cId = col(t, /^id$/); const cTest = col(t, /^test \(/); const cCase = col(t, /test case/);
282
+ for (const r of t.rows) {
283
+ const id = r.cells[cId]; if (!id) continue;
284
+ const d = node(`defect:${id}`, 'defect', { key: id, line: at(dpath, r.line) });
285
+ const tc = (r.cells[cCase] || '').match(/(?:([A-Z][A-Z0-9]+-\d+):)?(TS-\d+)/);
286
+ if (tc) for (const ts of caseById(tc[2])) edge(ts, d, 'failed_as', 'confirmed', at(dpath, r.line));
287
+ }
288
+ }
289
+
290
+ const g = { format: FORMAT, suite: rel(o.suite), nodes: [...nodes.values()].sort((a, b) => a.id.localeCompare(b.id)),
291
+ edges: dedupe(edges).sort((a, b) => `${a.from}${a.type}${a.to}`.localeCompare(`${b.from}${b.type}${b.to}`)) };
292
+ const dir = path.join(o.context, 'graph');
293
+ fs.mkdirSync(dir, { recursive: true });
294
+ fs.writeFileSync(path.join(dir, 'graph.json'), `${JSON.stringify(g, null, 1)}\n`);
295
+ fs.writeFileSync(path.join(dir, 'manifest.json'), `${JSON.stringify({ format: FORMAT, suite: rel(o.suite), files: manifest }, null, 1)}\n`);
296
+ const gi = path.join(dir, '.gitignore');
297
+ if (!fs.existsSync(gi)) fs.writeFileSync(gi, '# Derived from the suite and project-context; rebuilt by graph.mjs.\n*\n!.gitignore\n');
298
+ return g;
299
+ }
300
+ function dedupe(edges) { const seen = new Set(); return edges.filter((e) => { const k = `${e.from}|${e.type}|${e.to}`; if (seen.has(k)) return false; seen.add(k); return true; }); }
301
+
302
+ /** The graph, rebuilt first when any source changed since the last build. */
303
+ function fresh(o) {
304
+ const dir = path.join(o.context, 'graph');
305
+ const pre = sources(o);
306
+ let old = null; try { old = JSON.parse(read(path.join(dir, 'manifest.json'))); } catch { /* none yet */ }
307
+ const same = old && old.suite === rel(o.suite) && JSON.stringify(old.files) === JSON.stringify(pre.manifest);
308
+ if (same) { try { return { g: JSON.parse(read(path.join(dir, 'graph.json'))), rebuilt: false }; } catch { /* rebuild */ } }
309
+ return { g: build(o, pre), rebuilt: true };
310
+ }
311
+
312
+ function gaps(g, story) {
313
+ const out = [];
314
+ const from = (id, type) => g.edges.filter((e) => e.from === id && (!type || e.type === type));
315
+ const to = (id, type) => g.edges.filter((e) => e.to === id && (!type || e.type === type));
316
+ const inStory = (n) => !story || (n.key || '').startsWith(`${story}:`) || n.key === story;
317
+ for (const n of g.nodes.filter(inStory)) {
318
+ if (n.type === 'ac' && !from(n.id, 'covered_by').length) out.push(`${n.key}: no test case covers it`);
319
+ if (n.type === 'ts') {
320
+ const automated = from(n.id, 'implemented_by');
321
+ if (!n.desc && !/not automated/i.test(n.status || '')) out.push(`${n.key}: no desc entry${n.design ? ` (design ${n.design})` : ''}`);
322
+ if (n.desc && !automated.length) out.push(`${n.key}: desc entry ${n.desc} is used by no test`);
323
+ if (automated.length && g.nodes.some((x) => x.type === 'result') && !automated.some((e) => from(e.to, 'produced').length)) out.push(`${n.key}: automated but no result recorded`);
324
+ }
325
+ }
326
+ if (!story) {
327
+ for (const n of g.nodes.filter((x) => x.type === 'test')) if (!to(n.id, 'implemented_by').length) out.push(`${n.file}: test ${n.name} is linked to no test case`);
328
+ const hasMaps = g.nodes.some((x) => x.type === 'screen');
329
+ if (hasMaps) for (const n of g.nodes.filter((x) => x.type === 'page' && !/^base/i.test(path.basename(x.file)))) if (!from(n.id, 'models').length) out.push(`${n.file}: page object has no screen key in a UI map`);
330
+ }
331
+ return out;
332
+ }
333
+
334
+ /** A small Markdown slice for one story, page or test; never silently cut. */
335
+ function query(o, g) {
336
+ const by = new Map(g.nodes.map((n) => [n.id, n]));
337
+ const from = (id, type) => g.edges.filter((e) => e.from === id && (!type || e.type === type));
338
+ const to = (id, type) => g.edges.filter((e) => e.to === id && (!type || e.type === type));
339
+ const lines = [];
340
+ if (o.story) {
341
+ const acs = g.nodes.filter((n) => n.type === 'ac' && n.key.startsWith(`${o.story}:`));
342
+ const cases = g.nodes.filter((n) => n.type === 'ts' && n.key.startsWith(`${o.story}:`));
343
+ if (!acs.length && !cases.length) return null;
344
+ lines.push(`# Graph: ${o.story}`, '', '| Case | AC(s) | Status | Desc | Tests | Pages | Last result |', '|---|---|---|---|---|---|---|');
345
+ for (const c of cases) {
346
+ const ac = to(c.id, 'covered_by').map((e) => by.get(e.from).key.split(':')[1]).join(', ');
347
+ const tests = from(c.id, 'implemented_by').map((e) => by.get(e.to));
348
+ const named = tests.flatMap((t) => from(t.id, 'names_page').map((e) => e.to));
349
+ const pages = [...new Set((named.length ? named : tests.flatMap((t) => from(t.id, 'uses').flatMap((e) => (by.get(e.to).type === 'page' ? [e.to] : from(e.to, 'uses').map((x) => x.to)))))
350
+ .filter((p) => by.get(p)?.type === 'page').map((p) => path.basename(by.get(p).file)))];
351
+ const results = tests.flatMap((t) => from(t.id, 'produced').map((e) => by.get(e.to))).sort((a, b) => b.run.localeCompare(a.run));
352
+ lines.push(`| ${c.key.split(':')[1]} ${c.title ? `· ${c.title}` : ''} | ${ac || '—'} | ${c.status || (tests.length ? 'automated' : 'planned')} | ${c.desc || '—'} | ${tests.map((t) => t.file).join('<br>') || '—'} | ${pages.join(', ') || '—'} | ${results[0] ? `${results[0].status} (${results[0].run})` : '—'}${from(c.id, 'failed_as').map((e) => ` · ${by.get(e.to).key}`).join('')} |`);
353
+ }
354
+ const g2 = gaps(g, o.story);
355
+ lines.push('', `Gaps: ${g2.length ? '' : 'none'}`, ...g2.map((x) => `- ${x}`));
356
+ } else if (o.page) {
357
+ const p = g.nodes.find((n) => n.type === 'page' && (n.file === o.page || path.basename(n.file).replace(/\.\w+$/, '').toLowerCase() === o.page.toLowerCase()));
358
+ if (!p) return null;
359
+ const direct = to(p.id, 'names_page').map((e) => e.from);
360
+ const via = to(p.id, 'uses').map((e) => e.from);
361
+ const tests = g.nodes.filter((n) => n.type === 'test' && (direct.length ? direct.includes(n.id) : (via.includes(n.id) || from(n.id, 'uses').some((e) => via.includes(e.to)))));
362
+ lines.push(`# Graph: page ${p.file}`, '', `screens: ${from(p.id, 'models').map((e) => by.get(e.to).key).join(', ') || 'none recorded'}`, `tests that use it (${tests.length}):`, ...tests.map((t) => `- ${t.file} ${t.name} · cases ${to(t.id, 'implemented_by').map((e) => by.get(e.from).key).join(', ') || '—'}`));
363
+ const fs_ = from(p.id, 'has_finding').map((e) => by.get(e.to));
364
+ if (fs_.length) lines.push(`findings (${fs_.length}):`, ...fs_.map((f) => `- ${f.key} ${f.rule} ${f.severity} · ${f.file} · ${f.status}`));
365
+ } else if (o.test) {
366
+ const ts = g.nodes.filter((n) => n.type === 'test' && n.file.startsWith(o.test));
367
+ if (!ts.length) return null;
368
+ for (const t of ts) lines.push(`- ${t.file} ${t.name} · cases ${to(t.id, 'implemented_by').map((e) => by.get(e.from).key).join(', ') || '—'} · uses ${from(t.id, 'uses').map((e) => by.get(e.to).file).join(', ') || '—'}${from(t.id, 'has_finding').map((e) => ` · ${by.get(e.to).key} ${by.get(e.to).rule} (${by.get(e.to).status})`).join('')}`);
369
+ } else usage();
370
+ const max = Number(o['max-bytes'] || 8000);
371
+ let text = lines.join('\n');
372
+ if (Buffer.byteLength(text) > max) {
373
+ let kept = []; let n = 0;
374
+ for (const l of lines) { if (Buffer.byteLength([...kept, l].join('\n')) > max - 200) break; kept.push(l); n++; }
375
+ text = `${kept.join('\n')}\n\n… ${lines.length - n} more line(s) left out to stay under ${max} bytes: ask for one page (--page) or test file (--test), or raise --max-bytes.`;
376
+ }
377
+ return text;
378
+ }
379
+
380
+ function main() {
381
+ const o = args();
382
+ if (o.cmd === 'build') {
383
+ const g = build(o);
384
+ const count = (t) => g.nodes.filter((n) => n.type === t).length;
385
+ console.log(`graph: ${g.nodes.length} nodes (stories ${count('story')}, ACs ${count('ac')}, cases ${count('ts')}, tests ${count('test')}, pages ${count('page')}, screens ${count('screen')}, results ${count('result')}, findings ${count('finding')}), ${g.edges.length} edges → ${o.context}/graph/graph.json`);
386
+ return;
387
+ }
388
+ const { g, rebuilt } = fresh(o);
389
+ if (o.cmd === 'check') {
390
+ const out = gaps(g, o.story);
391
+ out.forEach((x) => console.log(x));
392
+ console.log(`graph check${o.story ? ` ${o.story}` : ''}: ${out.length} gap(s)${rebuilt ? ' (graph rebuilt: sources changed)' : ''}`);
393
+ process.exit(out.length ? 1 : 0);
394
+ }
395
+ const text = query(o, g);
396
+ if (text == null) { console.log('graph: nothing found for that query'); process.exit(1); }
397
+ console.log(text);
398
+ }
399
+
400
+ main();
@@ -0,0 +1,162 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Lean guard (Claude Code PreToolUse hook for Bash and Read): during an Orion run, blocks the three habits that filled
4
+ * an agent's context most in measured runs (evals/workflows/runs/2026-11-18-cost-breakdown.md) and names the lean
5
+ * command instead. It never rewrites a command and never approves one: a blocked call is re-issued by the agent as the
6
+ * lean command, which then goes through the same approval rules as before.
7
+ * 1. a test, build or install command run raw → `node .claude/skills/orion/scripts/quiet.mjs <same command>`
8
+ * 2. a skill reference file over 8 KB read whole (a SKILL.md itself is exempt) → `node .claude/skills/orion/scripts/rules.mjs <file> --list`, then
9
+ * the section needed (or `--all` when the whole file really is needed)
10
+ * 3. three or more of the suite's source files dumped in one command → `node .claude/skills/orion/scripts/codemap.mjs
11
+ * <suite>`, then only the files to change
12
+ * Active only while a run is open: a run file under project-context/runs/ changed in the last 12 hours that is not
13
+ * finished (every gate ✓ or n/a, or COMPLETE in its log). Outside a run, and with ORION_LEAN=off in the environment, it does nothing. It fails open: any error here
14
+ * exits 0 and the call proceeds. Reads only the hook's JSON on stdin and file sizes; never a file's contents.
15
+ * Hosts: one script for every host with hooks. It reads the JSON each host sends (Claude Code, Codex, Gemini CLI,
16
+ * GitHub Copilot and Devin/Windsurf: tool_name + tool_input; Grok Build and Copilot's camelCase form: toolName +
17
+ * toolInput/toolArgs; Cursor's beforeShellExecution: command + cwd) and maps each host's shell and read tools
18
+ * (Bash, run_shell_command, bash, powershell, exec, exec_command · Read, read_file, view). The host files that call it
19
+ * are generated by scripts/build_hosts.py; which host checks what: .claude/skills/orion/references/hosts.md.
20
+ * Exit code: 0 allow (nothing printed) · 2 block (the reason on stderr, shown to the agent). With `--host cursor` it
21
+ * always exits 0 and prints Cursor's JSON instead ({"permission":"allow"} or "deny" with the reason), because Cursor
22
+ * reads a decision from stdout; "allow" only means no objection (Cursor's own approval rules still apply).
23
+ */
24
+ import fs from 'node:fs';
25
+ import path from 'node:path';
26
+ import { fileURLToPath, pathToFileURL } from 'node:url';
27
+
28
+ const RUNNER = /^(npm (test|t|run test\S*|ci|install|i)\b|npx (--no-install )?playwright test\b|pytest\b|python3? -m pytest\b|py -m pytest\b|mvn\b|\.\/mvnw\b|gradle\b|\.\/gradlew\b|dotnet (test|build|restore)\b|pip3? install\b|python3? -m pip install\b|yarn (test|install)\b|pnpm (test|install|i)\b)/;
29
+ const BIG = 8 * 1024;
30
+
31
+ /** A run is finished when gate 8 is ✓, every gate row is ✓ or n/a (a mode's unused gates), or its log records COMPLETE. */
32
+ export function finished(text) {
33
+ const states = [...text.matchAll(/^\| [1-8] \| (\S+)/gm)].map((m) => m[1]);
34
+ if (/^\| 8 \| ✓ \|/m.test(text)) return true;
35
+ if (states.length === 8 && states.every((s) => s === '✓' || /^n\/a/i.test(s))) return true;
36
+ return /^\|[^|\n]*\|[^|\n]*\|[^|\n]*\| *COMPLETE *\|/m.test(text);
37
+ }
38
+
39
+ function openRun(cwd) {
40
+ let d = path.resolve(cwd);
41
+ for (let k = 0; k < 12; k++) {
42
+ const runs = path.join(d, 'project-context', 'runs');
43
+ if (fs.existsSync(runs)) {
44
+ const now = Date.now();
45
+ for (const f of fs.readdirSync(runs)) {
46
+ if (!/^R-.*\.md$/.test(f) || /\.(report|result)\.md$/.test(f)) continue;
47
+ const p = path.join(runs, f);
48
+ if (now - fs.statSync(p).mtimeMs > 12 * 3600 * 1000) continue;
49
+ if (!finished(fs.readFileSync(p, 'utf8'))) return d;
50
+ }
51
+ return null;
52
+ }
53
+ const up = path.dirname(d);
54
+ if (up === d) return null;
55
+ d = up;
56
+ }
57
+ return null;
58
+ }
59
+
60
+ /** Strip a leading `cd x &&` and environment assignments, so the command's own first word is checked. */
61
+ const core = (c) => c.trim().replace(/^(bash|sh|zsh)\s+-l?c\s+(['"])([\s\S]*)\2$/, '$3').trim()
62
+ .replace(/^(cd\s+\S+\s*(&&|;)\s*)+/, '').replace(/^([A-Za-z_][A-Za-z0-9_]*=\S*\s+)+/, '');
63
+
64
+ function bigRuleFile(p, root) {
65
+ try {
66
+ const abs = path.resolve(root, p);
67
+ // A skill's own SKILL.md is meant to be read whole when the skill starts; only references and other notes are held to sections.
68
+ return /[\\/]\.claude[\\/]skills[\\/].+\.md$/.test(abs) && !/[\\/]SKILL\.md$/.test(abs) && fs.statSync(abs).size > BIG ? abs : null;
69
+ } catch { return null; }
70
+ }
71
+
72
+ const SHELL = /^(Bash|bash|powershell|shell|run_shell_command|exec|exec_command|run_terminal_cmd|run_in_terminal)$/;
73
+ const READ = /^(Read|read_file|readFile|view)$/;
74
+
75
+ /** One shape for every host's hook input: { tool: 'Bash' | 'Read' | other, ti: { command } | { file_path, partial } }. */
76
+ export function normalize(input) {
77
+ if (!input || typeof input !== 'object') return { tool: null, ti: {} };
78
+ if (typeof input.command === 'string' && !input.tool_name && !input.toolName) return { tool: 'Bash', ti: { command: input.command } };
79
+ const name = input.tool_name ?? input.toolName ?? '';
80
+ let ti = input.tool_input ?? input.toolInput ?? input.toolArgs ?? {};
81
+ if (typeof ti === 'string') { try { ti = JSON.parse(ti); } catch { ti = { command: ti }; } }
82
+ if (!ti || typeof ti !== 'object') ti = {};
83
+ if (SHELL.test(name)) {
84
+ let c = ti.command ?? ti.cmd ?? ti.script;
85
+ // Codex sends ["bash", "-lc", "<command>"]: the command is the last element.
86
+ if (Array.isArray(c)) c = /^(ba|z|)sh$|[\\/](ba|z|)sh$|^pwsh$|^powershell/.test(c[0] || '') && c.length >= 3 ? c[c.length - 1] : c.join(' ');
87
+ return { tool: 'Bash', ti: { command: c } };
88
+ }
89
+ if (READ.test(name)) {
90
+ const partial = Boolean(ti.limit || ti.offset || ti.start_line || ti.end_line || ti.view_range || ti.line_range || ti.lines);
91
+ return { tool: 'Read', ti: { file_path: ti.file_path ?? ti.path ?? ti.absolute_path ?? ti.filePath, partial } };
92
+ }
93
+ return { tool: name, ti };
94
+ }
95
+
96
+ /** The quiet runner's path as the agent should type it: relative when the workspace holds it (the usual install),
97
+ * else this script's own sibling as an absolute path (a plugin install keeps the skills outside the workspace). */
98
+ const quietPath = (root) => {
99
+ const own = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..', 'quiet.mjs');
100
+ const rel = path.relative(root, own);
101
+ return !rel.startsWith('..') && !path.isAbsolute(rel) ? rel.split(path.sep).join('/') : own;
102
+ };
103
+
104
+ export function verdict(input, root) {
105
+ const { tool, ti } = normalize(input);
106
+ if (tool === 'Read') {
107
+ const f = ti.file_path && bigRuleFile(ti.file_path, root);
108
+ if (f && !ti.partial) return `Read the section you need instead of the whole ${path.basename(f)} (${Math.round(fs.statSync(f).size / 1024)} KB): node .claude/skills/orion/scripts/rules.mjs ${path.relative(root, f)} --list, then rules.mjs <file> <words from the section title>. Whole file only when you need all of it: rules.mjs <file> --all. Without a shell: Grep -n the section's heading, then Read with offset and limit.`;
109
+ return null;
110
+ }
111
+ if (tool !== 'Bash' || typeof ti.command !== 'string') return null;
112
+ const cmd = ti.command;
113
+ if (/\bquiet\.mjs\b|\brules\.mjs\b|\bcodemap\.mjs\b/.test(cmd)) return null;
114
+ for (const part of cmd.split(/&&|;|\n/)) {
115
+ const c = core(part);
116
+ if (RUNNER.test(c)) {
117
+ const whole = cmd.trim().replace(/^(bash|sh|zsh)\s+-l?c\s+(['"])([\s\S]*)\2$/, '$3').trim();
118
+ const form = whole === c && !/[<>|]/.test(c) ? c : `"${whole.replace(/"/g, '\\"')}"`;
119
+ return `Run it through the quiet runner (same command, same folder, same approval; the full log is saved): node ${quietPath(root)} ${form.slice(0, 200)}`;
120
+ }
121
+ }
122
+ if (/\b(cat|head|tail|sed|less|more|awk|grep)\b/.test(cmd)) {
123
+ const paths = cmd.match(/[\w./~-]+\.md\b/g) || [];
124
+ for (const p of paths) {
125
+ const f = bigRuleFile(p, root);
126
+ if (f && !/grep\s+-(n|c|l)\w*\s+["'][^"']+["']/.test(cmd) && !/sed -n ['"]?\d+,\d{1,2}p/.test(cmd)) {
127
+ return `Read the section you need instead of the whole ${path.basename(f)} (${Math.round(fs.statSync(f).size / 1024)} KB): node .claude/skills/orion/scripts/rules.mjs ${path.relative(root, f)} --list, then rules.mjs <file> <words from the section title>.`;
128
+ }
129
+ }
130
+ const code = (cmd.match(/[\w./*-]+\.(m?[jt]sx?|cjs|py|java|kt|cs|feature)\b/g) || []).filter((p) => !/node_modules|\.claude\//.test(p));
131
+ const globs = code.filter((p) => p.includes('*')).length;
132
+ if (/\b(cat|head|sed -n)\b/.test(cmd) && (code.length >= 3 || globs >= 1 || /for \w+ in [^;]*\.(m?[jt]sx?|py|java|cs)/.test(cmd))) {
133
+ return 'Get the map first instead of reading the files whole: node .claude/skills/orion/scripts/codemap.mjs <suite folder> [--find <name>]; then open only the files you change, at the lines it gives.';
134
+ }
135
+ }
136
+ return null;
137
+ }
138
+
139
+ function decide() {
140
+ if (process.env.ORION_LEAN === 'off') return null;
141
+ let raw = '';
142
+ try { raw = fs.readFileSync(0, 'utf8'); } catch { return null; }
143
+ try {
144
+ const input = JSON.parse(raw.replace(/^\uFEFF/, ''));
145
+ const cwd = input.cwd || input.workspaceRoot || (Array.isArray(input.workspace_roots) && input.workspace_roots[0]) || process.cwd();
146
+ const root = openRun(cwd);
147
+ return root ? verdict(input, root) : null;
148
+ } catch { return null; }
149
+ }
150
+
151
+ function main() {
152
+ const cursor = process.argv.includes('--host') && process.argv[process.argv.indexOf('--host') + 1] === 'cursor';
153
+ const why = decide();
154
+ if (cursor) {
155
+ process.stdout.write(JSON.stringify(why ? { permission: 'deny', user_message: `Orion lean rule: ${why}`, agent_message: `Orion lean rule: ${why}` } : { permission: 'allow' }));
156
+ process.exit(0);
157
+ }
158
+ if (why) { process.stderr.write(`Orion lean rule: ${why}\n`); process.exit(2); }
159
+ process.exit(0);
160
+ }
161
+
162
+ if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) main();
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Keeps a script's writes inside the workspace. The scripts that call it run without a permission prompt (allow rules
3
+ * in .claude/settings.json), so a path an agent was talked into (`--out ~/.ssh/…`, `../../other-repo/…`) must not
4
+ * reach outside the folder the script runs in. Symlinks are resolved on the nearest existing parent, so a link inside
5
+ * the workspace that points outside is refused too.
6
+ */
7
+ import fs from 'node:fs';
8
+ import path from 'node:path';
9
+
10
+ /** The real path of `p`, resolving symlinks on its nearest existing ancestor. */
11
+ function realish(p) {
12
+ let cur = path.resolve(p); const rest = [];
13
+ while (!fs.existsSync(cur)) { rest.unshift(path.basename(cur)); const up = path.dirname(cur); if (up === cur) break; cur = up; }
14
+ return path.join(fs.realpathSync(cur), ...rest);
15
+ }
16
+
17
+ /**
18
+ * Exits 2 with a message when `p` resolves outside the current working directory; returns `p` otherwise.
19
+ * @param {string} p The path the script is about to write.
20
+ * @param {string} what What the path is, for the message (e.g. `--out`).
21
+ * @returns {string} The same path.
22
+ */
23
+ export function insideWorkspace(p, what) {
24
+ const root = fs.realpathSync(process.cwd());
25
+ const abs = realish(p);
26
+ if (abs !== root && !abs.startsWith(root + path.sep)) {
27
+ console.log(`refused: ${what} ${p} is outside the workspace (${root}); this script writes only inside it`);
28
+ process.exit(2);
29
+ }
30
+ return p;
31
+ }