@inluxc/propmaster 0.0.0-stage → 1.0.1
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/LICENSE +21 -0
- package/README.md +696 -2
- package/dist/src/annotations/index.d.ts +11 -0
- package/dist/src/annotations/index.d.ts.map +1 -0
- package/dist/src/annotations/index.js +11 -0
- package/dist/src/annotations/index.js.map +1 -0
- package/dist/src/annotations/recorder.d.ts +57 -0
- package/dist/src/annotations/recorder.d.ts.map +1 -0
- package/dist/src/annotations/recorder.js +100 -0
- package/dist/src/annotations/recorder.js.map +1 -0
- package/dist/src/annotations/truncation.d.ts +34 -0
- package/dist/src/annotations/truncation.d.ts.map +1 -0
- package/dist/src/annotations/truncation.js +54 -0
- package/dist/src/annotations/truncation.js.map +1 -0
- package/dist/src/auth/apply.d.ts +15 -0
- package/dist/src/auth/apply.d.ts.map +1 -0
- package/dist/src/auth/apply.js +21 -0
- package/dist/src/auth/apply.js.map +1 -0
- package/dist/src/auth/setup.d.ts +56 -0
- package/dist/src/auth/setup.d.ts.map +1 -0
- package/dist/src/auth/setup.js +79 -0
- package/dist/src/auth/setup.js.map +1 -0
- package/dist/src/auth/state-file.d.ts +8 -0
- package/dist/src/auth/state-file.d.ts.map +1 -0
- package/dist/src/auth/state-file.js +13 -0
- package/dist/src/auth/state-file.js.map +1 -0
- package/dist/src/auth/token-manager.d.ts +61 -0
- package/dist/src/auth/token-manager.d.ts.map +1 -0
- package/dist/src/auth/token-manager.js +200 -0
- package/dist/src/auth/token-manager.js.map +1 -0
- package/dist/src/cli/banner.d.ts +23 -0
- package/dist/src/cli/banner.d.ts.map +1 -0
- package/dist/src/cli/banner.js +67 -0
- package/dist/src/cli/banner.js.map +1 -0
- package/dist/src/cli/check-tests.d.ts +143 -0
- package/dist/src/cli/check-tests.d.ts.map +1 -0
- package/dist/src/cli/check-tests.js +541 -0
- package/dist/src/cli/check-tests.js.map +1 -0
- package/dist/src/cli/coverage.d.ts +14 -0
- package/dist/src/cli/coverage.d.ts.map +1 -0
- package/dist/src/cli/coverage.js +97 -0
- package/dist/src/cli/coverage.js.map +1 -0
- package/dist/src/cli/doctor.d.ts +82 -0
- package/dist/src/cli/doctor.d.ts.map +1 -0
- package/dist/src/cli/doctor.js +656 -0
- package/dist/src/cli/doctor.js.map +1 -0
- package/dist/src/cli/env.d.ts +76 -0
- package/dist/src/cli/env.d.ts.map +1 -0
- package/dist/src/cli/env.js +344 -0
- package/dist/src/cli/env.js.map +1 -0
- package/dist/src/cli/failures.d.ts +29 -0
- package/dist/src/cli/failures.d.ts.map +1 -0
- package/dist/src/cli/failures.js +114 -0
- package/dist/src/cli/failures.js.map +1 -0
- package/dist/src/cli/fixture-catalog.d.ts +83 -0
- package/dist/src/cli/fixture-catalog.d.ts.map +1 -0
- package/dist/src/cli/fixture-catalog.js +773 -0
- package/dist/src/cli/fixture-catalog.js.map +1 -0
- package/dist/src/cli/fixture.d.ts +149 -0
- package/dist/src/cli/fixture.d.ts.map +1 -0
- package/dist/src/cli/fixture.js +742 -0
- package/dist/src/cli/fixture.js.map +1 -0
- package/dist/src/cli/flaky.d.ts +25 -0
- package/dist/src/cli/flaky.d.ts.map +1 -0
- package/dist/src/cli/flaky.js +96 -0
- package/dist/src/cli/flaky.js.map +1 -0
- package/dist/src/cli/generate.d.ts +37 -0
- package/dist/src/cli/generate.d.ts.map +1 -0
- package/dist/src/cli/generate.js +230 -0
- package/dist/src/cli/generate.js.map +1 -0
- package/dist/src/cli/init.d.ts +36 -0
- package/dist/src/cli/init.d.ts.map +1 -0
- package/dist/src/cli/init.js +1039 -0
- package/dist/src/cli/init.js.map +1 -0
- package/dist/src/cli/json-edit.d.ts +58 -0
- package/dist/src/cli/json-edit.d.ts.map +1 -0
- package/dist/src/cli/json-edit.js +250 -0
- package/dist/src/cli/json-edit.js.map +1 -0
- package/dist/src/cli/layout.d.ts +31 -0
- package/dist/src/cli/layout.d.ts.map +1 -0
- package/dist/src/cli/layout.js +175 -0
- package/dist/src/cli/layout.js.map +1 -0
- package/dist/src/cli/mcp-setup.d.ts +141 -0
- package/dist/src/cli/mcp-setup.d.ts.map +1 -0
- package/dist/src/cli/mcp-setup.js +548 -0
- package/dist/src/cli/mcp-setup.js.map +1 -0
- package/dist/src/cli/organize.d.ts +136 -0
- package/dist/src/cli/organize.d.ts.map +1 -0
- package/dist/src/cli/organize.js +467 -0
- package/dist/src/cli/organize.js.map +1 -0
- package/dist/src/cli/prompts.d.ts +102 -0
- package/dist/src/cli/prompts.d.ts.map +1 -0
- package/dist/src/cli/prompts.js +346 -0
- package/dist/src/cli/prompts.js.map +1 -0
- package/dist/src/cli/standards.d.ts +160 -0
- package/dist/src/cli/standards.d.ts.map +1 -0
- package/dist/src/cli/standards.js +389 -0
- package/dist/src/cli/standards.js.map +1 -0
- package/dist/src/cli/style.d.ts +28 -0
- package/dist/src/cli/style.d.ts.map +1 -0
- package/dist/src/cli/style.js +57 -0
- package/dist/src/cli/style.js.map +1 -0
- package/dist/src/config/env-loader.d.ts +33 -0
- package/dist/src/config/env-loader.d.ts.map +1 -0
- package/dist/src/config/env-loader.js +72 -0
- package/dist/src/config/env-loader.js.map +1 -0
- package/dist/src/config/index.d.ts +10 -0
- package/dist/src/config/index.d.ts.map +1 -0
- package/dist/src/config/index.js +10 -0
- package/dist/src/config/index.js.map +1 -0
- package/dist/src/config/loader.d.ts +66 -0
- package/dist/src/config/loader.d.ts.map +1 -0
- package/dist/src/config/loader.js +810 -0
- package/dist/src/config/loader.js.map +1 -0
- package/dist/src/config/schema.d.ts +596 -0
- package/dist/src/config/schema.d.ts.map +1 -0
- package/dist/src/config/schema.js +9 -0
- package/dist/src/config/schema.js.map +1 -0
- package/dist/src/containers/container-manager.d.ts +157 -0
- package/dist/src/containers/container-manager.d.ts.map +1 -0
- package/dist/src/containers/container-manager.js +627 -0
- package/dist/src/containers/container-manager.js.map +1 -0
- package/dist/src/coverage/code-coverage.d.ts +89 -0
- package/dist/src/coverage/code-coverage.d.ts.map +1 -0
- package/dist/src/coverage/code-coverage.js +395 -0
- package/dist/src/coverage/code-coverage.js.map +1 -0
- package/dist/src/coverage/inventory.d.ts +80 -0
- package/dist/src/coverage/inventory.d.ts.map +1 -0
- package/dist/src/coverage/inventory.js +417 -0
- package/dist/src/coverage/inventory.js.map +1 -0
- package/dist/src/coverage/languages.d.ts +34 -0
- package/dist/src/coverage/languages.d.ts.map +1 -0
- package/dist/src/coverage/languages.js +156 -0
- package/dist/src/coverage/languages.js.map +1 -0
- package/dist/src/coverage/report.d.ts +128 -0
- package/dist/src/coverage/report.d.ts.map +1 -0
- package/dist/src/coverage/report.js +472 -0
- package/dist/src/coverage/report.js.map +1 -0
- package/dist/src/errors.d.ts +164 -0
- package/dist/src/errors.d.ts.map +1 -0
- package/dist/src/errors.js +267 -0
- package/dist/src/errors.js.map +1 -0
- package/dist/src/fixtures/amqp.fixture.d.ts +163 -0
- package/dist/src/fixtures/amqp.fixture.d.ts.map +1 -0
- package/dist/src/fixtures/amqp.fixture.js +494 -0
- package/dist/src/fixtures/amqp.fixture.js.map +1 -0
- package/dist/src/fixtures/appium.fixture.d.ts +112 -0
- package/dist/src/fixtures/appium.fixture.d.ts.map +1 -0
- package/dist/src/fixtures/appium.fixture.js +309 -0
- package/dist/src/fixtures/appium.fixture.js.map +1 -0
- package/dist/src/fixtures/aws.d.ts +44 -0
- package/dist/src/fixtures/aws.d.ts.map +1 -0
- package/dist/src/fixtures/aws.js +93 -0
- package/dist/src/fixtures/aws.js.map +1 -0
- package/dist/src/fixtures/cassandra.fixture.d.ts +179 -0
- package/dist/src/fixtures/cassandra.fixture.d.ts.map +1 -0
- package/dist/src/fixtures/cassandra.fixture.js +489 -0
- package/dist/src/fixtures/cassandra.fixture.js.map +1 -0
- package/dist/src/fixtures/clickhouse.fixture.d.ts +171 -0
- package/dist/src/fixtures/clickhouse.fixture.d.ts.map +1 -0
- package/dist/src/fixtures/clickhouse.fixture.js +514 -0
- package/dist/src/fixtures/clickhouse.fixture.js.map +1 -0
- package/dist/src/fixtures/database.fixture.d.ts +63 -0
- package/dist/src/fixtures/database.fixture.d.ts.map +1 -0
- package/dist/src/fixtures/database.fixture.js +407 -0
- package/dist/src/fixtures/database.fixture.js.map +1 -0
- package/dist/src/fixtures/dynamodb.fixture.d.ts +243 -0
- package/dist/src/fixtures/dynamodb.fixture.d.ts.map +1 -0
- package/dist/src/fixtures/dynamodb.fixture.js +580 -0
- package/dist/src/fixtures/dynamodb.fixture.js.map +1 -0
- package/dist/src/fixtures/graphql.fixture.d.ts +107 -0
- package/dist/src/fixtures/graphql.fixture.d.ts.map +1 -0
- package/dist/src/fixtures/graphql.fixture.js +158 -0
- package/dist/src/fixtures/graphql.fixture.js.map +1 -0
- package/dist/src/fixtures/grpc.fixture.d.ts +167 -0
- package/dist/src/fixtures/grpc.fixture.d.ts.map +1 -0
- package/dist/src/fixtures/grpc.fixture.js +635 -0
- package/dist/src/fixtures/grpc.fixture.js.map +1 -0
- package/dist/src/fixtures/inbox.fixture.d.ts +136 -0
- package/dist/src/fixtures/inbox.fixture.d.ts.map +1 -0
- package/dist/src/fixtures/inbox.fixture.js +239 -0
- package/dist/src/fixtures/inbox.fixture.js.map +1 -0
- package/dist/src/fixtures/index.d.ts +174 -0
- package/dist/src/fixtures/index.d.ts.map +1 -0
- package/dist/src/fixtures/index.js +379 -0
- package/dist/src/fixtures/index.js.map +1 -0
- package/dist/src/fixtures/kafka-driver.d.ts +108 -0
- package/dist/src/fixtures/kafka-driver.d.ts.map +1 -0
- package/dist/src/fixtures/kafka-driver.js +113 -0
- package/dist/src/fixtures/kafka-driver.js.map +1 -0
- package/dist/src/fixtures/kafka.fixture.d.ts +75 -0
- package/dist/src/fixtures/kafka.fixture.d.ts.map +1 -0
- package/dist/src/fixtures/kafka.fixture.js +188 -0
- package/dist/src/fixtures/kafka.fixture.js.map +1 -0
- package/dist/src/fixtures/mock-server.fixture.d.ts +142 -0
- package/dist/src/fixtures/mock-server.fixture.d.ts.map +1 -0
- package/dist/src/fixtures/mock-server.fixture.js +271 -0
- package/dist/src/fixtures/mock-server.fixture.js.map +1 -0
- package/dist/src/fixtures/mongodb.fixture.d.ts +121 -0
- package/dist/src/fixtures/mongodb.fixture.d.ts.map +1 -0
- package/dist/src/fixtures/mongodb.fixture.js +258 -0
- package/dist/src/fixtures/mongodb.fixture.js.map +1 -0
- package/dist/src/fixtures/neo4j.fixture.d.ts +72 -0
- package/dist/src/fixtures/neo4j.fixture.d.ts.map +1 -0
- package/dist/src/fixtures/neo4j.fixture.js +202 -0
- package/dist/src/fixtures/neo4j.fixture.js.map +1 -0
- package/dist/src/fixtures/openapi.fixture.d.ts +101 -0
- package/dist/src/fixtures/openapi.fixture.d.ts.map +1 -0
- package/dist/src/fixtures/openapi.fixture.js +266 -0
- package/dist/src/fixtures/openapi.fixture.js.map +1 -0
- package/dist/src/fixtures/optional-package.d.ts +54 -0
- package/dist/src/fixtures/optional-package.d.ts.map +1 -0
- package/dist/src/fixtures/optional-package.js +79 -0
- package/dist/src/fixtures/optional-package.js.map +1 -0
- package/dist/src/fixtures/otp.fixture.d.ts +60 -0
- package/dist/src/fixtures/otp.fixture.d.ts.map +1 -0
- package/dist/src/fixtures/otp.fixture.js +101 -0
- package/dist/src/fixtures/otp.fixture.js.map +1 -0
- package/dist/src/fixtures/realtime.fixture.d.ts +205 -0
- package/dist/src/fixtures/realtime.fixture.d.ts.map +1 -0
- package/dist/src/fixtures/realtime.fixture.js +606 -0
- package/dist/src/fixtures/realtime.fixture.js.map +1 -0
- package/dist/src/fixtures/redis.fixture.d.ts +55 -0
- package/dist/src/fixtures/redis.fixture.d.ts.map +1 -0
- package/dist/src/fixtures/redis.fixture.js +209 -0
- package/dist/src/fixtures/redis.fixture.js.map +1 -0
- package/dist/src/fixtures/s3.fixture.d.ts +126 -0
- package/dist/src/fixtures/s3.fixture.d.ts.map +1 -0
- package/dist/src/fixtures/s3.fixture.js +296 -0
- package/dist/src/fixtures/s3.fixture.js.map +1 -0
- package/dist/src/fixtures/search.fixture.d.ts +178 -0
- package/dist/src/fixtures/search.fixture.d.ts.map +1 -0
- package/dist/src/fixtures/search.fixture.js +472 -0
- package/dist/src/fixtures/search.fixture.js.map +1 -0
- package/dist/src/fixtures/sqs.fixture.d.ts +172 -0
- package/dist/src/fixtures/sqs.fixture.d.ts.map +1 -0
- package/dist/src/fixtures/sqs.fixture.js +428 -0
- package/dist/src/fixtures/sqs.fixture.js.map +1 -0
- package/dist/src/index.d.ts +43 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +48 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/mcp/guards.d.ts +21 -0
- package/dist/src/mcp/guards.d.ts.map +1 -0
- package/dist/src/mcp/guards.js +118 -0
- package/dist/src/mcp/guards.js.map +1 -0
- package/dist/src/mcp/project-tools.d.ts +14 -0
- package/dist/src/mcp/project-tools.d.ts.map +1 -0
- package/dist/src/mcp/project-tools.js +252 -0
- package/dist/src/mcp/project-tools.js.map +1 -0
- package/dist/src/mcp/protocol.d.ts +116 -0
- package/dist/src/mcp/protocol.d.ts.map +1 -0
- package/dist/src/mcp/protocol.js +199 -0
- package/dist/src/mcp/protocol.js.map +1 -0
- package/dist/src/mcp/server.d.ts +43 -0
- package/dist/src/mcp/server.d.ts.map +1 -0
- package/dist/src/mcp/server.js +244 -0
- package/dist/src/mcp/server.js.map +1 -0
- package/dist/src/mcp/test-tools.d.ts +65 -0
- package/dist/src/mcp/test-tools.d.ts.map +1 -0
- package/dist/src/mcp/test-tools.js +380 -0
- package/dist/src/mcp/test-tools.js.map +1 -0
- package/dist/src/mcp/tools.d.ts +49 -0
- package/dist/src/mcp/tools.d.ts.map +1 -0
- package/dist/src/mcp/tools.js +726 -0
- package/dist/src/mcp/tools.js.map +1 -0
- package/dist/src/network-error.d.ts +11 -0
- package/dist/src/network-error.d.ts.map +1 -0
- package/dist/src/network-error.js +34 -0
- package/dist/src/network-error.js.map +1 -0
- package/dist/src/openapi/contract.d.ts +98 -0
- package/dist/src/openapi/contract.d.ts.map +1 -0
- package/dist/src/openapi/contract.js +407 -0
- package/dist/src/openapi/contract.js.map +1 -0
- package/dist/src/openapi/generate.d.ts +89 -0
- package/dist/src/openapi/generate.d.ts.map +1 -0
- package/dist/src/openapi/generate.js +607 -0
- package/dist/src/openapi/generate.js.map +1 -0
- package/dist/src/openapi/load.d.ts +8 -0
- package/dist/src/openapi/load.d.ts.map +1 -0
- package/dist/src/openapi/load.js +26 -0
- package/dist/src/openapi/load.js.map +1 -0
- package/dist/src/package-manager.d.ts +58 -0
- package/dist/src/package-manager.d.ts.map +1 -0
- package/dist/src/package-manager.js +137 -0
- package/dist/src/package-manager.js.map +1 -0
- package/dist/src/reporter/history.d.ts +85 -0
- package/dist/src/reporter/history.d.ts.map +1 -0
- package/dist/src/reporter/history.js +147 -0
- package/dist/src/reporter/history.js.map +1 -0
- package/dist/src/reporter/index.d.ts +59 -0
- package/dist/src/reporter/index.d.ts.map +1 -0
- package/dist/src/reporter/index.js +201 -0
- package/dist/src/reporter/index.js.map +1 -0
- package/dist/src/reporter/last-run.d.ts +88 -0
- package/dist/src/reporter/last-run.d.ts.map +1 -0
- package/dist/src/reporter/last-run.js +133 -0
- package/dist/src/reporter/last-run.js.map +1 -0
- package/dist/src/reporter/quarantine.d.ts +62 -0
- package/dist/src/reporter/quarantine.d.ts.map +1 -0
- package/dist/src/reporter/quarantine.js +148 -0
- package/dist/src/reporter/quarantine.js.map +1 -0
- package/dist/src/secrets/index.d.ts +4 -0
- package/dist/src/secrets/index.d.ts.map +1 -0
- package/dist/src/secrets/index.js +3 -0
- package/dist/src/secrets/index.js.map +1 -0
- package/dist/src/secrets/provider.interface.d.ts +30 -0
- package/dist/src/secrets/provider.interface.d.ts.map +1 -0
- package/dist/src/secrets/provider.interface.js +2 -0
- package/dist/src/secrets/provider.interface.js.map +1 -0
- package/dist/src/secrets/providers/aws.provider.d.ts +33 -0
- package/dist/src/secrets/providers/aws.provider.d.ts.map +1 -0
- package/dist/src/secrets/providers/aws.provider.js +88 -0
- package/dist/src/secrets/providers/aws.provider.js.map +1 -0
- package/dist/src/secrets/providers/azure.provider.d.ts +26 -0
- package/dist/src/secrets/providers/azure.provider.d.ts.map +1 -0
- package/dist/src/secrets/providers/azure.provider.js +71 -0
- package/dist/src/secrets/providers/azure.provider.js.map +1 -0
- package/dist/src/secrets/providers/env-file.provider.d.ts +29 -0
- package/dist/src/secrets/providers/env-file.provider.d.ts.map +1 -0
- package/dist/src/secrets/providers/env-file.provider.js +56 -0
- package/dist/src/secrets/providers/env-file.provider.js.map +1 -0
- package/dist/src/secrets/providers/gitlab.provider.d.ts +26 -0
- package/dist/src/secrets/providers/gitlab.provider.d.ts.map +1 -0
- package/dist/src/secrets/providers/gitlab.provider.js +67 -0
- package/dist/src/secrets/providers/gitlab.provider.js.map +1 -0
- package/dist/src/secrets/providers/index.d.ts +52 -0
- package/dist/src/secrets/providers/index.d.ts.map +1 -0
- package/dist/src/secrets/providers/index.js +81 -0
- package/dist/src/secrets/providers/index.js.map +1 -0
- package/dist/src/secrets/providers/openbao.provider.d.ts +28 -0
- package/dist/src/secrets/providers/openbao.provider.d.ts.map +1 -0
- package/dist/src/secrets/providers/openbao.provider.js +29 -0
- package/dist/src/secrets/providers/openbao.provider.js.map +1 -0
- package/dist/src/secrets/providers/vault-compatible.d.ts +140 -0
- package/dist/src/secrets/providers/vault-compatible.d.ts.map +1 -0
- package/dist/src/secrets/providers/vault-compatible.js +405 -0
- package/dist/src/secrets/providers/vault-compatible.js.map +1 -0
- package/dist/src/secrets/providers/vault.provider.d.ts +27 -0
- package/dist/src/secrets/providers/vault.provider.d.ts.map +1 -0
- package/dist/src/secrets/providers/vault.provider.js +23 -0
- package/dist/src/secrets/providers/vault.provider.js.map +1 -0
- package/dist/src/secrets/secrets-manager.d.ts +67 -0
- package/dist/src/secrets/secrets-manager.d.ts.map +1 -0
- package/dist/src/secrets/secrets-manager.js +255 -0
- package/dist/src/secrets/secrets-manager.js.map +1 -0
- package/dist/src/steps/amqp.steps.d.ts +37 -0
- package/dist/src/steps/amqp.steps.d.ts.map +1 -0
- package/dist/src/steps/amqp.steps.js +86 -0
- package/dist/src/steps/amqp.steps.js.map +1 -0
- package/dist/src/steps/appium.steps.d.ts +53 -0
- package/dist/src/steps/appium.steps.d.ts.map +1 -0
- package/dist/src/steps/appium.steps.js +109 -0
- package/dist/src/steps/appium.steps.js.map +1 -0
- package/dist/src/steps/aws.steps.d.ts +47 -0
- package/dist/src/steps/aws.steps.d.ts.map +1 -0
- package/dist/src/steps/aws.steps.js +116 -0
- package/dist/src/steps/aws.steps.js.map +1 -0
- package/dist/src/steps/browser.steps.d.ts +54 -0
- package/dist/src/steps/browser.steps.d.ts.map +1 -0
- package/dist/src/steps/browser.steps.js +102 -0
- package/dist/src/steps/browser.steps.js.map +1 -0
- package/dist/src/steps/cassandra.steps.d.ts +32 -0
- package/dist/src/steps/cassandra.steps.d.ts.map +1 -0
- package/dist/src/steps/cassandra.steps.js +81 -0
- package/dist/src/steps/cassandra.steps.js.map +1 -0
- package/dist/src/steps/clickhouse.steps.d.ts +30 -0
- package/dist/src/steps/clickhouse.steps.d.ts.map +1 -0
- package/dist/src/steps/clickhouse.steps.js +73 -0
- package/dist/src/steps/clickhouse.steps.js.map +1 -0
- package/dist/src/steps/database.steps.d.ts +43 -0
- package/dist/src/steps/database.steps.d.ts.map +1 -0
- package/dist/src/steps/database.steps.js +79 -0
- package/dist/src/steps/database.steps.js.map +1 -0
- package/dist/src/steps/dynamodb.steps.d.ts +32 -0
- package/dist/src/steps/dynamodb.steps.d.ts.map +1 -0
- package/dist/src/steps/dynamodb.steps.js +89 -0
- package/dist/src/steps/dynamodb.steps.js.map +1 -0
- package/dist/src/steps/graphql.steps.d.ts +60 -0
- package/dist/src/steps/graphql.steps.d.ts.map +1 -0
- package/dist/src/steps/graphql.steps.js +76 -0
- package/dist/src/steps/graphql.steps.js.map +1 -0
- package/dist/src/steps/grpc.steps.d.ts +29 -0
- package/dist/src/steps/grpc.steps.d.ts.map +1 -0
- package/dist/src/steps/grpc.steps.js +68 -0
- package/dist/src/steps/grpc.steps.js.map +1 -0
- package/dist/src/steps/inbox.steps.d.ts +30 -0
- package/dist/src/steps/inbox.steps.d.ts.map +1 -0
- package/dist/src/steps/inbox.steps.js +72 -0
- package/dist/src/steps/inbox.steps.js.map +1 -0
- package/dist/src/steps/index.d.ts +43 -0
- package/dist/src/steps/index.d.ts.map +1 -0
- package/dist/src/steps/index.js +26 -0
- package/dist/src/steps/index.js.map +1 -0
- package/dist/src/steps/kafka.steps.d.ts +56 -0
- package/dist/src/steps/kafka.steps.d.ts.map +1 -0
- package/dist/src/steps/kafka.steps.js +61 -0
- package/dist/src/steps/kafka.steps.js.map +1 -0
- package/dist/src/steps/mock-server.steps.d.ts +21 -0
- package/dist/src/steps/mock-server.steps.d.ts.map +1 -0
- package/dist/src/steps/mock-server.steps.js +45 -0
- package/dist/src/steps/mock-server.steps.js.map +1 -0
- package/dist/src/steps/mongodb.steps.d.ts +107 -0
- package/dist/src/steps/mongodb.steps.d.ts.map +1 -0
- package/dist/src/steps/mongodb.steps.js +117 -0
- package/dist/src/steps/mongodb.steps.js.map +1 -0
- package/dist/src/steps/openapi.steps.d.ts +49 -0
- package/dist/src/steps/openapi.steps.d.ts.map +1 -0
- package/dist/src/steps/openapi.steps.js +113 -0
- package/dist/src/steps/openapi.steps.js.map +1 -0
- package/dist/src/steps/otp.steps.d.ts +43 -0
- package/dist/src/steps/otp.steps.d.ts.map +1 -0
- package/dist/src/steps/otp.steps.js +83 -0
- package/dist/src/steps/otp.steps.js.map +1 -0
- package/dist/src/steps/realtime.steps.d.ts +40 -0
- package/dist/src/steps/realtime.steps.d.ts.map +1 -0
- package/dist/src/steps/realtime.steps.js +116 -0
- package/dist/src/steps/realtime.steps.js.map +1 -0
- package/dist/src/steps/redis.steps.d.ts +54 -0
- package/dist/src/steps/redis.steps.d.ts.map +1 -0
- package/dist/src/steps/redis.steps.js +89 -0
- package/dist/src/steps/redis.steps.js.map +1 -0
- package/dist/src/steps/search.steps.d.ts +23 -0
- package/dist/src/steps/search.steps.d.ts.map +1 -0
- package/dist/src/steps/search.steps.js +54 -0
- package/dist/src/steps/search.steps.js.map +1 -0
- package/dist/src/test-data/factory.d.ts +82 -0
- package/dist/src/test-data/factory.d.ts.map +1 -0
- package/dist/src/test-data/factory.js +116 -0
- package/dist/src/test-data/factory.js.map +1 -0
- package/dist/src/test-data/index.d.ts +4 -0
- package/dist/src/test-data/index.d.ts.map +1 -0
- package/dist/src/test-data/index.js +4 -0
- package/dist/src/test-data/index.js.map +1 -0
- package/dist/src/test-data/registry.d.ts +37 -0
- package/dist/src/test-data/registry.d.ts.map +1 -0
- package/dist/src/test-data/registry.js +51 -0
- package/dist/src/test-data/registry.js.map +1 -0
- package/dist/src/test-data/tracking.d.ts +47 -0
- package/dist/src/test-data/tracking.d.ts.map +1 -0
- package/dist/src/test-data/tracking.js +166 -0
- package/dist/src/test-data/tracking.js.map +1 -0
- package/environments.json +263 -0
- package/package.json +299 -5
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OAuth 2.0 / OIDC access tokens for tests.
|
|
3
|
+
*
|
|
4
|
+
* One TokenManager lives per Playwright worker (the `propmasterAuth` worker
|
|
5
|
+
* fixture). It fetches a token the first time a role needs one, caches it,
|
|
6
|
+
* and gets a new one shortly before it expires — with the refresh token when
|
|
7
|
+
* the server issued one, otherwise with a fresh grant. Concurrent requests for
|
|
8
|
+
* the same role share one network call.
|
|
9
|
+
*
|
|
10
|
+
* Secrets never appear in errors: messages name the endpoint, role, client ID
|
|
11
|
+
* and the server's `error`/`error_description`, nothing else.
|
|
12
|
+
*
|
|
13
|
+
* Uses Node's built-in fetch; no package needed.
|
|
14
|
+
*/
|
|
15
|
+
import { errorReason } from '../network-error.js';
|
|
16
|
+
import { FixtureInitError } from '../errors.js';
|
|
17
|
+
export const DEFAULT_ROLE = 'default';
|
|
18
|
+
const DEFAULT_REFRESH_BEFORE_EXPIRY = 60;
|
|
19
|
+
/** Lifetime assumed when the server sends neither `expires_in` nor a JWT `exp`. */
|
|
20
|
+
const DEFAULT_LIFETIME = 300;
|
|
21
|
+
/** The role a test uses: `authRole`, else `defaultRole`, else `default`. */
|
|
22
|
+
export function roleName(config, authRole) {
|
|
23
|
+
return authRole ?? config.defaultRole ?? DEFAULT_ROLE;
|
|
24
|
+
}
|
|
25
|
+
/** Merges a role's settings over the top-level ones. Unknown roles fail with the list of known ones. */
|
|
26
|
+
export function resolveRole(config, authRole) {
|
|
27
|
+
const name = roleName(config, authRole);
|
|
28
|
+
const roles = config.roles ?? {};
|
|
29
|
+
const own = roles[name];
|
|
30
|
+
if (!own && name !== (config.defaultRole ?? DEFAULT_ROLE)) {
|
|
31
|
+
throw new FixtureInitError('auth', 'init', {
|
|
32
|
+
role: name,
|
|
33
|
+
reason: `unknown role; configured roles: ${Object.keys(roles).join(', ') || 'none'} (add it under auth.roles)`,
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
const username = own?.username ?? (own ? undefined : config.username);
|
|
37
|
+
const password = own?.password ?? (own ? undefined : config.password);
|
|
38
|
+
return {
|
|
39
|
+
name,
|
|
40
|
+
clientId: own?.clientId ?? config.clientId,
|
|
41
|
+
clientSecret: own?.clientSecret ?? config.clientSecret,
|
|
42
|
+
username,
|
|
43
|
+
password,
|
|
44
|
+
scope: own?.scope ?? config.scope,
|
|
45
|
+
grantType: config.grantType ?? (username ? 'password' : 'client_credentials'),
|
|
46
|
+
extra: { ...(own?.extra ?? {}) },
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
/** `exp` from a JWT, without verifying it (only to schedule a refresh). */
|
|
50
|
+
export function jwtExpiry(token) {
|
|
51
|
+
const part = token.split('.')[1];
|
|
52
|
+
if (!part)
|
|
53
|
+
return undefined;
|
|
54
|
+
try {
|
|
55
|
+
const payload = JSON.parse(Buffer.from(part, 'base64url').toString('utf8'));
|
|
56
|
+
return typeof payload.exp === 'number' ? payload.exp * 1000 : undefined;
|
|
57
|
+
}
|
|
58
|
+
catch {
|
|
59
|
+
return undefined;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
export class TokenManager {
|
|
63
|
+
fetchImpl;
|
|
64
|
+
now;
|
|
65
|
+
tokens = new Map();
|
|
66
|
+
pending = new Map();
|
|
67
|
+
endpoints = new Map();
|
|
68
|
+
constructor(fetchImpl = (...args) => fetch(...args), now = Date.now) {
|
|
69
|
+
this.fetchImpl = fetchImpl;
|
|
70
|
+
this.now = now;
|
|
71
|
+
}
|
|
72
|
+
/** A valid access token for the role, fetched or refreshed as needed. */
|
|
73
|
+
async getToken(config, authRole) {
|
|
74
|
+
return (await this.getTokenSet(config, authRole)).accessToken;
|
|
75
|
+
}
|
|
76
|
+
async getTokenSet(config, authRole) {
|
|
77
|
+
const role = resolveRole(config, authRole);
|
|
78
|
+
const key = JSON.stringify([config.tokenUrl ?? config.issuer, role.clientId, role.name, role.username, role.scope, config.audience]);
|
|
79
|
+
const cached = this.tokens.get(key);
|
|
80
|
+
const margin = (config.refreshBeforeExpiry ?? DEFAULT_REFRESH_BEFORE_EXPIRY) * 1000;
|
|
81
|
+
if (cached && this.now() < cached.expiresAt - margin)
|
|
82
|
+
return cached;
|
|
83
|
+
let inflight = this.pending.get(key);
|
|
84
|
+
if (!inflight) {
|
|
85
|
+
inflight = this.obtain(config, role, cached?.refreshToken)
|
|
86
|
+
.then((set) => {
|
|
87
|
+
this.tokens.set(key, set);
|
|
88
|
+
return set;
|
|
89
|
+
})
|
|
90
|
+
.finally(() => this.pending.delete(key));
|
|
91
|
+
this.pending.set(key, inflight);
|
|
92
|
+
}
|
|
93
|
+
return inflight;
|
|
94
|
+
}
|
|
95
|
+
/** Forgets cached tokens (all, or one role's), e.g. after the server revoked them. */
|
|
96
|
+
invalidate(authRole) {
|
|
97
|
+
if (authRole === undefined)
|
|
98
|
+
this.tokens.clear();
|
|
99
|
+
else
|
|
100
|
+
for (const key of this.tokens.keys())
|
|
101
|
+
if (JSON.parse(key)[2] === authRole)
|
|
102
|
+
this.tokens.delete(key);
|
|
103
|
+
}
|
|
104
|
+
/** `tokenUrl`, or the issuer's discovery document's `token_endpoint`. */
|
|
105
|
+
tokenEndpoint(config) {
|
|
106
|
+
if (config.tokenUrl)
|
|
107
|
+
return Promise.resolve(config.tokenUrl);
|
|
108
|
+
if (!config.issuer) {
|
|
109
|
+
return Promise.reject(new FixtureInitError('auth', 'init', { reason: 'set auth.tokenUrl or auth.issuer (PW_AUTH_TOKEN_URL / PW_AUTH_ISSUER)' }));
|
|
110
|
+
}
|
|
111
|
+
const issuer = config.issuer.replace(/\/+$/, '');
|
|
112
|
+
let endpoint = this.endpoints.get(issuer);
|
|
113
|
+
if (!endpoint) {
|
|
114
|
+
const url = `${issuer}/.well-known/openid-configuration`;
|
|
115
|
+
endpoint = this.fetchImpl(url, { headers: { Accept: 'application/json' } })
|
|
116
|
+
.then(async (res) => {
|
|
117
|
+
if (!res.ok)
|
|
118
|
+
throw new Error(`${url} returned ${res.status}`);
|
|
119
|
+
const doc = (await res.json());
|
|
120
|
+
if (!doc.token_endpoint)
|
|
121
|
+
throw new Error(`${url} has no token_endpoint`);
|
|
122
|
+
return doc.token_endpoint;
|
|
123
|
+
})
|
|
124
|
+
.catch((error) => {
|
|
125
|
+
this.endpoints.delete(issuer);
|
|
126
|
+
throw new FixtureInitError('auth', 'connect', { issuer, reason: errorReason(error) });
|
|
127
|
+
});
|
|
128
|
+
this.endpoints.set(issuer, endpoint);
|
|
129
|
+
}
|
|
130
|
+
return endpoint;
|
|
131
|
+
}
|
|
132
|
+
async obtain(config, role, refreshToken) {
|
|
133
|
+
const endpoint = await this.tokenEndpoint(config);
|
|
134
|
+
if (refreshToken) {
|
|
135
|
+
try {
|
|
136
|
+
return await this.request(endpoint, config, role, { grant_type: 'refresh_token', refresh_token: refreshToken });
|
|
137
|
+
}
|
|
138
|
+
catch {
|
|
139
|
+
// An expired or revoked refresh token: fall back to a fresh grant below.
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
if (role.grantType === 'password') {
|
|
143
|
+
if (!role.username || role.password === undefined) {
|
|
144
|
+
throw new FixtureInitError('auth', 'init', {
|
|
145
|
+
role: role.name,
|
|
146
|
+
reason: 'the password grant needs a username and password for this role (auth.roles.<role> or PW_AUTH_USERNAME/PW_AUTH_PASSWORD)',
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
return this.request(endpoint, config, role, { grant_type: 'password', username: role.username, password: role.password });
|
|
150
|
+
}
|
|
151
|
+
return this.request(endpoint, config, role, { grant_type: 'client_credentials' });
|
|
152
|
+
}
|
|
153
|
+
async request(endpoint, config, role, params) {
|
|
154
|
+
const body = new URLSearchParams(params);
|
|
155
|
+
if (role.scope)
|
|
156
|
+
body.set('scope', role.scope);
|
|
157
|
+
if (config.audience)
|
|
158
|
+
body.set('audience', config.audience);
|
|
159
|
+
const headers = { 'Content-Type': 'application/x-www-form-urlencoded', Accept: 'application/json' };
|
|
160
|
+
if (role.clientId) {
|
|
161
|
+
if ((config.clientAuth ?? 'basic') === 'basic' && role.clientSecret !== undefined) {
|
|
162
|
+
const id = encodeURIComponent(role.clientId);
|
|
163
|
+
const secret = encodeURIComponent(role.clientSecret);
|
|
164
|
+
headers.Authorization = `Basic ${Buffer.from(`${id}:${secret}`).toString('base64')}`;
|
|
165
|
+
}
|
|
166
|
+
else {
|
|
167
|
+
body.set('client_id', role.clientId);
|
|
168
|
+
if (role.clientSecret !== undefined)
|
|
169
|
+
body.set('client_secret', role.clientSecret);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
const context = { tokenUrl: endpoint, role: role.name, clientId: role.clientId, grantType: params.grant_type };
|
|
173
|
+
let res;
|
|
174
|
+
try {
|
|
175
|
+
res = await this.fetchImpl(endpoint, { method: 'POST', headers, body });
|
|
176
|
+
}
|
|
177
|
+
catch (error) {
|
|
178
|
+
throw new FixtureInitError('auth', 'connect', { ...context, reason: errorReason(error) });
|
|
179
|
+
}
|
|
180
|
+
const data = (await res.json().catch(() => ({})));
|
|
181
|
+
if (!res.ok || typeof data.access_token !== 'string') {
|
|
182
|
+
const detail = [data.error, data.error_description].filter((v) => typeof v === 'string').join(': ');
|
|
183
|
+
throw new FixtureInitError('auth', 'init', {
|
|
184
|
+
...context,
|
|
185
|
+
reason: `token request failed with ${res.status}${detail ? ` (${detail})` : typeof data.access_token !== 'string' && res.ok ? ' (no access_token in the response)' : ''}`,
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
const accessToken = data.access_token;
|
|
189
|
+
const expiresIn = typeof data.expires_in === 'number' ? data.expires_in : Number(data.expires_in);
|
|
190
|
+
const expiresAt = Number.isFinite(expiresIn) && expiresIn > 0 ? this.now() + expiresIn * 1000 : (jwtExpiry(accessToken) ?? this.now() + DEFAULT_LIFETIME * 1000);
|
|
191
|
+
return {
|
|
192
|
+
accessToken,
|
|
193
|
+
tokenType: typeof data.token_type === 'string' ? data.token_type : 'Bearer',
|
|
194
|
+
expiresAt,
|
|
195
|
+
refreshToken: typeof data.refresh_token === 'string' ? data.refresh_token : undefined,
|
|
196
|
+
idToken: typeof data.id_token === 'string' ? data.id_token : undefined,
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
//# sourceMappingURL=token-manager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"token-manager.js","sourceRoot":"","sources":["../../../src/auth/token-manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAElD,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhD,MAAM,CAAC,MAAM,YAAY,GAAG,SAAS,CAAC;AACtC,MAAM,6BAA6B,GAAG,EAAE,CAAC;AACzC,mFAAmF;AACnF,MAAM,gBAAgB,GAAG,GAAG,CAAC;AAuB7B,4EAA4E;A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|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The logo and version the CLI shows at the start of commands people run
|
|
3
|
+
* themselves. Never for `propmaster mcp` (stdout is the protocol), `--json`,
|
|
4
|
+
* `--quiet`, output that isn't a terminal, or CI.
|
|
5
|
+
*/
|
|
6
|
+
import { type Style, type StyleStream } from './style.js';
|
|
7
|
+
/** "propmaster" in box-drawing letters, three rows. */
|
|
8
|
+
export declare function logoLines(): string[];
|
|
9
|
+
/** The installed package's version, from the nearest package.json named @inluxc/propmaster. */
|
|
10
|
+
export declare function packageVersion(from?: string): string;
|
|
11
|
+
export interface BannerOptions {
|
|
12
|
+
version?: string;
|
|
13
|
+
/** Shown after the version, for commands that use an environment. */
|
|
14
|
+
environment?: string;
|
|
15
|
+
style?: Style;
|
|
16
|
+
}
|
|
17
|
+
/** The banner: the logo, then `v1.0.0 · environment: local`. */
|
|
18
|
+
export declare function banner(options?: BannerOptions): string;
|
|
19
|
+
/** Whether a command run with `argv` should show the banner on `stream`. */
|
|
20
|
+
export declare function shouldShowBanner(argv: readonly string[], stream?: StyleStream, env?: NodeJS.ProcessEnv): boolean;
|
|
21
|
+
/** Prints the banner when `shouldShowBanner` says so. */
|
|
22
|
+
export declare function printBanner(argv: readonly string[], options?: BannerOptions, stream?: NodeJS.WriteStream): void;
|
|
23
|
+
//# sourceMappingURL=banner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"banner.d.ts","sourceRoot":"","sources":["../../../src/cli/banner.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,EAAY,KAAK,KAAK,EAAE,KAAK,WAAW,EAAE,MAAM,YAAY,CAAC;AAapE,uDAAuD;AACvD,wBAAgB,SAAS,IAAI,MAAM,EAAE,CAEpC;AAID,+FAA+F;AAC/F,wBAAgB,cAAc,CAAC,IAAI,GAAE,MAAqD,GAAG,MAAM,CAclG;AAED,MAAM,WAAW,aAAa;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,qEAAqE;IACrE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,KAAK,CAAC;CACjB;AAED,gEAAgE;AAChE,wBAAgB,MAAM,CAAC,OAAO,GAAE,aAAkB,GAAG,MAAM,CAK1D;AAED,4EAA4E;AAC5E,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,MAAM,GAAE,WAA4B,EAAE,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,OAAO,CAK7I;AAED,yDAAyD;AACzD,wBAAgB,WAAW,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,OAAO,GAAE,aAAkB,EAAE,MAAM,GAAE,MAAM,CAAC,WAA4B,GAAG,IAAI,CAEnI"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The logo and version the CLI shows at the start of commands people run
|
|
3
|
+
* themselves. Never for `propmaster mcp` (stdout is the protocol), `--json`,
|
|
4
|
+
* `--quiet`, output that isn't a terminal, or CI.
|
|
5
|
+
*/
|
|
6
|
+
import * as fs from 'node:fs';
|
|
7
|
+
import * as path from 'node:path';
|
|
8
|
+
import { fileURLToPath } from 'node:url';
|
|
9
|
+
import { styleFor } from './style.js';
|
|
10
|
+
const LETTERS = {
|
|
11
|
+
p: ['┌─┐', '├─┘', '┴ '],
|
|
12
|
+
r: ['┬─┐', '├┬┘', '┴└─'],
|
|
13
|
+
o: ['┌─┐', '│ │', '└─┘'],
|
|
14
|
+
m: ['┌┬┐', '│││', '┴ ┴'],
|
|
15
|
+
a: ['┌─┐', '├─┤', '┴ ┴'],
|
|
16
|
+
s: ['┌─┐', '└─┐', '└─┘'],
|
|
17
|
+
t: ['┌┬┐', ' │ ', ' ┴ '],
|
|
18
|
+
e: ['┌─┐', '├┤ ', '└─┘'],
|
|
19
|
+
};
|
|
20
|
+
/** "propmaster" in box-drawing letters, three rows. */
|
|
21
|
+
export function logoLines() {
|
|
22
|
+
return [0, 1, 2].map((row) => [...'propmaster'].map((c) => LETTERS[c][row]).join(''));
|
|
23
|
+
}
|
|
24
|
+
let cachedVersion;
|
|
25
|
+
/** The installed package's version, from the nearest package.json named @inluxc/propmaster. */
|
|
26
|
+
export function packageVersion(from = path.dirname(fileURLToPath(import.meta.url))) {
|
|
27
|
+
if (cachedVersion)
|
|
28
|
+
return cachedVersion;
|
|
29
|
+
for (let dir = from;; dir = path.dirname(dir)) {
|
|
30
|
+
const file = path.join(dir, 'package.json');
|
|
31
|
+
if (fs.existsSync(file)) {
|
|
32
|
+
try {
|
|
33
|
+
const pkg = JSON.parse(fs.readFileSync(file, 'utf-8'));
|
|
34
|
+
if (pkg.name === '@inluxc/propmaster' && pkg.version)
|
|
35
|
+
return (cachedVersion = pkg.version);
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
// not JSON: keep looking
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
if (path.dirname(dir) === dir)
|
|
42
|
+
return 'unknown';
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
/** The banner: the logo, then `v1.0.0 · environment: local`. */
|
|
46
|
+
export function banner(options = {}) {
|
|
47
|
+
const s = options.style ?? styleFor();
|
|
48
|
+
const version = options.version ?? packageVersion();
|
|
49
|
+
const details = [s.bold(`v${version}`), ...(options.environment ? [`environment: ${s.cyan(options.environment)}`] : [])].join(s.dim(' · '));
|
|
50
|
+
return ['', ...logoLines().map((line) => ` ${s.gradient(line)}`), ` ${details}`, ''].join('\n');
|
|
51
|
+
}
|
|
52
|
+
/** Whether a command run with `argv` should show the banner on `stream`. */
|
|
53
|
+
export function shouldShowBanner(argv, stream = process.stdout, env = process.env) {
|
|
54
|
+
if (stream.isTTY !== true)
|
|
55
|
+
return false;
|
|
56
|
+
if (env.CI && env.CI !== '0' && env.CI.toLowerCase() !== 'false')
|
|
57
|
+
return false;
|
|
58
|
+
if (env.PROPMASTER_NO_BANNER)
|
|
59
|
+
return false;
|
|
60
|
+
return !argv.some((a) => a === '--json' || a === '--quiet' || a === '-q');
|
|
61
|
+
}
|
|
62
|
+
/** Prints the banner when `shouldShowBanner` says so. */
|
|
63
|
+
export function printBanner(argv, options = {}, stream = process.stdout) {
|
|
64
|
+
if (shouldShowBanner(argv, stream))
|
|
65
|
+
stream.write(`${banner({ style: styleFor(stream), ...options })}\n`);
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=banner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"banner.js","sourceRoot":"","sources":["../../../src/cli/banner.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAgC,MAAM,YAAY,CAAC;AAEpE,MAAM,OAAO,GAA6C;IACtD,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC;IACxB,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC;IACxB,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC;IACxB,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC;IACxB,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC;IACxB,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC;IACxB,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC;IACxB,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC;CAC3B,CAAC;AAEF,uDAAuD;AACvD,MAAM,UAAU,SAAS;IACrB,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,E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AAM,GAAuB,OAAO,CAAC,MAAM;IACzH,IAAI,gBAAgB,CAAC,IAAI,EAAE,MAAM,CAAC;QAAE,MAAM,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC,EAAE,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,GAAG,OAAO,EAAE,CAAC,IAAI,CAAC,CAAC;AAC7G,CAAC"}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Test convention checker — `propmaster check` / `propmaster next-id`.
|
|
3
|
+
*
|
|
4
|
+
* Enforces the conventions taught in AGENTS.md so humans and AI agents get
|
|
5
|
+
* fast, machine-readable feedback instead of relying on prose rules:
|
|
6
|
+
*
|
|
7
|
+
* tc-id every test title starts with `[TC-XXX-NNN]`
|
|
8
|
+
* tc-tag every test has `{ tag: ['@TC-XXX-NNN'] }` matching its title ID
|
|
9
|
+
* tc-unique every TestCaseID is unique across the whole suite
|
|
10
|
+
* test-step every test body uses `test.step()` (directly or via a *Steps class)
|
|
11
|
+
* import test files import `test`/`expect` from the framework, never `@playwright/test`
|
|
12
|
+
*
|
|
13
|
+
* Zero dependencies on purpose: TypeScript 7 ships no JS compiler API, so the
|
|
14
|
+
* scanner is a small hand-written tokenizer that understands strings,
|
|
15
|
+
* template literals, comments and bracket nesting — enough to find `test(...)`
|
|
16
|
+
* calls and split their arguments.
|
|
17
|
+
*
|
|
18
|
+
* This module has no side effects; the CLI entry point is `init.ts`.
|
|
19
|
+
*/
|
|
20
|
+
import { type FoundDescribe, type Standards } from './standards.js';
|
|
21
|
+
/**
|
|
22
|
+
* Checker settings. Read from the `propmaster` key of the project's
|
|
23
|
+
* `package.json`; every field is optional and falls back to the defaults.
|
|
24
|
+
*
|
|
25
|
+
* ```json
|
|
26
|
+
* "propmaster": {
|
|
27
|
+
* "testDirs": ["tests"],
|
|
28
|
+
* "testFileSuffixes": [".spec.ts", ".prop.ts"],
|
|
29
|
+
* "exemptDirs": ["tests/unit/", "tests/properties/"],
|
|
30
|
+
* "docFiles": ["AGENTS.md", "SKILLS.md"]
|
|
31
|
+
* }
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export interface CheckConfig {
|
|
35
|
+
/** Directories (relative to the project root) scanned for test files. */
|
|
36
|
+
testDirs: string[];
|
|
37
|
+
/** File-name suffixes that mark a test file. */
|
|
38
|
+
testFileSuffixes: string[];
|
|
39
|
+
/**
|
|
40
|
+
* Directory prefixes whose test files are exempt from the TestCaseID /
|
|
41
|
+
* step / import / uniqueness rules (framework self-tests). IDs mentioned
|
|
42
|
+
* in them are still reserved, so `next-id` never hands them out.
|
|
43
|
+
*/
|
|
44
|
+
exemptDirs: string[];
|
|
45
|
+
/** Markdown files whose ```ts code samples must also follow the conventions. */
|
|
46
|
+
docFiles: string[];
|
|
47
|
+
}
|
|
48
|
+
export declare const DEFAULT_CONFIG: CheckConfig;
|
|
49
|
+
/** Merges the `propmaster` key of `<root>/package.json` over the defaults. */
|
|
50
|
+
export declare function loadConfig(root: string): CheckConfig;
|
|
51
|
+
/** Walks up from `start` to the nearest directory containing a package.json. */
|
|
52
|
+
export declare function findProjectRoot(start?: string): string;
|
|
53
|
+
/** The built-in TestCaseID categories, for the `next-id` menu. Projects can use any other code. */
|
|
54
|
+
export declare const KNOWN_CATEGORIES: ReadonlyArray<{
|
|
55
|
+
code: string;
|
|
56
|
+
description: string;
|
|
57
|
+
}>;
|
|
58
|
+
/** Whether `code` is a valid TestCaseID category (2–6 capitals or digits, starting with a capital). */
|
|
59
|
+
export declare function isCategory(code: string): boolean;
|
|
60
|
+
/** Returns the index just past a string/template/comment starting at `i`, or -1. */
|
|
61
|
+
export declare function skipNonCode(src: string, i: number): number;
|
|
62
|
+
/** Given `src[open]` is `(`, `[` or `{`, returns the index of its matching closer. */
|
|
63
|
+
export declare function matchClose(src: string, open: number): number;
|
|
64
|
+
/** Splits the text between parens into top-level comma-separated arguments. */
|
|
65
|
+
export declare function splitArgs(src: string, open: number, close: number): string[];
|
|
66
|
+
export interface FoundTest {
|
|
67
|
+
/** Offset of the `test` token in the source. */
|
|
68
|
+
index: number;
|
|
69
|
+
title: string;
|
|
70
|
+
/** True when the title is a template literal with interpolation. */
|
|
71
|
+
dynamic: boolean;
|
|
72
|
+
/** Source text of the options argument (`{ tag: [...] }`), if present. */
|
|
73
|
+
options: string | null;
|
|
74
|
+
/** Source text of the test body (last argument). */
|
|
75
|
+
body: string;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Finds every test declaration: `test(...)` or `test.only|skip|fixme|fail(...)`
|
|
79
|
+
* whose first argument is a string literal (the title) and that has a body.
|
|
80
|
+
*/
|
|
81
|
+
export declare function findTests(src: string): FoundTest[];
|
|
82
|
+
/** Finds every `test.describe(...)` (and .serial/.parallel/.only/.skip/.fixme) with a literal title. */
|
|
83
|
+
export declare function findDescribes(src: string): FoundDescribe[];
|
|
84
|
+
export declare function lineOf(src: string, index: number): number;
|
|
85
|
+
/** Returns `{ code, lineOffset }` for each ```ts / ```typescript block in a markdown file. */
|
|
86
|
+
export declare function codeBlocks(md: string): {
|
|
87
|
+
code: string;
|
|
88
|
+
lineOffset: number;
|
|
89
|
+
}[];
|
|
90
|
+
/** The built-in rules, `standards` (a problem with propmaster.standards.json) and `standard:<id>` (one of its rules). */
|
|
91
|
+
export type Rule = 'tc-id' | 'tc-tag' | 'tc-unique' | 'test-step' | 'import' | 'quarantine' | 'standards' | `standard:${string}`;
|
|
92
|
+
export interface Violation {
|
|
93
|
+
file: string;
|
|
94
|
+
line: number;
|
|
95
|
+
rule: Rule;
|
|
96
|
+
message: string;
|
|
97
|
+
/** Title of the offending test, when the violation is about one test. */
|
|
98
|
+
test?: string;
|
|
99
|
+
}
|
|
100
|
+
export interface IdEntry {
|
|
101
|
+
id: string;
|
|
102
|
+
category: string;
|
|
103
|
+
num: number;
|
|
104
|
+
file: string;
|
|
105
|
+
line: number;
|
|
106
|
+
/** True when the ID was only seen in an exempt file (reserved, not a test). */
|
|
107
|
+
reserved?: boolean;
|
|
108
|
+
}
|
|
109
|
+
export interface CheckResult {
|
|
110
|
+
violations: Violation[];
|
|
111
|
+
ids: IdEntry[];
|
|
112
|
+
/** Standards rules at level "warn": reported, but they don't fail the check. */
|
|
113
|
+
warnings: Violation[];
|
|
114
|
+
}
|
|
115
|
+
/** One source to check: a test file, or a markdown doc whose code samples are checked. */
|
|
116
|
+
export interface SourceInput {
|
|
117
|
+
file: string;
|
|
118
|
+
content: string;
|
|
119
|
+
kind: 'test' | 'exempt' | 'doc';
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Checks a set of in-memory sources. Pure: no filesystem access, so it is the
|
|
123
|
+
* unit-testable core of {@link collect}.
|
|
124
|
+
*/
|
|
125
|
+
export declare function checkSources(sources: SourceInput[], standards?: Standards | null): CheckResult;
|
|
126
|
+
export declare function walk(dir: string): string[];
|
|
127
|
+
/** Reads the project's test files and docs and checks them. */
|
|
128
|
+
export declare function collect(root: string, config?: CheckConfig): CheckResult;
|
|
129
|
+
/** Returns the next `count` free IDs in `category`. */
|
|
130
|
+
export declare function nextIds(category: string, ids: IdEntry[], count?: number): string[];
|
|
131
|
+
/**
|
|
132
|
+
* The quarantine file's problems (violations: it's invalid) and warnings
|
|
133
|
+
* (entries past their age, IDs no test has). No file: neither.
|
|
134
|
+
*/
|
|
135
|
+
export declare function checkQuarantine(root: string, ids: IdEntry[], now?: Date): {
|
|
136
|
+
violations: Violation[];
|
|
137
|
+
warnings: string[];
|
|
138
|
+
};
|
|
139
|
+
/** `propmaster check [--json] [--list-ids] [--root <dir>]`. Returns the exit code. */
|
|
140
|
+
export declare function runCheck(argv: string[]): number;
|
|
141
|
+
/** `propmaster next-id <CATEGORY> [count] [--root <dir>]`. Returns the exit code. */
|
|
142
|
+
export declare function runNextId(argv: string[]): number;
|
|
143
|
+
//# sourceMappingURL=check-tests.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check-tests.d.ts","sourceRoot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