@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.
- package/.claude/agents/automation-strategist.md +1 -0
- package/.claude/agents/change-agent.md +1 -0
- package/.claude/agents/codebase-analyst.md +2 -1
- package/.claude/agents/environment-discovery.md +1 -0
- package/.claude/agents/evidence-validator.md +1 -0
- package/.claude/agents/executor.md +1 -0
- package/.claude/agents/failure-analyst.md +2 -1
- package/.claude/agents/implementer.md +2 -1
- package/.claude/agents/requirement-analyst.md +1 -0
- package/.claude/agents/reviewer.md +1 -0
- package/.claude/agents/test-reporter.md +1 -0
- package/.claude/settings.json +25 -0
- package/.claude/skills/appium/SKILL.md +1 -1
- package/.claude/skills/appium/templates/README.md +6 -9
- package/.claude/skills/appium/templates/ci/github-actions-android.yml +8 -2
- package/.claude/skills/appium/templates/ci/github-actions-ios.yml +8 -2
- package/.claude/skills/appium/templates/ci/github-actions-windows.yml +9 -2
- package/.claude/skills/appium/templates/project-java/.env.example +4 -0
- package/.claude/skills/appium/templates/project-java/pom.xml +2 -0
- package/.claude/skills/appium/templates/project-java/src/test/java/automation/{framework/Config.java → config/Env.java} +43 -52
- package/.claude/skills/appium/templates/project-java/src/test/java/automation/config/Flags.java +45 -0
- package/.claude/skills/appium/templates/project-java/src/test/java/automation/config/Paths.java +14 -0
- package/.claude/skills/appium/templates/project-java/src/test/java/automation/desc/SignInDesc.java +30 -0
- package/.claude/skills/appium/templates/project-java/src/test/java/automation/{framework → driver}/DriverFactory.java +19 -13
- package/.claude/skills/appium/templates/project-java/src/test/java/automation/{framework → driver}/DriverManager.java +12 -9
- package/.claude/skills/appium/templates/project-java/src/test/java/automation/fixtures/BaseTest.java +75 -0
- package/.claude/skills/appium/templates/project-java/src/test/java/automation/{screens → pageObjects}/BaseScreen.java +12 -12
- package/.claude/skills/appium/templates/project-java/src/test/java/automation/pageObjects/HomeScreen.java +26 -0
- package/.claude/skills/appium/templates/project-java/src/test/java/automation/pageObjects/LoginScreen.java +63 -0
- package/.claude/skills/appium/templates/project-java/src/test/java/automation/pageObjects/ShellScreen.java +26 -0
- package/.claude/skills/appium/templates/project-java/src/test/java/automation/setup/AuthSetup.java +49 -0
- package/.claude/skills/appium/templates/project-java/src/test/java/automation/testData/TestData.java +78 -0
- package/.claude/skills/appium/templates/project-java/src/test/java/automation/tests/ui/SignInTest.java +45 -0
- package/.claude/skills/appium/templates/project-java/src/test/java/automation/tests/unit/UtilsTest.java +34 -0
- package/.claude/skills/appium/templates/project-java/src/test/java/automation/{framework → utils}/AutomationError.java +4 -4
- package/.claude/skills/appium/templates/project-java/src/test/java/automation/utils/Case.java +20 -0
- package/.claude/skills/appium/templates/project-java/src/test/java/automation/utils/CaseTransformer.java +54 -0
- package/.claude/skills/appium/templates/project-java/src/test/java/automation/utils/Dates.java +42 -0
- package/.claude/skills/appium/templates/project-java/src/test/java/automation/utils/Log.java +45 -0
- package/.claude/skills/appium/templates/project-java/src/test/java/automation/utils/MissingSettingError.java +13 -0
- package/.claude/skills/appium/templates/project-java/src/test/java/automation/utils/RandomData.java +41 -0
- package/.claude/skills/appium/templates/project-java/src/test/java/automation/utils/Redact.java +33 -0
- package/.claude/skills/appium/templates/project-java/src/test/java/automation/utils/TestDescription.java +25 -0
- package/.claude/skills/appium/templates/project-java/src/test/resources/testData/testData.properties +7 -0
- package/.claude/skills/appium/templates/project-java/testng.xml +11 -4
- package/.claude/skills/architecture-analysis/SKILL.md +3 -2
- package/.claude/skills/automation-implementation/SKILL.md +8 -5
- package/.claude/skills/automation-implementation/references/patterns.md +46 -24
- package/.claude/skills/automation-review/references/assertion-guard.md +1 -1
- package/.claude/skills/code-review/SKILL.md +5 -2
- package/.claude/skills/code-review/references/pattern-rules.md +12 -7
- package/.claude/skills/documentation/SKILL.md +23 -18
- package/.claude/skills/execution/SKILL.md +7 -3
- package/.claude/skills/httpclient/templates/README.md +6 -7
- package/.claude/skills/httpclient/templates/csharp-nunit/.env.example +4 -0
- package/.claude/skills/httpclient/templates/csharp-nunit/Automation.csproj +7 -3
- package/.claude/skills/httpclient/templates/csharp-nunit/Config/Env.cs +62 -0
- package/.claude/skills/httpclient/templates/csharp-nunit/Config/Flags.cs +35 -0
- package/.claude/skills/httpclient/templates/csharp-nunit/Config/Paths.cs +22 -0
- package/.claude/skills/httpclient/templates/csharp-nunit/Fixtures/BaseTest.cs +22 -0
- package/.claude/skills/httpclient/templates/csharp-nunit/Resources/Desc/ProductsDesc.cs +22 -0
- package/.claude/skills/httpclient/templates/csharp-nunit/Resources/TestData/TestData.cs +61 -0
- package/.claude/skills/httpclient/templates/csharp-nunit/Resources/TestData/testData.json +9 -0
- package/.claude/skills/httpclient/templates/csharp-nunit/Services/ApiClient.cs +48 -0
- package/.claude/skills/httpclient/templates/csharp-nunit/Services/HealthApi.cs +11 -0
- package/.claude/skills/httpclient/templates/csharp-nunit/{Api → Services}/ProductsApi.cs +8 -5
- package/.claude/skills/httpclient/templates/csharp-nunit/Tests/Api/ProductsTests.cs +61 -0
- package/.claude/skills/httpclient/templates/csharp-nunit/Tests/Unit/UtilsTests.cs +40 -0
- package/.claude/skills/httpclient/templates/csharp-nunit/Utils/AutomationError.cs +15 -0
- package/.claude/skills/httpclient/templates/csharp-nunit/Utils/Dates.cs +18 -0
- package/.claude/skills/httpclient/templates/csharp-nunit/Utils/Log.cs +37 -0
- package/.claude/skills/httpclient/templates/csharp-nunit/Utils/RandomData.cs +26 -0
- package/.claude/skills/httpclient/templates/csharp-nunit/Utils/Redact.cs +22 -0
- package/.claude/skills/httpclient/templates/csharp-nunit/Utils/TestDescription.cs +55 -0
- package/.claude/skills/javascript/references/sources.md +1 -1
- package/.claude/skills/k6/SKILL.md +1 -1
- package/.claude/skills/k6/templates/README.md +5 -3
- package/.claude/skills/k6/templates/project/{data/cases.js → resources/desc/products.desc.js} +1 -1
- package/.claude/skills/k6/templates/project/resources/testData/testData.js +32 -0
- package/.claude/skills/k6/templates/project/{lib/config.js → src/config/env.js} +10 -5
- package/.claude/skills/k6/templates/project/{lib → src/services}/products-api.js +7 -5
- package/.claude/skills/k6/templates/project/{load → tests/load}/products.js +8 -8
- package/.claude/skills/karate/templates/README.md +4 -5
- package/.claude/skills/karate/templates/java-junit5/.env.example +2 -0
- package/.claude/skills/karate/templates/java-junit5/pom.xml +4 -0
- package/.claude/skills/karate/templates/java-junit5/src/test/java/{support → config}/EnvSettings.java +1 -1
- package/.claude/skills/karate/templates/java-junit5/src/test/java/karate-config.js +13 -6
- package/.claude/skills/karate/templates/java-junit5/src/test/java/logback-test.xml +1 -1
- package/.claude/skills/karate/templates/java-junit5/src/test/java/{api → tests}/ApiTest.java +7 -4
- package/.claude/skills/karate/templates/java-junit5/src/test/java/{api → tests/api}/health.feature +3 -3
- package/.claude/skills/karate/templates/java-junit5/src/test/java/tests/api/products.feature +29 -0
- package/.claude/skills/karate/templates/java-junit5/src/test/java/{support → utils}/MaskingLogModifier.java +1 -1
- package/.claude/skills/karate/templates/java-junit5/src/test/resources/testData/newProduct.js +7 -0
- package/.claude/skills/karate/templates/java-junit5/src/test/resources/testData/testData.json +6 -0
- package/.claude/skills/newman/templates/README.md +4 -5
- package/.claude/skills/newman/templates/collection/.env.example +2 -0
- package/.claude/skills/newman/templates/collection/collections/api.postman_collection.json +165 -145
- package/.claude/skills/newman/templates/collection/package.json +2 -1
- package/.claude/skills/newman/templates/collection/resources/desc/products.desc.json +53 -0
- package/.claude/skills/newman/templates/collection/resources/testData/testData.json +10 -0
- package/.claude/skills/newman/templates/collection/run.js +41 -31
- package/.claude/skills/newman/templates/collection/src/config/env.js +37 -0
- package/.claude/skills/orion/SKILL.md +19 -12
- package/.claude/skills/orion/references/assess-fix.md +35 -0
- package/.claude/skills/orion/references/batch.md +64 -0
- package/.claude/skills/orion/references/blockers.md +1 -1
- package/.claude/skills/orion/references/capabilities.md +1 -1
- package/.claude/skills/orion/references/conversation.md +65 -20
- package/.claude/skills/orion/references/delivery-formats.md +24 -36
- package/.claude/skills/orion/references/doctor.md +1 -1
- package/.claude/skills/orion/references/hosts.md +1 -0
- package/.claude/skills/orion/references/modes.md +7 -3
- package/.claude/skills/orion/references/plain-language.md +55 -0
- package/.claude/skills/orion/references/project-context-files.md +8 -2
- package/.claude/skills/orion/references/recovery-loop.md +8 -0
- package/.claude/skills/orion/references/setup-card.md +29 -8
- package/.claude/skills/orion/references/status-lines.md +9 -4
- package/.claude/skills/orion/references/task-brief.md +1 -0
- package/.claude/skills/orion/references/work-branch.md +3 -1
- package/.claude/skills/orion/scripts/batch_detect.mjs +98 -0
- package/.claude/skills/orion/scripts/batch_state.mjs +179 -0
- package/.claude/skills/orion/scripts/browser_setup.mjs +41 -21
- package/.claude/skills/orion/scripts/cases_export.py +724 -0
- package/.claude/skills/orion/scripts/codemap.mjs +116 -0
- package/.claude/skills/orion/scripts/done_check.mjs +195 -0
- package/.claude/skills/orion/scripts/env_check.mjs +8 -3
- package/.claude/skills/orion/scripts/env_check.py +12 -5
- package/.claude/skills/orion/scripts/fix_plan.mjs +170 -0
- package/.claude/skills/orion/scripts/graph.mjs +400 -0
- package/.claude/skills/orion/scripts/hooks/lean_guard.mjs +162 -0
- package/.claude/skills/orion/scripts/lib/inside.mjs +31 -0
- package/.claude/skills/orion/scripts/lib/scan.mjs +357 -0
- package/.claude/skills/orion/scripts/lib/table.mjs +116 -0
- package/.claude/skills/orion/scripts/parity_check.mjs +166 -0
- package/.claude/skills/orion/scripts/quiet.mjs +160 -0
- package/.claude/skills/orion/scripts/report_check.mjs +77 -0
- package/.claude/skills/orion/scripts/results_parse.mjs +209 -0
- package/.claude/skills/orion/scripts/reuse_check.mjs +251 -0
- package/.claude/skills/orion/scripts/rules.mjs +92 -0
- package/.claude/skills/orion/scripts/run_state.mjs +238 -0
- package/.claude/skills/orion/scripts/suite_check.mjs +267 -0
- package/.claude/skills/orion/scripts/timing_profile.mjs +128 -0
- package/.claude/skills/orion/scripts/usage_report.mjs +315 -0
- package/.claude/skills/orion/templates/project-context/assessment.md +45 -0
- package/.claude/skills/orion/templates/project-context/defects.md +5 -0
- package/.claude/skills/orion/templates/project-context/report.md +45 -0
- package/.claude/skills/orion/templates/project-context/retry-policy.md +6 -0
- package/.claude/skills/orion/templates/project-context/run.md +4 -1
- package/.claude/skills/orion/templates/project-context/test-case-map.md +5 -0
- package/.claude/skills/orion/templates/project-context/test-design.md +24 -0
- package/.claude/skills/pact/SKILL.md +2 -2
- package/.claude/skills/pact/templates/README.md +4 -2
- package/.claude/skills/pact/templates/project/package.json +2 -2
- package/.claude/skills/pact/templates/project/{data/cases.js → resources/desc/products.desc.js} +3 -3
- package/.claude/skills/pact/templates/project/resources/testData/testData.js +21 -0
- package/.claude/skills/pact/templates/project/src/config/env.js +32 -0
- package/.claude/skills/pact/templates/project/src/{products-client.js → services/products-client.js} +4 -2
- package/.claude/skills/pact/templates/project/tests/contract/products.contract.test.js +46 -0
- package/.claude/skills/pact/templates/project/{verify → tests/verify}/products.verify.js +7 -22
- package/.claude/skills/playwright/SKILL.md +6 -6
- package/.claude/skills/playwright/templates/README.md +29 -10
- package/.claude/skills/playwright/templates/ci/Jenkinsfile +1 -1
- package/.claude/skills/playwright/templates/ci/azure-pipelines.yml +1 -1
- package/.claude/skills/playwright/templates/ci/github-actions-javascript.yml +1 -1
- package/.claude/skills/playwright/templates/ci/github-actions.yml +1 -1
- package/.claude/skills/playwright/templates/ci/gitlab-ci.yml +1 -1
- package/.claude/skills/playwright/templates/dotnet/.env.example +7 -0
- package/.claude/skills/playwright/templates/dotnet/.runsettings +17 -0
- package/.claude/skills/playwright/templates/dotnet/Automation.csproj +8 -0
- package/.claude/skills/playwright/templates/dotnet/Config/Env.cs +89 -0
- package/.claude/skills/playwright/templates/dotnet/Config/Flags.cs +56 -0
- package/.claude/skills/playwright/templates/dotnet/Config/Paths.cs +31 -0
- package/.claude/skills/playwright/templates/dotnet/Fixtures/ApiBaseTest.cs +39 -0
- package/.claude/skills/playwright/templates/dotnet/Fixtures/BaseTest.cs +72 -0
- package/.claude/skills/playwright/templates/dotnet/PageObjects/BasePage.cs +63 -0
- package/.claude/skills/playwright/templates/dotnet/PageObjects/HomePage.cs +21 -0
- package/.claude/skills/playwright/templates/dotnet/PageObjects/LoginPage.cs +54 -0
- package/.claude/skills/playwright/templates/dotnet/PageObjects/ShellPage.cs +29 -0
- package/.claude/skills/playwright/templates/dotnet/Resources/Desc/SignInDesc.cs +23 -0
- package/.claude/skills/playwright/templates/dotnet/Resources/TestData/TestData.cs +74 -0
- package/.claude/skills/playwright/templates/dotnet/Resources/TestData/testData.json +19 -0
- package/.claude/skills/playwright/templates/dotnet/Services/ApiClient.cs +51 -0
- package/.claude/skills/playwright/templates/dotnet/Setup/AuthSetup.cs +63 -0
- package/.claude/skills/playwright/templates/dotnet/Tests/Api/SessionTests.cs +18 -0
- package/.claude/skills/playwright/templates/dotnet/Tests/Ui/SignInTests.cs +48 -0
- package/.claude/skills/playwright/templates/dotnet/Tests/Unit/UtilsTests.cs +40 -0
- package/.claude/skills/playwright/templates/dotnet/Utils/AutomationError.cs +15 -0
- package/.claude/skills/playwright/templates/dotnet/Utils/Dates.cs +18 -0
- package/.claude/skills/playwright/templates/dotnet/Utils/Log.cs +37 -0
- package/.claude/skills/playwright/templates/dotnet/Utils/RandomData.cs +26 -0
- package/.claude/skills/playwright/templates/dotnet/Utils/Redact.cs +22 -0
- package/.claude/skills/playwright/templates/dotnet/Utils/TestDescription.cs +55 -0
- package/.claude/skills/playwright/templates/dotnet/gitignore +6 -1
- package/.claude/skills/playwright/templates/javascript/.env.example +8 -0
- package/.claude/skills/playwright/templates/javascript/fixtures/index.js +85 -0
- package/.claude/skills/playwright/templates/javascript/fixtures/session.js +82 -0
- package/.claude/skills/playwright/templates/javascript/gitignore +7 -0
- package/.claude/skills/playwright/templates/javascript/jsconfig.json +12 -0
- package/.claude/skills/playwright/templates/javascript/package.json +7 -3
- package/.claude/skills/playwright/templates/javascript/pageObjects/basePage.js +62 -0
- package/.claude/skills/playwright/templates/javascript/pageObjects/homePage.js +19 -0
- package/.claude/skills/playwright/templates/javascript/pageObjects/loginPage.js +44 -0
- package/.claude/skills/playwright/templates/javascript/pageObjects/shellPage.js +26 -0
- package/.claude/skills/playwright/templates/javascript/playwright.config.js +45 -24
- package/.claude/skills/playwright/templates/javascript/reporters/summaryReporter.js +233 -0
- package/.claude/skills/playwright/templates/javascript/resources/desc/signIn.desc.js +33 -0
- package/.claude/skills/playwright/templates/javascript/resources/testData/testData.js +45 -0
- package/.claude/skills/playwright/templates/javascript/setup/auth.setup.js +17 -0
- package/.claude/skills/playwright/templates/javascript/setup/auth.teardown.js +16 -0
- package/.claude/skills/playwright/templates/javascript/src/config/env.js +107 -0
- package/.claude/skills/playwright/templates/javascript/src/config/flags.js +70 -0
- package/.claude/skills/playwright/templates/javascript/src/config/loadEnv.js +21 -0
- package/.claude/skills/playwright/templates/javascript/src/config/paths.js +22 -0
- package/.claude/skills/playwright/templates/javascript/src/services/apiClient.js +68 -0
- package/.claude/skills/playwright/templates/javascript/tests/api/session.spec.js +15 -0
- package/.claude/skills/playwright/templates/javascript/tests/ui/signIn.spec.js +35 -0
- package/.claude/skills/playwright/templates/javascript/tests/unit/summaryReporter.test.js +34 -0
- package/.claude/skills/playwright/templates/javascript/tests/unit/utils.test.js +31 -0
- package/.claude/skills/playwright/templates/javascript/utils/date.js +28 -0
- package/.claude/skills/playwright/templates/javascript/{src → utils}/errors.js +1 -0
- package/.claude/skills/playwright/templates/javascript/utils/formFill.js +29 -0
- package/.claude/skills/playwright/templates/javascript/utils/logger.js +33 -0
- package/.claude/skills/playwright/templates/javascript/utils/random.js +37 -0
- package/.claude/skills/playwright/templates/javascript/utils/redact.js +35 -0
- package/.claude/skills/playwright/templates/javascript/utils/titles.js +38 -0
- package/.claude/skills/playwright/templates/project/.env.example +8 -0
- package/.claude/skills/playwright/templates/project/fixtures/index.ts +86 -0
- package/.claude/skills/playwright/templates/project/fixtures/session.ts +78 -0
- package/.claude/skills/playwright/templates/project/gitignore +9 -2
- package/.claude/skills/playwright/templates/project/package.json +8 -6
- package/.claude/skills/playwright/templates/project/pageObjects/basePage.ts +57 -0
- package/.claude/skills/playwright/templates/project/pageObjects/homePage.ts +20 -0
- package/.claude/skills/playwright/templates/project/pageObjects/loginPage.ts +47 -0
- package/.claude/skills/playwright/templates/project/pageObjects/shellPage.ts +22 -0
- package/.claude/skills/playwright/templates/project/playwright.config.ts +49 -23
- package/.claude/skills/playwright/templates/project/reporters/summaryReporter.ts +241 -0
- package/.claude/skills/playwright/templates/project/resources/desc/signIn.desc.ts +32 -0
- package/.claude/skills/playwright/templates/project/resources/testData/testData.ts +42 -0
- package/.claude/skills/playwright/templates/project/setup/auth.setup.ts +16 -0
- package/.claude/skills/playwright/templates/project/setup/auth.teardown.ts +15 -0
- package/.claude/skills/playwright/templates/project/src/config/env.ts +109 -0
- package/.claude/skills/playwright/templates/project/src/config/flags.ts +70 -0
- package/.claude/skills/playwright/templates/project/src/config/loadEnv.ts +17 -0
- package/.claude/skills/playwright/templates/project/src/config/paths.ts +19 -0
- package/.claude/skills/playwright/templates/project/src/services/apiClient.ts +70 -0
- package/.claude/skills/playwright/templates/project/tests/api/session.spec.ts +14 -0
- package/.claude/skills/playwright/templates/project/tests/ui/signIn.spec.ts +34 -0
- package/.claude/skills/playwright/templates/project/tests/unit/summaryReporter.test.ts +33 -0
- package/.claude/skills/playwright/templates/project/tests/unit/utils.test.ts +30 -0
- package/.claude/skills/playwright/templates/project/tsconfig.json +3 -8
- package/.claude/skills/playwright/templates/project/utils/date.ts +25 -0
- package/.claude/skills/playwright/templates/project/utils/formFill.ts +27 -0
- package/.claude/skills/playwright/templates/project/utils/logger.ts +32 -0
- package/.claude/skills/playwright/templates/project/utils/random.ts +34 -0
- package/.claude/skills/playwright/templates/project/utils/redact.ts +32 -0
- package/.claude/skills/playwright/templates/project/utils/titles.ts +42 -0
- package/.claude/skills/playwright/templates/python/.env.example +8 -0
- package/.claude/skills/playwright/templates/python/conftest.py +91 -16
- package/.claude/skills/playwright/templates/python/gitignore +5 -0
- package/.claude/skills/playwright/templates/python/page_objects/__init__.py +1 -0
- package/.claude/skills/playwright/templates/python/page_objects/base_page.py +57 -0
- package/.claude/skills/playwright/templates/python/page_objects/home_page.py +22 -0
- package/.claude/skills/playwright/templates/python/page_objects/login_page.py +42 -0
- package/.claude/skills/playwright/templates/python/page_objects/shell_page.py +21 -0
- package/.claude/skills/playwright/templates/python/pytest.ini +5 -2
- package/.claude/skills/playwright/templates/python/requirements.txt +1 -0
- package/.claude/skills/playwright/templates/python/resources/__init__.py +1 -0
- package/.claude/skills/playwright/templates/python/resources/desc/__init__.py +1 -0
- package/.claude/skills/playwright/templates/python/resources/desc/sign_in_desc.py +27 -0
- package/.claude/skills/playwright/templates/python/resources/test_data/__init__.py +1 -0
- package/.claude/skills/playwright/templates/python/resources/test_data/test_data.py +41 -0
- package/.claude/skills/playwright/templates/python/setup/__init__.py +1 -0
- package/.claude/skills/playwright/templates/python/setup/auth.py +53 -0
- package/.claude/skills/playwright/templates/python/src/__init__.py +1 -0
- package/.claude/skills/playwright/templates/python/src/config/__init__.py +1 -0
- package/.claude/skills/playwright/templates/python/src/config/env.py +109 -0
- package/.claude/skills/playwright/templates/python/src/config/flags.py +63 -0
- package/.claude/skills/playwright/templates/python/src/config/load_env.py +16 -0
- package/.claude/skills/playwright/templates/python/src/config/paths.py +25 -0
- package/.claude/skills/playwright/templates/python/src/services/__init__.py +1 -0
- package/.claude/skills/playwright/templates/python/src/services/api_client.py +60 -0
- package/.claude/skills/playwright/templates/python/tests/api/test_session.py +14 -0
- package/.claude/skills/playwright/templates/python/tests/ui/test_sign_in.py +36 -0
- package/.claude/skills/playwright/templates/python/tests/unit/test_utils.py +32 -0
- package/.claude/skills/playwright/templates/python/utils/__init__.py +1 -0
- package/.claude/skills/playwright/templates/python/utils/dates.py +23 -0
- package/.claude/skills/playwright/templates/python/{framework → utils}/errors.py +3 -2
- package/.claude/skills/playwright/templates/python/utils/form_fill.py +26 -0
- package/.claude/skills/playwright/templates/python/utils/logger.py +40 -0
- package/.claude/skills/playwright/templates/python/utils/markers.py +6 -0
- package/.claude/skills/playwright/templates/python/utils/random_data.py +35 -0
- package/.claude/skills/playwright/templates/python/utils/redact.py +30 -0
- package/.claude/skills/playwright/templates/python/utils/titles.py +53 -0
- package/.claude/skills/quality-checks/SKILL.md +11 -11
- package/.claude/skills/quality-checks/templates/README.md +14 -12
- package/.claude/skills/quality-checks/templates/playwright-js/pageObjects/scannedPage.js +21 -0
- package/.claude/skills/quality-checks/templates/playwright-js/resources/desc/quality.desc.js +63 -0
- package/.claude/skills/quality-checks/templates/playwright-js/resources/testData/qualityData.js +32 -0
- package/.claude/skills/quality-checks/templates/playwright-js/src/checks/accessibility.js +50 -0
- package/.claude/skills/quality-checks/templates/playwright-js/src/checks/pageHealth.js +38 -0
- package/.claude/skills/quality-checks/templates/playwright-js/src/checks/performance.js +21 -0
- package/.claude/skills/quality-checks/templates/playwright-js/src/services/graphqlClient.js +28 -0
- package/.claude/skills/quality-checks/templates/playwright-js/tests/api/graphql.spec.js +23 -0
- package/.claude/skills/quality-checks/templates/playwright-js/tests/ui/quality.spec.js +50 -0
- package/.claude/skills/quality-checks/templates/playwright-ts/pageObjects/scannedPage.ts +20 -0
- package/.claude/skills/quality-checks/templates/playwright-ts/resources/desc/quality.desc.ts +59 -0
- package/.claude/skills/quality-checks/templates/playwright-ts/{src/data/quality.data.ts → resources/testData/qualityData.ts} +3 -2
- package/.claude/skills/quality-checks/templates/playwright-ts/tests/api/graphql.spec.ts +22 -0
- package/.claude/skills/quality-checks/templates/playwright-ts/tests/ui/quality.spec.ts +49 -0
- package/.claude/skills/requests/templates/README.md +6 -7
- package/.claude/skills/requests/templates/python-pytest/.env.example +4 -0
- package/.claude/skills/requests/templates/python-pytest/conftest.py +24 -9
- package/.claude/skills/requests/templates/python-pytest/pytest.ini +6 -3
- package/.claude/skills/requests/templates/python-pytest/requirements.txt +1 -0
- package/.claude/skills/requests/templates/python-pytest/resources/__init__.py +1 -0
- package/.claude/skills/requests/templates/python-pytest/resources/desc/__init__.py +1 -0
- package/.claude/skills/requests/templates/python-pytest/resources/desc/products_desc.py +27 -0
- package/.claude/skills/requests/templates/python-pytest/resources/test_data/__init__.py +1 -0
- package/.claude/skills/requests/templates/python-pytest/resources/test_data/test_data.py +27 -0
- package/.claude/skills/requests/templates/python-pytest/src/__init__.py +1 -0
- package/.claude/skills/requests/templates/python-pytest/src/config/__init__.py +1 -0
- package/.claude/skills/requests/templates/python-pytest/src/config/env.py +39 -0
- package/.claude/skills/requests/templates/python-pytest/src/config/flags.py +35 -0
- package/.claude/skills/requests/templates/python-pytest/src/config/load_env.py +16 -0
- package/.claude/skills/requests/templates/python-pytest/src/config/paths.py +16 -0
- package/.claude/skills/requests/templates/python-pytest/src/services/__init__.py +1 -0
- package/.claude/skills/requests/templates/python-pytest/{api/client.py → src/services/api_client.py} +19 -10
- package/.claude/skills/requests/templates/python-pytest/{api → src/services}/products_api.py +3 -9
- package/.claude/skills/requests/templates/python-pytest/tests/api/test_products.py +35 -0
- package/.claude/skills/requests/templates/python-pytest/tests/unit/test_utils.py +32 -0
- package/.claude/skills/requests/templates/python-pytest/utils/__init__.py +1 -0
- package/.claude/skills/requests/templates/python-pytest/utils/dates.py +23 -0
- package/.claude/skills/{selenium/templates/python-pytest/framework → requests/templates/python-pytest/utils}/errors.py +4 -3
- package/.claude/skills/requests/templates/python-pytest/utils/logger.py +40 -0
- package/.claude/skills/requests/templates/python-pytest/utils/random_data.py +35 -0
- package/.claude/skills/requests/templates/python-pytest/utils/redact.py +30 -0
- package/.claude/skills/requests/templates/python-pytest/utils/titles.py +53 -0
- package/.claude/skills/requirement-analysis/SKILL.md +1 -1
- package/.claude/skills/rest-assured/SKILL.md +1 -1
- package/.claude/skills/rest-assured/templates/README.md +6 -7
- package/.claude/skills/rest-assured/templates/ci/github-actions.yml +5 -2
- package/.claude/skills/rest-assured/templates/java-testng/.env.example +3 -0
- package/.claude/skills/rest-assured/templates/java-testng/pom.xml +7 -0
- package/.claude/skills/rest-assured/templates/java-testng/src/test/java/automation/{api/ApiConfig.java → config/Env.java} +35 -22
- package/.claude/skills/rest-assured/templates/java-testng/src/test/java/automation/config/Flags.java +17 -0
- package/.claude/skills/rest-assured/templates/java-testng/src/test/java/automation/config/Paths.java +14 -0
- package/.claude/skills/rest-assured/templates/java-testng/src/test/java/automation/desc/ProductsDesc.java +26 -0
- package/.claude/skills/rest-assured/templates/java-testng/src/test/java/automation/fixtures/BaseTest.java +29 -0
- package/.claude/skills/rest-assured/templates/java-testng/src/test/java/automation/services/ApiSpec.java +31 -0
- package/.claude/skills/rest-assured/templates/java-testng/src/test/java/automation/services/HealthApi.java +17 -0
- package/.claude/skills/rest-assured/templates/java-testng/src/test/java/automation/{api → services}/ProductsApi.java +19 -14
- package/.claude/skills/rest-assured/templates/java-testng/src/test/java/automation/{data → testData}/ProductBuilder.java +4 -8
- package/.claude/skills/rest-assured/templates/java-testng/src/test/java/automation/testData/TestData.java +64 -0
- package/.claude/skills/rest-assured/templates/java-testng/src/test/java/automation/tests/api/ProductsTest.java +49 -0
- package/.claude/skills/rest-assured/templates/java-testng/src/test/java/automation/tests/unit/UtilsTest.java +34 -0
- 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
- package/.claude/skills/rest-assured/templates/java-testng/src/test/java/automation/utils/Case.java +20 -0
- package/.claude/skills/rest-assured/templates/java-testng/src/test/java/automation/utils/CaseTransformer.java +54 -0
- package/.claude/skills/rest-assured/templates/java-testng/src/test/java/automation/utils/Dates.java +42 -0
- package/.claude/skills/rest-assured/templates/java-testng/src/test/java/automation/utils/Log.java +45 -0
- package/.claude/skills/rest-assured/templates/java-testng/src/test/java/automation/utils/MissingSettingError.java +13 -0
- package/.claude/skills/rest-assured/templates/java-testng/src/test/java/automation/utils/RandomData.java +41 -0
- package/.claude/skills/rest-assured/templates/java-testng/src/test/java/automation/utils/Redact.java +33 -0
- package/.claude/skills/rest-assured/templates/java-testng/src/test/java/automation/utils/TestDescription.java +25 -0
- package/.claude/skills/rest-assured/templates/java-testng/src/test/resources/testData/testData.properties +14 -0
- package/.claude/skills/rest-assured/templates/java-testng/testng.xml +14 -0
- package/.claude/skills/selenium/SKILL.md +1 -1
- package/.claude/skills/selenium/templates/README.md +25 -13
- package/.claude/skills/selenium/templates/ci/github-actions-java.yml +5 -2
- package/.claude/skills/selenium/templates/csharp-nunit/.env.example +15 -0
- package/.claude/skills/selenium/templates/csharp-nunit/Automation.csproj +7 -0
- package/.claude/skills/selenium/templates/csharp-nunit/{Framework/Config.cs → Config/Env.cs} +33 -34
- package/.claude/skills/selenium/templates/csharp-nunit/Config/Flags.cs +39 -0
- package/.claude/skills/selenium/templates/csharp-nunit/Config/Paths.cs +31 -0
- package/.claude/skills/selenium/templates/csharp-nunit/{Framework → Driver}/DriverFactory.cs +16 -13
- package/.claude/skills/selenium/templates/csharp-nunit/Driver/DriverManager.cs +27 -0
- package/.claude/skills/selenium/templates/csharp-nunit/Fixtures/BaseTest.cs +56 -0
- package/.claude/skills/selenium/templates/csharp-nunit/{Pages → PageObjects}/BasePage.cs +44 -14
- package/.claude/skills/selenium/templates/csharp-nunit/PageObjects/HomePage.cs +21 -0
- package/.claude/skills/selenium/templates/csharp-nunit/PageObjects/LoginPage.cs +53 -0
- package/.claude/skills/selenium/templates/csharp-nunit/PageObjects/ShellPage.cs +22 -0
- package/.claude/skills/selenium/templates/csharp-nunit/Resources/Desc/SignInDesc.cs +23 -0
- package/.claude/skills/selenium/templates/csharp-nunit/Resources/TestData/TestData.cs +74 -0
- package/.claude/skills/selenium/templates/csharp-nunit/Resources/TestData/testData.json +14 -0
- package/.claude/skills/selenium/templates/csharp-nunit/Services/ApiClient.cs +71 -0
- package/.claude/skills/selenium/templates/csharp-nunit/Setup/AuthSetup.cs +104 -0
- package/.claude/skills/selenium/templates/csharp-nunit/Tests/Api/SessionTests.cs +23 -0
- package/.claude/skills/selenium/templates/csharp-nunit/Tests/Ui/SignInTests.cs +42 -0
- package/.claude/skills/selenium/templates/csharp-nunit/Tests/Unit/UtilsTests.cs +40 -0
- package/.claude/skills/selenium/templates/csharp-nunit/Utils/AutomationError.cs +15 -0
- package/.claude/skills/selenium/templates/csharp-nunit/Utils/Dates.cs +18 -0
- package/.claude/skills/selenium/templates/csharp-nunit/Utils/FormFill.cs +20 -0
- package/.claude/skills/selenium/templates/csharp-nunit/Utils/Log.cs +37 -0
- package/.claude/skills/selenium/templates/csharp-nunit/Utils/RandomData.cs +26 -0
- package/.claude/skills/selenium/templates/csharp-nunit/Utils/Redact.cs +22 -0
- package/.claude/skills/selenium/templates/csharp-nunit/Utils/TestDescription.cs +55 -0
- package/.claude/skills/selenium/templates/csharp-nunit/gitignore +6 -2
- package/.claude/skills/selenium/templates/java-testng/.env.example +12 -0
- package/.claude/skills/selenium/templates/java-testng/gitignore +5 -2
- package/.claude/skills/selenium/templates/java-testng/pom.xml +2 -0
- package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/{framework/Config.java → config/Env.java} +45 -55
- package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/config/Flags.java +50 -0
- package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/config/Paths.java +20 -0
- package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/desc/SignInDesc.java +30 -0
- package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/{framework → driver}/DriverFactory.java +15 -12
- package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/{framework → driver}/DriverManager.java +4 -7
- package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/fixtures/BaseTest.java +87 -0
- package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/{pages → pageObjects}/BasePage.java +41 -17
- package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/pageObjects/HomePage.java +32 -0
- package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/pageObjects/LoginPage.java +69 -0
- package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/pageObjects/ShellPage.java +34 -0
- package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/services/ApiClient.java +93 -0
- package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/setup/AuthSetup.java +125 -0
- package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/testData/TestData.java +88 -0
- package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/tests/api/SessionTest.java +23 -0
- package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/tests/ui/SignInTest.java +46 -0
- package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/tests/unit/UtilsTest.java +34 -0
- package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/utils/AutomationError.java +18 -0
- package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/utils/Case.java +20 -0
- package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/utils/CaseTransformer.java +54 -0
- package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/utils/Dates.java +42 -0
- package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/utils/FormFill.java +25 -0
- package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/utils/Log.java +45 -0
- package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/utils/MissingSettingError.java +13 -0
- package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/utils/RandomData.java +41 -0
- package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/utils/Redact.java +33 -0
- package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/utils/TestDescription.java +25 -0
- package/.claude/skills/selenium/templates/java-testng/src/test/resources/testData/testData.properties +11 -0
- package/.claude/skills/selenium/templates/java-testng/testng.xml +15 -5
- package/.claude/skills/selenium/templates/python-pytest/.env.example +12 -0
- package/.claude/skills/selenium/templates/python-pytest/conftest.py +63 -12
- package/.claude/skills/selenium/templates/python-pytest/gitignore +7 -2
- package/.claude/skills/selenium/templates/python-pytest/page_objects/__init__.py +1 -0
- package/.claude/skills/selenium/templates/python-pytest/{pages → page_objects}/base_page.py +20 -20
- package/.claude/skills/selenium/templates/python-pytest/page_objects/home_page.py +17 -0
- package/.claude/skills/selenium/templates/python-pytest/{pages → page_objects}/login_page.py +12 -14
- package/.claude/skills/selenium/templates/python-pytest/page_objects/shell_page.py +16 -0
- package/.claude/skills/selenium/templates/python-pytest/pytest.ini +6 -2
- package/.claude/skills/selenium/templates/python-pytest/requirements.txt +1 -0
- package/.claude/skills/selenium/templates/python-pytest/resources/__init__.py +1 -0
- package/.claude/skills/selenium/templates/python-pytest/resources/desc/__init__.py +1 -0
- package/.claude/skills/selenium/templates/python-pytest/resources/desc/sign_in_desc.py +27 -0
- package/.claude/skills/selenium/templates/python-pytest/resources/test_data/__init__.py +1 -0
- package/.claude/skills/selenium/templates/python-pytest/resources/test_data/test_data.py +25 -0
- package/.claude/skills/selenium/templates/python-pytest/setup/__init__.py +1 -0
- package/.claude/skills/selenium/templates/python-pytest/setup/auth.py +60 -0
- package/.claude/skills/selenium/templates/python-pytest/src/__init__.py +1 -0
- package/.claude/skills/selenium/templates/python-pytest/src/config/__init__.py +1 -0
- package/.claude/skills/selenium/templates/python-pytest/src/config/env.py +68 -0
- package/.claude/skills/selenium/templates/python-pytest/src/config/flags.py +40 -0
- package/.claude/skills/selenium/templates/python-pytest/src/config/load_env.py +16 -0
- package/.claude/skills/selenium/templates/python-pytest/src/config/paths.py +25 -0
- package/.claude/skills/selenium/templates/python-pytest/src/driver/__init__.py +1 -0
- package/.claude/skills/selenium/templates/python-pytest/{framework → src/driver}/driver_factory.py +11 -18
- package/.claude/skills/selenium/templates/python-pytest/{framework → src/driver}/driver_manager.py +3 -3
- package/.claude/skills/selenium/templates/python-pytest/src/services/__init__.py +1 -0
- package/.claude/skills/selenium/templates/python-pytest/src/services/api_client.py +89 -0
- package/.claude/skills/selenium/templates/python-pytest/tests/api/test_session.py +11 -0
- package/.claude/skills/selenium/templates/python-pytest/tests/ui/test_sign_in.py +34 -0
- package/.claude/skills/selenium/templates/python-pytest/tests/unit/test_utils.py +32 -0
- package/.claude/skills/selenium/templates/python-pytest/utils/__init__.py +1 -0
- package/.claude/skills/selenium/templates/python-pytest/utils/dates.py +23 -0
- package/.claude/skills/selenium/templates/python-pytest/utils/errors.py +28 -0
- package/.claude/skills/selenium/templates/python-pytest/utils/form_fill.py +29 -0
- package/.claude/skills/selenium/templates/python-pytest/utils/logger.py +40 -0
- package/.claude/skills/selenium/templates/python-pytest/utils/markers.py +6 -0
- package/.claude/skills/selenium/templates/python-pytest/utils/random_data.py +35 -0
- package/.claude/skills/selenium/templates/python-pytest/utils/redact.py +30 -0
- package/.claude/skills/selenium/templates/python-pytest/utils/titles.py +53 -0
- package/.claude/skills/self-healing/SKILL.md +2 -2
- package/.claude/skills/test-design/SKILL.md +1 -1
- package/.claude/skills/test-reporting/references/tool-mapping.md +13 -9
- package/.claude/skills/ui-observation/SKILL.md +8 -6
- package/.claude/skills/ui-observation/references/login-methods.md +1 -1
- package/.claude-plugin/plugin.json +15 -2
- package/.codex/agents/automation-strategist.toml +1 -0
- package/.codex/agents/change-agent.toml +1 -0
- package/.codex/agents/codebase-analyst.toml +1 -0
- package/.codex/agents/environment-discovery.toml +1 -0
- package/.codex/agents/evidence-validator.toml +1 -0
- package/.codex/agents/executor.toml +1 -0
- package/.codex/agents/failure-analyst.toml +1 -0
- package/.codex/agents/implementer.toml +2 -1
- package/.codex/agents/requirement-analyst.toml +1 -0
- package/.codex/agents/reviewer.toml +1 -0
- package/.codex/agents/test-reporter.toml +1 -0
- package/.codex/hooks.json +15 -0
- package/.cursor/commands/orion.md +1 -1
- package/.cursor/hooks.json +10 -0
- package/.devin/hooks.v1.json +13 -0
- package/.gemini/agents/automation-strategist.md +1 -0
- package/.gemini/agents/change-agent.md +1 -0
- package/.gemini/agents/codebase-analyst.md +1 -0
- package/.gemini/agents/environment-discovery.md +1 -0
- package/.gemini/agents/evidence-validator.md +1 -0
- package/.gemini/agents/executor.md +1 -0
- package/.gemini/agents/failure-analyst.md +1 -0
- package/.gemini/agents/implementer.md +2 -1
- package/.gemini/agents/requirement-analyst.md +1 -0
- package/.gemini/agents/reviewer.md +1 -0
- package/.gemini/agents/test-reporter.md +1 -0
- package/.gemini/commands/orion.toml +2 -2
- package/.github/hooks/orion-lean.json +13 -0
- package/.github/prompts/orion.prompt.md +2 -2
- package/.windsurf/workflows/orion.md +2 -2
- package/AGENTS.md +6 -6
- package/README.md +55 -140
- package/assets/architecture.svg +104 -0
- package/assets/run-flow.svg +1 -1
- package/bin/orion.mjs +6 -6
- package/hosts/gemini-extension/gemini-extension.json +1 -1
- package/hosts/gemini-extension/hooks/hooks.json +16 -0
- package/hosts/gemini-extension/policies/platform.toml +5 -0
- package/package.json +6 -1
- package/.claude/skills/appium/templates/project-java/src/test/java/automation/data/Cases.java +0 -37
- package/.claude/skills/appium/templates/project-java/src/test/java/automation/data/SignInData.java +0 -25
- package/.claude/skills/appium/templates/project-java/src/test/java/automation/flows/SignInFlow.java +0 -34
- package/.claude/skills/appium/templates/project-java/src/test/java/automation/framework/Account.java +0 -19
- package/.claude/skills/appium/templates/project-java/src/test/java/automation/screens/HomeScreen.java +0 -36
- package/.claude/skills/appium/templates/project-java/src/test/java/automation/screens/LoginScreen.java +0 -57
- package/.claude/skills/appium/templates/project-java/src/test/java/automation/tests/BaseTest.java +0 -33
- package/.claude/skills/appium/templates/project-java/src/test/java/automation/tests/SmokeTest.java +0 -17
- package/.claude/skills/httpclient/templates/csharp-nunit/Api/ApiClient.cs +0 -61
- package/.claude/skills/httpclient/templates/csharp-nunit/Api/ApiConfig.cs +0 -61
- package/.claude/skills/httpclient/templates/csharp-nunit/Api/ApiError.cs +0 -17
- package/.claude/skills/httpclient/templates/csharp-nunit/Data/Cases.cs +0 -41
- package/.claude/skills/httpclient/templates/csharp-nunit/Data/HealthData.cs +0 -11
- package/.claude/skills/httpclient/templates/csharp-nunit/Data/ProductBuilder.cs +0 -16
- package/.claude/skills/httpclient/templates/csharp-nunit/Data/ProductsData.cs +0 -17
- package/.claude/skills/httpclient/templates/csharp-nunit/Tests/HealthTests.cs +0 -18
- package/.claude/skills/httpclient/templates/csharp-nunit/Tests/ProductsTests.cs +0 -48
- package/.claude/skills/k6/templates/project/data/builders.js +0 -8
- package/.claude/skills/karate/templates/java-junit5/src/test/java/api/products.feature +0 -33
- package/.claude/skills/pact/templates/project/test/contract/products.contract.test.js +0 -45
- package/.claude/skills/playwright/templates/dotnet/Components/AccountMenu.cs +0 -23
- package/.claude/skills/playwright/templates/dotnet/Data/Cases.cs +0 -43
- package/.claude/skills/playwright/templates/dotnet/Data/SignInData.cs +0 -24
- package/.claude/skills/playwright/templates/dotnet/Flows/SignInFlow.cs +0 -51
- package/.claude/skills/playwright/templates/dotnet/Framework/AutomationError.cs +0 -17
- package/.claude/skills/playwright/templates/dotnet/Framework/Config.cs +0 -91
- package/.claude/skills/playwright/templates/dotnet/Pages/BasePage.cs +0 -57
- package/.claude/skills/playwright/templates/dotnet/Pages/HomePage.cs +0 -26
- package/.claude/skills/playwright/templates/dotnet/Pages/LoginPage.cs +0 -45
- package/.claude/skills/playwright/templates/dotnet/Tests/SmokeTests.cs +0 -47
- package/.claude/skills/playwright/templates/javascript/src/components/account-menu.component.js +0 -30
- package/.claude/skills/playwright/templates/javascript/src/config.js +0 -53
- package/.claude/skills/playwright/templates/javascript/src/data/accounts.js +0 -23
- package/.claude/skills/playwright/templates/javascript/src/data/cases.js +0 -49
- package/.claude/skills/playwright/templates/javascript/src/data/sign-in.data.js +0 -12
- package/.claude/skills/playwright/templates/javascript/src/flows/sign-in.flow.js +0 -53
- package/.claude/skills/playwright/templates/javascript/src/pages/base.page.js +0 -59
- package/.claude/skills/playwright/templates/javascript/src/pages/home.page.js +0 -31
- package/.claude/skills/playwright/templates/javascript/src/pages/login.page.js +0 -56
- package/.claude/skills/playwright/templates/javascript/tests/fixtures.js +0 -20
- package/.claude/skills/playwright/templates/javascript/tests/smoke.spec.js +0 -22
- package/.claude/skills/playwright/templates/project/src/components/account-menu.component.ts +0 -27
- package/.claude/skills/playwright/templates/project/src/config.ts +0 -56
- package/.claude/skills/playwright/templates/project/src/data/accounts.ts +0 -21
- package/.claude/skills/playwright/templates/project/src/data/cases.ts +0 -55
- package/.claude/skills/playwright/templates/project/src/data/sign-in.data.ts +0 -10
- package/.claude/skills/playwright/templates/project/src/flows/sign-in.flow.ts +0 -51
- package/.claude/skills/playwright/templates/project/src/pages/base.page.ts +0 -52
- package/.claude/skills/playwright/templates/project/src/pages/home.page.ts +0 -30
- package/.claude/skills/playwright/templates/project/src/pages/login.page.ts +0 -53
- package/.claude/skills/playwright/templates/project/tests/fixtures.ts +0 -25
- package/.claude/skills/playwright/templates/project/tests/smoke.spec.ts +0 -22
- package/.claude/skills/playwright/templates/python/components/__init__.py +0 -1
- package/.claude/skills/playwright/templates/python/components/account_menu.py +0 -22
- package/.claude/skills/playwright/templates/python/data/accounts.py +0 -14
- package/.claude/skills/playwright/templates/python/data/cases.py +0 -33
- package/.claude/skills/playwright/templates/python/data/sign_in_data.py +0 -9
- package/.claude/skills/playwright/templates/python/flows/sign_in.py +0 -63
- package/.claude/skills/playwright/templates/python/framework/config.py +0 -86
- package/.claude/skills/playwright/templates/python/pages/base_page.py +0 -51
- package/.claude/skills/playwright/templates/python/pages/home_page.py +0 -21
- package/.claude/skills/playwright/templates/python/pages/login_page.py +0 -40
- package/.claude/skills/playwright/templates/python/tests/test_smoke.py +0 -26
- package/.claude/skills/quality-checks/templates/playwright-ts/src/pages/scanned.page.ts +0 -16
- package/.claude/skills/quality-checks/templates/playwright-ts/tests/quality.spec.ts +0 -58
- package/.claude/skills/requests/templates/python-pytest/api/config.py +0 -43
- package/.claude/skills/requests/templates/python-pytest/api/errors.py +0 -15
- package/.claude/skills/requests/templates/python-pytest/data/builders.py +0 -16
- package/.claude/skills/requests/templates/python-pytest/data/cases.py +0 -30
- package/.claude/skills/requests/templates/python-pytest/data/health_data.py +0 -6
- package/.claude/skills/requests/templates/python-pytest/data/products_data.py +0 -10
- package/.claude/skills/requests/templates/python-pytest/tests/test_health.py +0 -12
- package/.claude/skills/requests/templates/python-pytest/tests/test_products.py +0 -25
- package/.claude/skills/rest-assured/templates/java-testng/src/test/java/automation/api/ApiError.java +0 -18
- package/.claude/skills/rest-assured/templates/java-testng/src/test/java/automation/api/ApiSpec.java +0 -29
- package/.claude/skills/rest-assured/templates/java-testng/src/test/java/automation/api/HealthApi.java +0 -21
- package/.claude/skills/rest-assured/templates/java-testng/src/test/java/automation/data/Cases.java +0 -45
- package/.claude/skills/rest-assured/templates/java-testng/src/test/java/automation/data/HealthData.java +0 -12
- package/.claude/skills/rest-assured/templates/java-testng/src/test/java/automation/data/ProductsData.java +0 -16
- package/.claude/skills/rest-assured/templates/java-testng/src/test/java/automation/tests/HealthTest.java +0 -15
- package/.claude/skills/rest-assured/templates/java-testng/src/test/java/automation/tests/ProductsTest.java +0 -37
- package/.claude/skills/selenium/templates/csharp-nunit/Components/AccountMenu.cs +0 -26
- package/.claude/skills/selenium/templates/csharp-nunit/Data/Cases.cs +0 -43
- package/.claude/skills/selenium/templates/csharp-nunit/Data/SignInData.cs +0 -24
- package/.claude/skills/selenium/templates/csharp-nunit/Flows/SignInFlow.cs +0 -51
- package/.claude/skills/selenium/templates/csharp-nunit/Framework/AutomationError.cs +0 -17
- package/.claude/skills/selenium/templates/csharp-nunit/Framework/DriverManager.cs +0 -26
- package/.claude/skills/selenium/templates/csharp-nunit/Pages/HomePage.cs +0 -28
- package/.claude/skills/selenium/templates/csharp-nunit/Pages/LoginPage.cs +0 -58
- package/.claude/skills/selenium/templates/csharp-nunit/Tests/BaseTest.cs +0 -22
- package/.claude/skills/selenium/templates/csharp-nunit/Tests/SmokeTests.cs +0 -37
- package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/components/AccountMenu.java +0 -37
- package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/data/Cases.java +0 -48
- package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/data/SignInData.java +0 -36
- package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/flows/SignInFlow.java +0 -60
- package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/framework/Account.java +0 -19
- package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/pages/HomePage.java +0 -45
- package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/pages/LoginPage.java +0 -78
- package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/tests/BaseTest.java +0 -33
- package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/tests/SmokeTest.java +0 -33
- package/.claude/skills/selenium/templates/python-pytest/components/__init__.py +0 -1
- package/.claude/skills/selenium/templates/python-pytest/components/account_menu.py +0 -19
- package/.claude/skills/selenium/templates/python-pytest/data/accounts.py +0 -14
- package/.claude/skills/selenium/templates/python-pytest/data/cases.py +0 -33
- package/.claude/skills/selenium/templates/python-pytest/data/sign_in_data.py +0 -9
- package/.claude/skills/selenium/templates/python-pytest/flows/__init__.py +0 -0
- package/.claude/skills/selenium/templates/python-pytest/flows/sign_in.py +0 -61
- package/.claude/skills/selenium/templates/python-pytest/framework/__init__.py +0 -0
- package/.claude/skills/selenium/templates/python-pytest/framework/config.py +0 -90
- package/.claude/skills/selenium/templates/python-pytest/pages/__init__.py +0 -0
- package/.claude/skills/selenium/templates/python-pytest/pages/home_page.py +0 -23
- package/.claude/skills/selenium/templates/python-pytest/tests/test_smoke.py +0 -25
- /package/.claude/skills/karate/templates/java-junit5/src/test/java/{api → tests/api}/delete-product.feature +0 -0
- /package/.claude/skills/playwright/templates/{python/data/__init__.py → dotnet/auth/.gitkeep} +0 -0
- /package/.claude/skills/playwright/templates/{python/flows/__init__.py → javascript/auth/.gitkeep} +0 -0
- /package/.claude/skills/playwright/templates/{python/framework/__init__.py → project/auth/.gitkeep} +0 -0
- /package/.claude/skills/playwright/templates/project/{src → utils}/errors.ts +0 -0
- /package/.claude/skills/playwright/templates/python/{pages/__init__.py → auth/.gitkeep} +0 -0
- /package/.claude/skills/quality-checks/templates/playwright-ts/src/checks/{page-health.ts → pageHealth.ts} +0 -0
- /package/.claude/skills/quality-checks/templates/playwright-ts/src/{api/graphql.ts → services/graphqlClient.ts} +0 -0
- /package/.claude/skills/{requests/templates/python-pytest/api/__init__.py → selenium/templates/csharp-nunit/auth/.gitkeep} +0 -0
- /package/.claude/skills/{requests/templates/python-pytest/data/__init__.py → selenium/templates/java-testng/auth/.gitkeep} +0 -0
- /package/.claude/skills/selenium/templates/python-pytest/{data/__init__.py → auth/.gitkeep} +0 -0
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Less code, more reuse: finds code in a suite that repeats or isn't needed (pattern rules U9, M1, M4, P17).
|
|
4
|
+
* Run by the implementer before it returns and by the reviewer on the diff; in assess mode on the whole suite.
|
|
5
|
+
* Release 1 is report-only: findings are listed in the RESULT and the run record, never a blocking review finding.
|
|
6
|
+
*
|
|
7
|
+
* Usage (from the workspace root):
|
|
8
|
+
* node .claude/skills/orion/scripts/reuse_check.mjs <suite folder> [--changed <git base>] [--json]
|
|
9
|
+
* --changed limits the report to findings that touch files changed since <git base> (plus untracked files).
|
|
10
|
+
*
|
|
11
|
+
* Reports, each with file:line:
|
|
12
|
+
* duplicate the same function body (3+ statements, whitespace, comments and literal values ignored) in two places
|
|
13
|
+
* locator the same locator in two page objects → one place (a shared screen part or ShellPage)
|
|
14
|
+
* sequence the same 3+ statements in a row in two tests or fixtures → one page method or fixture
|
|
15
|
+
* pass-through a method that only calls another method with the same arguments (M1)
|
|
16
|
+
* unused a page, helper or service method no other file or line refers to
|
|
17
|
+
* same-name two non-test functions with the same name in different files (inferred: may do the same job)
|
|
18
|
+
* Limits (said in the output): regular expressions, not a parser; renamed variables hide a duplicate; a method used
|
|
19
|
+
* only through reflection or a framework hook may show as unused (annotated and override methods are skipped).
|
|
20
|
+
* Exit code: 0 nothing found · 1 findings · 2 wrong arguments.
|
|
21
|
+
*/
|
|
22
|
+
import fs from 'node:fs';
|
|
23
|
+
import path from 'node:path';
|
|
24
|
+
import { execFileSync } from 'node:child_process';
|
|
25
|
+
import { scan } from './lib/scan.mjs';
|
|
26
|
+
|
|
27
|
+
const LANG = (f) => (/\.m?[jt]sx?$/.test(f) ? 'js' : /\.py$/.test(f) ? 'py' : /\.(java|kt)$/.test(f) ? 'java' : /\.cs$/.test(f) ? 'cs' : null);
|
|
28
|
+
const KEYWORDS = new Set(['if', 'for', 'while', 'switch', 'catch', 'return', 'function', 'new', 'else', 'using', 'lock', 'foreach',
|
|
29
|
+
'await', 'throw', 'typeof', 'super', 'this', 'synchronized', 'try', 'do', 'base', 'constructor', 'get', 'set', 'static', 'async']);
|
|
30
|
+
const HOOK_NAMES = new Set(['main', 'toString', 'equals', 'hashCode', 'run', 'setup', 'teardown', 'setUp', 'tearDown', 'dispose',
|
|
31
|
+
'Dispose', 'DisposeAsync', 'onStart', 'onFinish', 'beforeAll', 'afterAll', 'beforeEach', 'afterEach', '__init__', '__repr__',
|
|
32
|
+
'__str__', '__enter__', '__exit__', 'transform', 'ApplyToTest', 'ApplyToContext', 'globalSetup', 'globalTeardown', 'redirect_request', 'http_error_default']);
|
|
33
|
+
|
|
34
|
+
/** Lines without comments; string literals become "S" and numbers N (so values don't hide a duplicate). */
|
|
35
|
+
function normalise(line) {
|
|
36
|
+
return line.replace(/\/\/.*$|#(?![\w{]).*$/, '').replace(/(['"`])(?:\\.|(?!\1).)*\1/g, '"S"').replace(/\b\d+(\.\d+)?\b/g, 'N')
|
|
37
|
+
.replace(/\s+/g, ' ').trim();
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** Functions in one file: name, start line, statement lines (normalised), raw body, annotated/override flag, params. */
|
|
41
|
+
export function functionsOf(text, lang) {
|
|
42
|
+
const lines = text.split('\n');
|
|
43
|
+
const out = [];
|
|
44
|
+
if (lang === 'py') {
|
|
45
|
+
lines.forEach((line, i) => {
|
|
46
|
+
const m = line.match(/^(\s*)(?:async\s+)?def\s+(\w+)\s*\(([^)]*)\)/);
|
|
47
|
+
if (!m) return;
|
|
48
|
+
const indent = m[1].length;
|
|
49
|
+
const body = [];
|
|
50
|
+
let j = i + 1;
|
|
51
|
+
for (; j < lines.length; j++) {
|
|
52
|
+
const l = lines[j];
|
|
53
|
+
if (l.trim() && (l.length - l.trimStart().length) <= indent) break;
|
|
54
|
+
body.push(l);
|
|
55
|
+
}
|
|
56
|
+
const decorated = i > 0 && /^\s*@/.test(lines[i - 1]);
|
|
57
|
+
const stmts = body.map(normalise).filter((s) => s && !/^("S"|''')$/.test(s) && !/^"""/.test(s));
|
|
58
|
+
out.push({ name: m[2], line: i + 1, params: m[3], stmts, decorated, toolkit: /@toolkit/.test(body.slice(0, 4).join(' ')), body: body.join('\n') });
|
|
59
|
+
});
|
|
60
|
+
return out;
|
|
61
|
+
}
|
|
62
|
+
const head = lang === 'js'
|
|
63
|
+
? /^\s*(?:export\s+)?(?:async\s+)?(?:function\s+(\w+)\s*\(([^)]*)\)|(?:static\s+)?(?:async\s+)?(?!if\b|for\b|while\b|switch\b|catch\b|return\b)(\w+)\s*\(([^)]*)\)\s*\{|(?:export\s+)?const\s+(\w+)\s*=\s*(?:async\s*)?\(([^)]*)\)\s*=>\s*\{)/
|
|
64
|
+
: /^\s*(?:(?:public|protected|private|internal|static|final|async|override|virtual|abstract|synchronized|sealed|partial)\s+)*(?:[\w<>[\],.?]+\s+)+(\w+)\s*\(([^)]*)\)\s*(?:throws\s+[\w.,\s]+)?(?:\{|=>.*)?\s*$/;
|
|
65
|
+
const testHead = /^\s*(?:test|it)(?:\.(?!describe\b)\w+)?\(\s*(?:(['"`])(.+?)\1|(titleOf\(\w+\)|[\w.[\]'"]+))[^\n]*=>\s*\{\s*$/;
|
|
66
|
+
for (let i = 0; i < lines.length; i++) {
|
|
67
|
+
const t = lang === 'js' && lines[i].match(testHead);
|
|
68
|
+
const m = t ? [null, `test: ${t[2] || t[3]}`, ''] : lines[i].match(head);
|
|
69
|
+
if (!m) continue;
|
|
70
|
+
const name = m[1] || m[3] || m[5];
|
|
71
|
+
if (!name || KEYWORDS.has(name)) continue;
|
|
72
|
+
let doc = ''; for (let d = i - 1; d >= 0 && d >= i - 12; d--) { if (/^\s*(\/\*\*|\*|\/\/\/|\/\/|@|\[)/.test(lines[d])) doc = lines[d] + doc; else break; }
|
|
73
|
+
const params = m[2] ?? m[4] ?? m[6] ?? '';
|
|
74
|
+
let depth = 0; let started = false; const body = []; let j = i;
|
|
75
|
+
const arrow = lang !== 'js' && /\)\s*=>/.test(lines[i]);
|
|
76
|
+
if (arrow) { // C#/Java expression-bodied member: the body runs to the first line ending in ';'
|
|
77
|
+
const first = lines[i].split('=>').slice(1).join('=>');
|
|
78
|
+
if (first.trim()) body.push(first);
|
|
79
|
+
for (j = first.trim().endsWith(';') ? i : i + 1; j < lines.length && j !== i; j++) { body.push(lines[j]); if (/;\s*$/.test(lines[j])) break; }
|
|
80
|
+
body.push('}');
|
|
81
|
+
started = true;
|
|
82
|
+
}
|
|
83
|
+
for (; !arrow && j < lines.length; j++) {
|
|
84
|
+
for (const ch of lines[j].replace(/(['"`])(?:\\.|(?!\1).)*\1/g, '""')) {
|
|
85
|
+
if (ch === '{') { depth++; started = true; } else if (ch === '}') depth--;
|
|
86
|
+
}
|
|
87
|
+
if (j > i) body.push(lines[j]);
|
|
88
|
+
if (started && depth <= 0) break;
|
|
89
|
+
if (!started && j > i + 1) break;
|
|
90
|
+
}
|
|
91
|
+
if (!started) continue;
|
|
92
|
+
let k = i - 1; let decorated = false;
|
|
93
|
+
while (k >= 0 && /^\s*(@\w|\[\w|\/\/|\*|\/\*\*)/.test(lines[k])) { if (/^\s*(@\w|\[\w)/.test(lines[k])) decorated = true; k--; }
|
|
94
|
+
if (/\boverride\b/.test(lines[i])) decorated = true;
|
|
95
|
+
const stmts = body.slice(0, -1).map(normalise).filter((s) => s && s !== '{' && s !== '}');
|
|
96
|
+
out.push({ name, line: i + 1, params, stmts, decorated, toolkit: /@toolkit/.test(doc), body: body.join('\n') });
|
|
97
|
+
}
|
|
98
|
+
return out;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/** Locator expressions in a page object: the call and its first string argument. */
|
|
102
|
+
function locatorsOf(text) {
|
|
103
|
+
const out = [];
|
|
104
|
+
text.split('\n').forEach((line, i) => {
|
|
105
|
+
for (const m of line.matchAll(/\b(locator|getBy\w+|get_by_\w+|By\.\w+|FindElement|find_element|cy\.get|\$)\(([^()]*(?:\([^()]*\)[^()]*)*)\)/g)) {
|
|
106
|
+
if (!/['"`]/.test(m[2])) continue;
|
|
107
|
+
out.push({ key: `${m[1].replace(/^get_by_/, 'getBy_')}(${m[2].replace(/\s+/g, '')})`, line: i + 1 });
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
return out;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function changedFiles(root, base) {
|
|
114
|
+
// A value starting with '-' would reach git as an option (e.g. `--output=<file>` writes anywhere): refs only.
|
|
115
|
+
if (!/^[\w][\w./~^@{}-]*$/.test(base)) { console.log(`--changed takes a commit or ref, got ${JSON.stringify(base)}`); process.exit(2); }
|
|
116
|
+
const run = (args) => execFileSync('git', ['-C', root, ...args], { encoding: 'utf8' }).split('\n').filter(Boolean);
|
|
117
|
+
const top = execFileSync('git', ['-C', root, 'rev-parse', '--show-toplevel'], { encoding: 'utf8' }).trim();
|
|
118
|
+
const rel = (f) => path.relative(path.resolve(root), path.join(top, f)).split(path.sep).join('/');
|
|
119
|
+
return new Set([...run(['diff', '--name-only', base, '--']).map(rel), ...run(['ls-files', '--others', '--exclude-standard']).map((f) => f)]);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/** All findings for a suite folder. */
|
|
123
|
+
export function reuseCheck(root) {
|
|
124
|
+
const s = scan(root);
|
|
125
|
+
const roleOf = new Map();
|
|
126
|
+
for (const [role, list] of Object.entries(s.files)) for (const f of list) roleOf.set(f, role);
|
|
127
|
+
for (const t of s.tests) roleOf.set(t.file, 'tests');
|
|
128
|
+
const sources = [...roleOf.keys()].filter((f) => LANG(f) && !/(^|\/)tests?\/unit\/|Tests\/Unit\//.test(f));
|
|
129
|
+
const text = new Map(sources.map((f) => [f, fs.readFileSync(path.join(root, f), 'utf8')]));
|
|
130
|
+
// Usage is counted over every source file in the suite (setup, config, unit tests too), not only the ones with a role.
|
|
131
|
+
const every = [];
|
|
132
|
+
const walk = (dir) => {
|
|
133
|
+
for (const e of fs.readdirSync(dir, { withFileTypes: true })) {
|
|
134
|
+
if (e.isDirectory()) { if (!/^(node_modules|\.git|target|bin|obj|\.venv|venv|__pycache__|test-results|playwright-report|reports|TestResults)$/.test(e.name)) walk(path.join(dir, e.name)); }
|
|
135
|
+
else if (LANG(e.name) || /\.(feature|json)$/.test(e.name)) every.push(path.join(dir, e.name));
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
walk(root);
|
|
139
|
+
const allText = every.map((f) => { try { return fs.readFileSync(f, 'utf8'); } catch { return ''; } }).join('\n');
|
|
140
|
+
const toolkitFile = new Set(sources.filter((f) => /@toolkit/.test(text.get(f).split('\n').slice(0, 15).join('\n'))));
|
|
141
|
+
const findings = [];
|
|
142
|
+
const fns = [];
|
|
143
|
+
for (const f of sources) for (const fn of functionsOf(text.get(f), LANG(f))) fns.push({ ...fn, file: f, role: roleOf.get(f) });
|
|
144
|
+
|
|
145
|
+
// duplicate bodies
|
|
146
|
+
const byBody = new Map();
|
|
147
|
+
for (const fn of fns) {
|
|
148
|
+
if (fn.stmts.length < 3) continue;
|
|
149
|
+
// Parameter names don't make two bodies different: priceToCents(label) and toCents(text) are the same job.
|
|
150
|
+
const names = fn.params.split(',').map((p) => p.trim().replace(/[:=].*$/, '').replace(/^.*\s/, '').replace(/^[*{[(]+|[)}\]]+$/g, '')).filter((p) => /^\w+$/.test(p) && !['self', 'this'].includes(p));
|
|
151
|
+
const k = fn.stmts.map((st) => names.reduce((t, p, i) => t.replace(new RegExp(`\\b${p}\\b`, 'g'), `P${i}`), st)).join('\n');
|
|
152
|
+
if (!byBody.has(k)) byBody.set(k, []);
|
|
153
|
+
byBody.get(k).push(fn);
|
|
154
|
+
}
|
|
155
|
+
for (const list of byBody.values()) {
|
|
156
|
+
if (list.length < 2) continue;
|
|
157
|
+
const [first, ...rest] = list;
|
|
158
|
+
for (const fn of rest) findings.push({ kind: 'duplicate', rule: 'M4', file: fn.file, line: fn.line, what: `${fn.name}() has the same body as ${first.name}() at ${first.file}:${first.line}`, also: [`${first.file}:${first.line}`] });
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
// the same locator in two page objects
|
|
162
|
+
const byLoc = new Map();
|
|
163
|
+
for (const f of s.files.pages) for (const l of locatorsOf(text.get(f) || '')) {
|
|
164
|
+
if (!byLoc.has(l.key)) byLoc.set(l.key, []);
|
|
165
|
+
byLoc.get(l.key).push({ file: f, line: l.line });
|
|
166
|
+
}
|
|
167
|
+
for (const [key, list] of byLoc) {
|
|
168
|
+
const files = [...new Set(list.map((x) => x.file))];
|
|
169
|
+
if (files.length < 2) continue;
|
|
170
|
+
findings.push({ kind: 'locator', rule: 'P17', file: list[1].file, line: list[1].line, what: `${key} is also in ${list[0].file}:${list[0].line}: keep it in one page object or a shared screen part`, also: [`${list[0].file}:${list[0].line}`] });
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// repeated 3+ statement sequences in tests and fixtures
|
|
174
|
+
const windows = new Map();
|
|
175
|
+
for (const fn of fns.filter((x) => x.role === 'tests' || x.role === 'fixtures')) {
|
|
176
|
+
const st = fn.stmts.filter((x) => !/^(expect|assert|Assert)\b/.test(x));
|
|
177
|
+
for (let i = 0; i + 3 <= st.length; i++) {
|
|
178
|
+
const k = st.slice(i, i + 3).join('\n');
|
|
179
|
+
if (!/\(/.test(k)) continue;
|
|
180
|
+
if (!windows.has(k)) windows.set(k, []);
|
|
181
|
+
windows.get(k).push(fn);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
const seenSeq = new Set();
|
|
185
|
+
for (const list of windows.values()) {
|
|
186
|
+
const distinct = [...new Map(list.map((fn) => [`${fn.file}:${fn.line}`, fn])).values()];
|
|
187
|
+
if (distinct.length < 2) continue;
|
|
188
|
+
const at = distinct[1];
|
|
189
|
+
const k = `${at.file}:${at.line}`;
|
|
190
|
+
if (seenSeq.has(k)) continue;
|
|
191
|
+
seenSeq.add(k);
|
|
192
|
+
findings.push({ kind: 'sequence', rule: 'M4', file: at.file, line: at.line, what: `the same 3+ steps also run in ${distinct[0].file}:${distinct[0].line} (${distinct[0].name}): one page method or fixture`, also: [`${distinct[0].file}:${distinct[0].line}`] });
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
// pass-through methods
|
|
196
|
+
for (const fn of fns) {
|
|
197
|
+
if (fn.stmts.length !== 1 || fn.decorated || fn.name === path.basename(fn.file).replace(/\.\w+$/, '')) continue;
|
|
198
|
+
const args = fn.params.split(',').map((p) => p.trim().replace(/[:=].*$/, '').replace(/^.*\s/, '').replace(/^(self|this)$/, '')).filter(Boolean).join(',');
|
|
199
|
+
const m = fn.stmts[0].match(/^(?:return\s+)?(?:await\s+)?(?:this\.|self\.)?(\w+)\((.*)\);?$/);
|
|
200
|
+
if (m && !['super', 'base'].includes(m[1]) && m[1] !== fn.name && m[2].replace(/\s/g, '') === args && args) {
|
|
201
|
+
findings.push({ kind: 'pass-through', rule: 'M1', file: fn.file, line: fn.line, what: `${fn.name}() only calls ${m[1]}() with the same arguments: call ${m[1]}() directly or give it a user-level name` });
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
// unused page/helper/service methods
|
|
206
|
+
for (const fn of fns.filter((x) => ['pages', 'helpers', 'services'].includes(x.role))) {
|
|
207
|
+
if (fn.decorated || fn.toolkit || toolkitFile.has(fn.file) || HOOK_NAMES.has(fn.name) || /^test: /.test(fn.name) || /^_/.test(fn.name) || fn.name === path.basename(fn.file).replace(/\.\w+$/, '')) continue;
|
|
208
|
+
const uses = (allText.match(new RegExp(`\\b${fn.name}\\b`, 'g')) || []).length;
|
|
209
|
+
if (uses <= 1) findings.push({ kind: 'unused', rule: 'U9', file: fn.file, line: fn.line, what: `${fn.name}() is never called` });
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
// same name in two files (non-test)
|
|
213
|
+
const byName = new Map();
|
|
214
|
+
for (const fn of fns.filter((x) => ['pages', 'helpers', 'services', 'fixtures', 'data', 'config'].includes(x.role) && !x.decorated && !HOOK_NAMES.has(x.name))) {
|
|
215
|
+
if (!byName.has(fn.name)) byName.set(fn.name, []);
|
|
216
|
+
byName.get(fn.name).push(fn);
|
|
217
|
+
}
|
|
218
|
+
for (const [name, all] of byName) {
|
|
219
|
+
const list = all.filter((x) => x.stmts.length >= 3 && x.role === all[0].role);
|
|
220
|
+
const files = [...new Set(list.map((x) => x.file))];
|
|
221
|
+
if (files.length < 2 || list.every((x) => x.role === 'pages') && ['open', 'goto', 'isReady', 'waitUntilReady', 'is_ready', 'IsReady'].includes(name)) continue;
|
|
222
|
+
const dupBodies = new Set(list.map((x) => x.stmts.join('\n')));
|
|
223
|
+
if (dupBodies.size === 1 && list[0].stmts.length >= 3) continue; // already reported as duplicate
|
|
224
|
+
findings.push({ kind: 'same-name', rule: 'U9', file: list[1].file, line: list[1].line, what: `${name}() also exists in ${list[0].file}:${list[0].line}; check it isn't the same job (inferred)`, also: [`${list[0].file}:${list[0].line}`], tag: 'inferred' });
|
|
225
|
+
}
|
|
226
|
+
findings.sort((a, b) => a.file.localeCompare(b.file) || a.line - b.line);
|
|
227
|
+
return { root, findings, functions: fns.length, limits: [
|
|
228
|
+
'regular expressions, not a parser: renamed variables hide a duplicate',
|
|
229
|
+
'a method used only through reflection, a fixture name or a framework hook can show as unused (annotated and override methods are skipped)',
|
|
230
|
+
'unit tests are left out; same-name findings are leads for the reviewer, not proof'] };
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
function main() {
|
|
234
|
+
const args = process.argv.slice(2);
|
|
235
|
+
const root = args.find((a) => !a.startsWith('--') && args[args.indexOf(a) - 1] !== '--changed');
|
|
236
|
+
if (!root || !fs.existsSync(root) || !fs.statSync(root).isDirectory()) {
|
|
237
|
+
console.log('usage: node .claude/skills/orion/scripts/reuse_check.mjs <suite folder> [--changed <git base>] [--json]');
|
|
238
|
+
process.exit(2);
|
|
239
|
+
}
|
|
240
|
+
const r = reuseCheck(root.replace(/[\\/]+$/, ''));
|
|
241
|
+
if (args.includes('--changed')) {
|
|
242
|
+
const changed = changedFiles(root, args[args.indexOf('--changed') + 1]);
|
|
243
|
+
r.findings = r.findings.filter((f) => changed.has(f.file) || (f.also || []).some((a) => changed.has(a.split(':')[0])));
|
|
244
|
+
}
|
|
245
|
+
if (args.includes('--json')) { process.stdout.write(`${JSON.stringify(r, null, 2)}\n`); process.exit(r.findings.length ? 1 : 0); }
|
|
246
|
+
for (const f of r.findings) console.log(`${r.root}/${f.file}:${f.line}: ${f.kind} (${f.rule}${f.tag ? `, ${f.tag}` : ''}): ${f.what}`);
|
|
247
|
+
console.log(`reuse check: ${r.findings.length} finding(s) in ${r.functions} functions (report-only)`);
|
|
248
|
+
process.exit(r.findings.length ? 1 : 0);
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
if (process.argv[1] && path.resolve(process.argv[1]) === path.resolve(new URL(import.meta.url).pathname)) main();
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Rules digest: prints only the section of a skill or reference file that a step needs, instead of the whole file.
|
|
4
|
+
* In measured runs the agent's largest tool output was Orion's own rule files dumped whole (`conversation.md`,
|
|
5
|
+
* `setup-card.md`, 9–24 KB per read) and then re-read on every later turn (evals/workflows/runs/2026-11-18-cost-
|
|
6
|
+
* breakdown.md). Orion's own version of the "knowledge graph instead of whole files" idea, for its rules.
|
|
7
|
+
*
|
|
8
|
+
* Usage (from the workspace root; a plugin install: run it from the skill's own folder):
|
|
9
|
+
* node .claude/skills/orion/scripts/rules.mjs <file> --list the sections, each with its size
|
|
10
|
+
* node .claude/skills/orion/scripts/rules.mjs <file> <words>... the section(s) whose title holds all the words
|
|
11
|
+
* node .claude/skills/orion/scripts/rules.mjs <file> --all the whole file (only when you need all of it)
|
|
12
|
+
* <file>: a path, or a short name looked up under .claude/skills/ (`conversation`, `setup-card`, `orion/SKILL`,
|
|
13
|
+
* `execution/SKILL`, `delivery-formats`, …).
|
|
14
|
+
* Sections are the Markdown headings (##, ###) and the top-level numbered items of a list (`3.`, `3b.`, `10.`), whose
|
|
15
|
+
* title is their bold text. Fenced code blocks inside a section stay with it. Output is capped at 8 KB unless --all.
|
|
16
|
+
* Exit code: 0 printed · 1 no section matched (the list is printed instead) · 2 wrong arguments or no such file.
|
|
17
|
+
*/
|
|
18
|
+
import fs from 'node:fs';
|
|
19
|
+
import path from 'node:path';
|
|
20
|
+
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
21
|
+
|
|
22
|
+
const CAP = 8 * 1024;
|
|
23
|
+
|
|
24
|
+
function resolve(name) {
|
|
25
|
+
if (fs.existsSync(name) && fs.statSync(name).isFile()) return name;
|
|
26
|
+
const roots = ['.claude/skills', path.join(path.dirname(fileURLToPath(import.meta.url)), '..', '..')];
|
|
27
|
+
for (const root of roots) {
|
|
28
|
+
if (!fs.existsSync(root)) continue;
|
|
29
|
+
const want = name.replace(/\.md$/, '').toLowerCase();
|
|
30
|
+
const hits = [];
|
|
31
|
+
const walk = (d) => {
|
|
32
|
+
for (const e of fs.readdirSync(d, { withFileTypes: true })) {
|
|
33
|
+
const p = path.join(d, e.name);
|
|
34
|
+
if (e.isDirectory()) { if (!['templates', 'node_modules', 'scripts'].includes(e.name)) walk(p); }
|
|
35
|
+
else if (e.name.endsWith('.md')) {
|
|
36
|
+
const rel = p.replace(/\\/g, '/').toLowerCase().replace(/\.md$/, '');
|
|
37
|
+
if (rel.endsWith(`/${want}`)) hits.push(p);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
walk(root);
|
|
42
|
+
if (hits.length === 1) return hits[0];
|
|
43
|
+
if (hits.length > 1) { console.log(`rules: "${name}" is ambiguous: ${hits.join(', ')}`); process.exit(2); }
|
|
44
|
+
}
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** Sections of a Markdown file: headings and top-level numbered items, with their line ranges. */
|
|
49
|
+
export function sections(text) {
|
|
50
|
+
const lines = text.split('\n');
|
|
51
|
+
const starts = [];
|
|
52
|
+
let fence = false;
|
|
53
|
+
lines.forEach((l, i) => {
|
|
54
|
+
if (/^\s*(```|~~~)/.test(l)) fence = !fence;
|
|
55
|
+
if (fence) return;
|
|
56
|
+
const h = l.match(/^(#{2,4})\s+(.*)/);
|
|
57
|
+
const n = l.match(/^(\d+[a-z]?)\.\s+(?:\*\*(.+?)\*\*)?(.*)/);
|
|
58
|
+
if (h) starts.push({ line: i, level: h[1].length, title: h[2].trim() });
|
|
59
|
+
else if (n) starts.push({ line: i, level: 9, title: `${n[1]}. ${(n[2] || n[3]).trim().slice(0, 90)}` });
|
|
60
|
+
});
|
|
61
|
+
return starts.map((s, k) => {
|
|
62
|
+
let end = lines.length;
|
|
63
|
+
for (let j = k + 1; j < starts.length; j++) {
|
|
64
|
+
if (starts[j].level <= s.level || (s.level === 9 && starts[j].level === 9) || (s.level < 9 && starts[j].level < 9 && starts[j].level <= s.level)) { end = starts[j].line; break; }
|
|
65
|
+
}
|
|
66
|
+
const body = lines.slice(s.line, end).join('\n').replace(/\s+$/, '');
|
|
67
|
+
return { title: s.title, start: s.line + 1, bytes: Buffer.byteLength(body), body };
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function main() {
|
|
72
|
+
const [name, ...rest] = process.argv.slice(2);
|
|
73
|
+
if (!name) { console.log('usage: node .claude/skills/orion/scripts/rules.mjs <file> (--list | --all | <words>...)'); process.exit(2); }
|
|
74
|
+
const file = resolve(name);
|
|
75
|
+
if (!file) { console.log(`rules: no such file: ${name}`); process.exit(2); }
|
|
76
|
+
const text = fs.readFileSync(file, 'utf8');
|
|
77
|
+
if (rest[0] === '--all') { process.stdout.write(text); return; }
|
|
78
|
+
const secs = sections(text);
|
|
79
|
+
const list = () => {
|
|
80
|
+
console.log(`${file} · ${Buffer.byteLength(text)} bytes · ${secs.length} sections (read one with: rules.mjs ${name} <words from its title>)`);
|
|
81
|
+
for (const s of secs) console.log(` ${String(s.start).padStart(4)} ${(s.bytes / 1024).toFixed(1).padStart(5)} KB ${s.title}`);
|
|
82
|
+
};
|
|
83
|
+
if (!rest.length || rest[0] === '--list') { list(); return; }
|
|
84
|
+
const words = rest.join(' ').toLowerCase().split(/\s+/).filter(Boolean);
|
|
85
|
+
const hits = secs.filter((s) => words.every((w) => s.title.toLowerCase().includes(w)));
|
|
86
|
+
if (!hits.length) { console.log(`rules: no section of ${file} has "${rest.join(' ')}" in its title`); list(); process.exit(1); }
|
|
87
|
+
let out = hits.map((s) => `<!-- ${file}:${s.start} · ${s.title} -->\n${s.body}`).join('\n\n');
|
|
88
|
+
if (Buffer.byteLength(out) > CAP) out = `${out.slice(0, CAP)}\n… cut at 8 KB: narrow the words, or use --all`;
|
|
89
|
+
console.log(out);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) main();
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Keeps the run file (`project-context/runs/R-….md`) up to date in one call per event, so the orchestrator spends no
|
|
4
|
+
* turns of its own on bookkeeping: it makes this call in the same turn as its next action (a parallel tool call).
|
|
5
|
+
* Times come from the clock when the call runs, never typed by the model. Measured reason: in the 2026-11-12 baseline,
|
|
6
|
+
* 27 of the orchestrator's ~60 tool calls were run-file and decision-log writes, each re-reading its whole context.
|
|
7
|
+
*
|
|
8
|
+
* Usage (from the workspace root); several actions in one call are separated by a lone `+`:
|
|
9
|
+
* node .claude/skills/orion/scripts/run_state.mjs init <key> --requirement "<text>" --workflow <new|existing|design|…>
|
|
10
|
+
* → creates project-context/runs/R-<YYYYMMDD>-<HHMM>-<key>.md from the template, adds the execution-history
|
|
11
|
+
* line, prints the run file path
|
|
12
|
+
* node .claude/skills/orion/scripts/run_state.mjs <run file> <action> [+ <action> …]
|
|
13
|
+
* Actions:
|
|
14
|
+
* gate <1-8> start "<task>" state ▶, Start = now
|
|
15
|
+
* gate <1-8> end <✓|✗|⏸|⛔> "<status>" state and End = now; the board follows (gate 5 sets Implementation
|
|
16
|
+
* and Review)
|
|
17
|
+
* retry <1-8> +1 in the gate's Retries column
|
|
18
|
+
* log <task> <agent> <decision> <status> <failure_class> <accepted> ["<note>"]
|
|
19
|
+
* one log row at the current time
|
|
20
|
+
* state <stack|ui_map|design|build|run|heals|code> "<value>" replaces that Run state line (code: the header line)
|
|
21
|
+
* metric <name>=<value> [<name>=<value> …] sets fields of the Metrics line (`stopped` defaults to now when given
|
|
22
|
+
* as `stopped=now`); `+1` adds one to a number (e.g. delegations=+1)
|
|
23
|
+
* Read-only (nothing is written; use them alone, not with `+`):
|
|
24
|
+
* status where the run stands, for a run cut off or picked up in a new session:
|
|
25
|
+
* each gate's state, the first gate not ✓ (the loop's next step), the
|
|
26
|
+
* gates already passed (not redone unless their inputs changed), the Run
|
|
27
|
+
* state lines and the last 3 log rows. Exit 0 open · 4 COMPLETE (gate 8 ✓)
|
|
28
|
+
* budget [--usage <usage.json>] minutes since the run started (and est. USD from usage_report.mjs's
|
|
29
|
+
* totals.usd_est, Claude Code only; else "unknown") against the run budget
|
|
30
|
+
* in project-context/retry-policy.md ("Run budget"; defaults 60 min, USD 10).
|
|
31
|
+
* Minutes are wall time since the run started, waits for the user included.
|
|
32
|
+
* Exit 0 within · 3 over (ask the user at the next gate: carry on or stop)
|
|
33
|
+
* Output: one line per action. Exit code: 0 done · 1 the run file or a row wasn't found · 2 wrong arguments.
|
|
34
|
+
* Never writes secrets: refuses a value that looks like `password=…`, a bearer token or a JWT.
|
|
35
|
+
*/
|
|
36
|
+
import fs from 'node:fs';
|
|
37
|
+
import path from 'node:path';
|
|
38
|
+
import { fileURLToPath } from 'node:url';
|
|
39
|
+
import { insideWorkspace } from './lib/inside.mjs';
|
|
40
|
+
|
|
41
|
+
const HERE = path.dirname(fileURLToPath(import.meta.url));
|
|
42
|
+
const TEMPLATE = path.join(HERE, '..', 'templates', 'project-context', 'run.md');
|
|
43
|
+
const BOARD = { 1: ['Requirement'], 2: ['Environment'], 3: ['Codebase'], 4: ['Strategy'], 5: ['Implementation', 'Review'],
|
|
44
|
+
6: ['Execution'], 7: ['Evidence'], 8: ['Final'] };
|
|
45
|
+
const STATE_KEYS = ['stack', 'ui_map', 'design', 'build', 'run', 'heals'];
|
|
46
|
+
|
|
47
|
+
const pad = (n) => String(n).padStart(2, '0');
|
|
48
|
+
function now() {
|
|
49
|
+
const d = new Date();
|
|
50
|
+
return { hm: `${pad(d.getHours())}:${pad(d.getMinutes())}`, id: `${d.getFullYear()}${pad(d.getMonth() + 1)}${pad(d.getDate())}-${pad(d.getHours())}${pad(d.getMinutes())}`,
|
|
51
|
+
iso: `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}T${pad(d.getHours())}:${pad(d.getMinutes())}` };
|
|
52
|
+
}
|
|
53
|
+
function die(code, msg) { console.log(msg); process.exit(code); }
|
|
54
|
+
const cell = (s) => String(s).replace(/\|/g, '/').replace(/\n/g, ' ').trim();
|
|
55
|
+
function noSecret(s) {
|
|
56
|
+
if (/(password|passwd|token|secret|api[_-]?key)\s*[:=]\s*\S{3,}|\bBearer\s+[A-Za-z0-9._~+/=-]{8,}|\beyJ[A-Za-z0-9_-]{8,}\./i.test(s)) {
|
|
57
|
+
die(2, `refused: the value looks like it holds a secret (AGENTS.md rule 5): ${s.slice(0, 40)}…`);
|
|
58
|
+
}
|
|
59
|
+
return s;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function init(argv) {
|
|
63
|
+
const key = argv[0];
|
|
64
|
+
const opt = {};
|
|
65
|
+
for (let i = 1; i < argv.length; i += 2) opt[argv[i].replace(/^--/, '')] = argv[i + 1];
|
|
66
|
+
if (!key || !/^[\w.-]+$/.test(key) || !opt.requirement) die(2, 'usage: run_state.mjs init <key> --requirement "<text>" --workflow <workflow>');
|
|
67
|
+
const t = now();
|
|
68
|
+
const dir = path.join('project-context', 'runs');
|
|
69
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
70
|
+
const file = path.join(dir, `R-${t.id}-${key}.md`);
|
|
71
|
+
if (fs.existsSync(file)) die(1, `exists: ${file}`);
|
|
72
|
+
let text = fs.readFileSync(TEMPLATE, 'utf8')
|
|
73
|
+
.replace('# Run R-<YYYYMMDD>-<HHMM>-<key>', `# Run R-${t.id}-${key}`)
|
|
74
|
+
.replace(/^requirement: .*$/m, `requirement: ${cell(noSecret(opt.requirement))} · started ${t.iso} · workflow: ${opt.workflow || 'new'}`)
|
|
75
|
+
.replace('started: <ISO>', `started: ${t.iso}`);
|
|
76
|
+
fs.writeFileSync(file, text);
|
|
77
|
+
const hist = path.join('project-context', 'execution-history.md');
|
|
78
|
+
if (fs.existsSync(hist)) fs.appendFileSync(hist, `- R-${t.id}-${key} · ${t.iso} · ${cell(opt.requirement)} · [run file](runs/R-${t.id}-${key}.md)\n`);
|
|
79
|
+
console.log(file);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/** Rewrite the board line(s) from the gate table's State column. */
|
|
83
|
+
function syncBoard(lines) {
|
|
84
|
+
const states = {};
|
|
85
|
+
for (const l of lines) { const m = l.match(/^\| ([1-8]) \| (\S+) \|/); if (m) states[m[1]] = m[2]; }
|
|
86
|
+
return lines.map((l) => (/^(Requirement|Review) /.test(l)
|
|
87
|
+
? l.replace(/(Requirement|Environment|Codebase|Strategy|Implementation|Review|Execution|Evidence|Final) (\S+)/g, (all, label) => {
|
|
88
|
+
const gate = Object.keys(BOARD).find((g) => BOARD[g].includes(label));
|
|
89
|
+
return `${label} ${states[gate] || '○'}`;
|
|
90
|
+
}) : l));
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function apply(lines, act, t) {
|
|
94
|
+
const [verb, ...a] = act;
|
|
95
|
+
const gateRow = (g) => lines.findIndex((l) => new RegExp(`^\\| ${g} \\|`).test(l));
|
|
96
|
+
if (verb === 'gate') {
|
|
97
|
+
const [g, what, ...rest] = a;
|
|
98
|
+
const i = gateRow(g);
|
|
99
|
+
if (i < 0 || !/^[1-8]$/.test(g)) die(1, `no gate row ${g}`);
|
|
100
|
+
const c = lines[i].split('|').map((x) => x.trim());
|
|
101
|
+
// c: ['', gate, state, agent, task, start, end, status, retries, '']
|
|
102
|
+
if (what === 'start') { c[2] = '▶'; c[4] = cell(noSecret(rest.join(' ') || c[4])); c[5] = t.hm; c[6] = ''; }
|
|
103
|
+
else if (what === 'end') { const [sym, ...st] = rest; if (!['✓', '✗', '⏸', '⛔'].includes(sym)) die(2, `gate end takes ✓ ✗ ⏸ or ⛔, got ${sym}`); c[2] = sym; c[6] = sym === '⏸' ? '' : t.hm; if (!c[5]) c[5] = t.hm; c[7] = cell(noSecret(st.join(' '))); }
|
|
104
|
+
else die(2, `gate ${g} start|end`);
|
|
105
|
+
lines[i] = `| ${c.slice(1, -1).join(' | ')} |`;
|
|
106
|
+
lines = syncBoard(lines);
|
|
107
|
+
console.log(`gate ${g} ${what} at ${t.hm}`);
|
|
108
|
+
} else if (verb === 'retry') {
|
|
109
|
+
const i = gateRow(a[0]);
|
|
110
|
+
if (i < 0) die(1, `no gate row ${a[0]}`);
|
|
111
|
+
const c = lines[i].split('|').map((x) => x.trim());
|
|
112
|
+
c[8] = String((parseInt(c[8], 10) || 0) + 1);
|
|
113
|
+
lines[i] = `| ${c.slice(1, -1).join(' | ')} |`;
|
|
114
|
+
console.log(`gate ${a[0]} retries ${c[8]}`);
|
|
115
|
+
} else if (verb === 'log') {
|
|
116
|
+
if (a.length < 6) die(2, 'log <task> <agent> <decision> <status> <failure_class> <accepted> ["<note>"]');
|
|
117
|
+
a.forEach(noSecret);
|
|
118
|
+
const [task, agent, decision, status, fc, accepted, ...note] = a;
|
|
119
|
+
const row = `| ${t.hm} | ${cell(noSecret([task, ...note].join(' ')))} | ${cell(agent)} | ${cell(decision)} | ${cell(status)} | ${cell(fc)} | ${cell(accepted)} |`;
|
|
120
|
+
let i = lines.findIndex((l) => /^### Log/.test(l));
|
|
121
|
+
if (i < 0) die(1, 'no ### Log section');
|
|
122
|
+
i += 3; // heading, header row, separator
|
|
123
|
+
while (i < lines.length && lines[i].startsWith('|')) i++;
|
|
124
|
+
lines.splice(i, 0, row);
|
|
125
|
+
console.log(`log ${task} ${decision}`);
|
|
126
|
+
} else if (verb === 'state') {
|
|
127
|
+
const [k, ...v] = a;
|
|
128
|
+
const value = cell(noSecret(v.join(' ')));
|
|
129
|
+
if (k === 'code') {
|
|
130
|
+
const i = lines.findIndex((l) => /^code: /.test(l));
|
|
131
|
+
if (i < 0) die(1, 'no code line');
|
|
132
|
+
lines[i] = `code: ${value}`;
|
|
133
|
+
} else {
|
|
134
|
+
if (!STATE_KEYS.includes(k)) die(2, `state takes ${STATE_KEYS.join(', ')} or code`);
|
|
135
|
+
const i = lines.findIndex((l) => l.startsWith(`- ${k}: `));
|
|
136
|
+
if (i < 0) die(1, `no Run state line for ${k}`);
|
|
137
|
+
lines[i] = `- ${k}: ${value}`;
|
|
138
|
+
}
|
|
139
|
+
console.log(`state ${k}`);
|
|
140
|
+
} else if (verb === 'metric') {
|
|
141
|
+
const i = lines.findIndex((l) => /^platform: /.test(l));
|
|
142
|
+
if (i < 0) die(1, 'no Metrics line');
|
|
143
|
+
let m = lines[i];
|
|
144
|
+
for (const pair of a) {
|
|
145
|
+
const eq = pair.indexOf('=');
|
|
146
|
+
if (eq < 1) die(2, `metric takes name=value, got ${pair}`);
|
|
147
|
+
const name = pair.slice(0, eq); let val = noSecret(pair.slice(eq + 1));
|
|
148
|
+
if (name === 'stopped' && val === 'now') val = t.iso;
|
|
149
|
+
const rx = new RegExp(`(^|· )${name.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}: ([^·]*?)( ·|$)`);
|
|
150
|
+
const cur = m.match(rx);
|
|
151
|
+
if (!cur) { m = `${m} · ${name}: ${val}`; continue; }
|
|
152
|
+
if (/^\+\d+$/.test(val)) val = String((parseInt(cur[2], 10) || 0) + parseInt(val.slice(1), 10));
|
|
153
|
+
m = m.replace(rx, (all, pre, _old, post) => `${pre}${name}: ${val}${post}`);
|
|
154
|
+
}
|
|
155
|
+
const st = m.match(/started: (\d{4}-\d\d-\d\dT\d\d:\d\d)/); const sp = m.match(/stopped: (\d{4}-\d\d-\d\dT\d\d:\d\d)/);
|
|
156
|
+
if (st && sp && a.some((p) => p.startsWith('stopped='))) {
|
|
157
|
+
const mins = Math.round((Date.parse(sp[1]) - Date.parse(st[1])) / 60000);
|
|
158
|
+
m = m.replace(/wall time: [^·]*?( ·|$)/, (all, post) => `wall time: ${mins} min${post}`);
|
|
159
|
+
}
|
|
160
|
+
lines[i] = m;
|
|
161
|
+
console.log(`metrics ${a.map((p) => p.split('=')[0]).join(', ')}`);
|
|
162
|
+
} else die(2, `unknown action ${verb}`);
|
|
163
|
+
return lines;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/** `status`: where a run stands, so a new session continues it instead of starting over. */
|
|
167
|
+
function status(file, lines) {
|
|
168
|
+
const gates = [];
|
|
169
|
+
for (const l of lines) {
|
|
170
|
+
const m = l.match(/^\| ([1-8]) \| (\S+) \| ([^|]*)\| ([^|]*)\| ([^|]*)\| ([^|]*)\| ([^|]*)\|/);
|
|
171
|
+
if (m) gates.push({ gate: +m[1], state: m[2], agent: m[3].trim(), task: m[4].trim(), status: m[7].trim() });
|
|
172
|
+
}
|
|
173
|
+
if (gates.length !== 8) die(1, `${file}: expected 8 gate rows, found ${gates.length}`);
|
|
174
|
+
const req = (lines.find((l) => /^requirement: /.test(l)) || '').slice(13);
|
|
175
|
+
console.log(`run: ${path.basename(file, '.md')} · ${req}`);
|
|
176
|
+
console.log(`gates: ${gates.map((g) => `${g.gate} ${g.state}`).join(' ')}`);
|
|
177
|
+
const done = gates.filter((g) => g.state === '✓').map((g) => g.gate);
|
|
178
|
+
const next = gates.find((g) => g.state !== '✓');
|
|
179
|
+
if (!next) { console.log('state: COMPLETE (gate 8 ✓): nothing to resume'); process.exit(4); }
|
|
180
|
+
console.log(`passed: ${done.length ? done.join(', ') : 'none'} (not redone unless the requirement, the code or the app changed since)`);
|
|
181
|
+
console.log(`next: gate ${next.gate} (${next.state}${next.task ? `, task: ${next.task}` : ''}${next.status ? `, last status: ${next.status}` : ''}) · ${next.agent}`);
|
|
182
|
+
for (const l of lines.filter((x) => /^- (stack|ui_map|design|build|run|heals): /.test(x))) {
|
|
183
|
+
console.log(`state ${/<[^>]+>/.test(l) ? `${l.slice(2, l.indexOf(':'))}: not recorded` : l.slice(2)}`);
|
|
184
|
+
}
|
|
185
|
+
const i = lines.findIndex((l) => /^### Log/.test(l));
|
|
186
|
+
const log = i < 0 ? [] : lines.slice(i + 3).filter((l, k, arr) => l.startsWith('|') && arr.slice(0, k).every((x) => x.startsWith('|')));
|
|
187
|
+
for (const l of log.slice(-3)) console.log(`log ${l}`);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/** `budget`: minutes (and est. USD where known) against the run budget in retry-policy.md. */
|
|
191
|
+
function budget(file, lines, rest) {
|
|
192
|
+
const req = (lines.find((l) => /^requirement: /.test(l)) || '');
|
|
193
|
+
const st = req.match(/started (\d{4}-\d\d-\d\dT\d\d:\d\d)/);
|
|
194
|
+
if (!st) die(1, `${file}: no start time on the requirement line`);
|
|
195
|
+
const mins = Math.round((Date.now() - new Date(st[1]).getTime()) / 60000);
|
|
196
|
+
const policy = path.join('project-context', 'retry-policy.md');
|
|
197
|
+
const ptext = fs.existsSync(policy) ? fs.readFileSync(policy, 'utf8') : '';
|
|
198
|
+
const limMin = +((ptext.match(/^- minutes:\s*(\d+)/m) || [])[1] || 60);
|
|
199
|
+
const limUsd = +((ptext.match(/^- usd:\s*([\d.]+)/m) || [])[1] || 10);
|
|
200
|
+
let usd = 'unknown';
|
|
201
|
+
const ui = rest.indexOf('--usage');
|
|
202
|
+
if (ui >= 0) {
|
|
203
|
+
const f = rest[ui + 1];
|
|
204
|
+
try { const v = JSON.parse(fs.readFileSync(f, 'utf8')).totals?.usd_est; if (typeof v === 'number') usd = v; } catch { /* stays unknown */ }
|
|
205
|
+
}
|
|
206
|
+
const over = [];
|
|
207
|
+
if (mins > limMin) over.push(`${mins} min of ${limMin}`);
|
|
208
|
+
if (typeof usd === 'number' && usd > limUsd) over.push(`est. USD ${usd.toFixed(2)} of ${limUsd}`);
|
|
209
|
+
console.log(`budget: ${mins} min of ${limMin} (wall time, waits included) · est. USD ${typeof usd === 'number' ? usd.toFixed(2) : 'unknown'} of ${limUsd}${ptext ? '' : ' (defaults: no project-context/retry-policy.md)'}`);
|
|
210
|
+
if (over.length) {
|
|
211
|
+
console.log(`over: ${over.join(', ')}: at the next gate, ask the user one line: carry on (and by how much) or stop here with what exists`);
|
|
212
|
+
process.exit(3);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
function main() {
|
|
217
|
+
const argv = process.argv.slice(2);
|
|
218
|
+
if (['status', 'budget'].includes(argv[1])) {
|
|
219
|
+
const file = argv[0];
|
|
220
|
+
if (!file || !fs.existsSync(file)) die(file ? 1 : 2, file ? `no run file ${file}` : 'usage: run_state.mjs <run file> status | budget [--usage <usage.json>]');
|
|
221
|
+
insideWorkspace(file, 'the run file');
|
|
222
|
+
const lines = fs.readFileSync(file, 'utf8').split('\n');
|
|
223
|
+
return argv[1] === 'status' ? status(file, lines) : budget(file, lines, argv.slice(2));
|
|
224
|
+
}
|
|
225
|
+
if (argv[0] === 'init') return init(argv.slice(1));
|
|
226
|
+
const file = argv[0];
|
|
227
|
+
if (!file || !fs.existsSync(file)) die(file ? 1 : 2, file ? `no run file ${file}` : 'usage: run_state.mjs <run file> <action> [+ <action> …] | init <key> …');
|
|
228
|
+
insideWorkspace(file, 'the run file');
|
|
229
|
+
const acts = [[]];
|
|
230
|
+
for (const x of argv.slice(1)) { if (x === '+') acts.push([]); else acts[acts.length - 1].push(x); }
|
|
231
|
+
if (!acts[0].length) die(2, 'no action');
|
|
232
|
+
const t = now();
|
|
233
|
+
let lines = fs.readFileSync(file, 'utf8').split('\n');
|
|
234
|
+
for (const act of acts) lines = apply(lines, act, t);
|
|
235
|
+
fs.writeFileSync(file, lines.join('\n'));
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
main();
|