{"id":43801881,"url":"https://github.com/tailor-platform/patterner","last_synced_at":"2026-02-05T22:06:31.161Z","repository":{"id":314182704,"uuid":"1052382638","full_name":"tailor-platform/patterner","owner":"tailor-platform","description":"patterner is a tool to analyze and present best practices (patterns) for Tailor Platform applications.","archived":false,"fork":false,"pushed_at":"2026-01-29T08:24:00.000Z","size":242,"stargazers_count":6,"open_issues_count":4,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-01-29T23:34:12.989Z","etag":null,"topics":["tailor-platform-tools"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tailor-platform.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-08T01:06:12.000Z","updated_at":"2026-01-21T09:15:36.000Z","dependencies_parsed_at":"2025-10-15T17:08:31.671Z","dependency_job_id":"93152e3a-6b91-42f7-86fa-e25950222b67","html_url":"https://github.com/tailor-platform/patterner","commit_stats":null,"previous_names":["tailor-platform/patterner"],"tags_count":14,"template":false,"template_full_name":null,"purl":"pkg:github/tailor-platform/patterner","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tailor-platform%2Fpatterner","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tailor-platform%2Fpatterner/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tailor-platform%2Fpatterner/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tailor-platform%2Fpatterner/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tailor-platform","download_url":"https://codeload.github.com/tailor-platform/patterner/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tailor-platform%2Fpatterner/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29136019,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-05T21:59:57.939Z","status":"ssl_error","status_checked_at":"2026-02-05T21:59:57.628Z","response_time":65,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["tailor-platform-tools"],"created_at":"2026-02-05T22:06:30.566Z","updated_at":"2026-02-05T22:06:31.149Z","avatar_url":"https://github.com/tailor-platform.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Patterner\n\n`patterner` is a tool to analyze and present best practices (patterns) for [Tailor Platform](https://www.tailor.tech/) applications.\n\n## Overview\n\nPatterner is a command-line tool designed to help developers identify patterns and best practices within Tailor Platform workspaces. It provides linting capabilities and metrics collection to ensure your Tailor Platform application follows recommended patterns.\n\n## Features\n\n- **Lint** - Analyze resources in your workspace and identify potential issues or deviations from best practices\n- **Metrics** - Collect and display metrics about resources in your workspace\n- **Coverage** - Analyze and display pipeline resolver step coverage to monitor execution quality\n- **Configuration** - Flexible configuration system with YAML-based settings\n\n## Installation\n\n```bash\ngo install github.com/tailor-platform/patterner@latest\n```\n\n## Usage\n\n### Initialize Configuration\n\nCreate a `.patterner.yml` configuration file in your project:\n\n```bash\npatterner init\n```\n\nYou can also specify a workspace ID during initialization:\n\n```bash\npatterner init -w YOUR_WORKSPACE_ID\n```\n\n### Lint Your Workspace\n\nCheck your workspace resources against configured patterns:\n\n```bash\npatterner lint\n```\n\nOr specify a workspace ID directly:\n\n```bash\npatterner lint -w YOUR_WORKSPACE_ID\n```\n\n**Note:** The lint command requires a Tailor Platform access token. Set the `TAILOR_TOKEN` environment variable:\n\n```bash\n# Using tailorctl to get access token\nenv TAILOR_TOKEN=$(tailorctl auth get accessToken) patterner lint\n\n# Or set the token directly\nexport TAILOR_TOKEN=your_access_token\npatterner lint\n```\n\n### View Metrics\n\nDisplay metrics about resources in your workspace:\n\n```bash\npatterner metrics\n```\n\n**Note:** The metrics command requires a Tailor Platform access token. Set the `TAILOR_TOKEN` environment variable:\n\n```bash\n# Using tailorctl to get access token\nenv TAILOR_TOKEN=$(tailorctl auth get accessToken) patterner metrics\n\n# Or set the token directly\nexport TAILOR_TOKEN=your_access_token\npatterner metrics\n```\n\nThe metrics command displays metrics in a table format. Use the `--out-octocov-path` option to output metrics in octocov custom metrics format with configurable acceptable thresholds.\n\n#### Metrics Options\n\n- `--since, -s` (default: \"30min\") - Analyze execution results since the specified time period\n- `--out-octocov-path` - Output metrics in octocov custom metrics format to the specified file\n- `--with-lint-warnings` (default: false) - Display lint warnings along with metrics output\n- `--with-coverage-full-report` (default: false) - Display detailed pipeline resolver step coverage along with metrics output\n\n##### Option Details\n\n**--with-coverage-full-report vs --with-lint-warnings:**\n- `--with-coverage-full-report`: Displays detailed pipeline resolver step coverage information for execution quality monitoring\n  - Shows coverage percentage and executed steps count for each resolver\n  - Format: `Coverage Rate% [Executed Steps/Total Steps] Resolver Name`\n- `--with-lint-warnings`: Displays detailed lint warnings list for code quality monitoring\n  - Shows specific lint issues and recommendations for code improvements\n\nBoth options can be used together to provide comprehensive analysis combining execution quality and code quality insights.\n\n#### Usage Examples\n\n```bash\n# Basic metrics (last 30 minutes)\npatterner metrics\n\n# Metrics for the past hour\npatterner metrics --since 1hour\n\n# Display metrics with lint warnings\npatterner metrics --with-lint-warnings\n\n# Display metrics with coverage details\npatterner metrics --with-coverage-full-report\n\n# Display metrics with both coverage and lint warnings\npatterner metrics --with-coverage-full-report --with-lint-warnings\n\n# Output metrics to octocov custom metrics file\npatterner metrics --out-octocov-path metrics.json\n\n# Comprehensive analysis with all options\npatterner metrics --since 24hours --out-octocov-path metrics.json --with-coverage-full-report --with-lint-warnings\n```\n\n#### Octocov Custom Metrics Format\n\nWhen using the `--out-octocov-path` option, patterner outputs metrics in octocov custom metrics format. This format includes:\n\n- **Metrics data** - All collected metrics with their values and units\n- **Acceptable thresholds** - Configurable conditions that define acceptable metric values\n  - Configured via `metrics.octocov.acceptables` in `.patterner.yml`\n  - Used by [octocov](https://github.com/k1LoW/octocov) to evaluate whether metrics meet quality standards\n\n**Example octocov output:**\n```json\n[\n  {\n    \"key\": \"patterner-metrics\",\n    \"name\": \"Patterner Metrics\",\n    \"metrics\": [\n      {\n        \"key\": \"pipeline_resolver_step_coverage_percentage\",\n        \"name\": \"Pipeline Resolver Step Coverage\",\n        \"value\": 75.0,\n        \"unit\": \"%\"\n      },\n      {\n        \"key\": \"lint_warnings_total\",\n        \"name\": \"Lint Warnings Total\",\n        \"value\": 3,\n        \"unit\": \"count\"\n      }\n    ],\n    \"acceptables\": [\n      \"current.pipeline_resolver_step_coverage_percentage \u003e= 80\",\n      \"diff.lint_warnings_total \u003c= 0\"\n    ]\n  }\n]\n```\n\n### View Coverage\n\nDisplay pipeline resolver step coverage for your workspace:\n\n```bash\npatterner coverage\n```\n\n**Note:** The coverage command requires a Tailor Platform access token. Set the `TAILOR_TOKEN` environment variable:\n\n```bash\n# Using tailorctl to get access token\nenv TAILOR_TOKEN=$(tailorctl auth get accessToken) patterner coverage\n\n# Or set the token directly\nexport TAILOR_TOKEN=your_access_token\npatterner coverage\n```\n\nThe coverage command analyzes pipeline resolver step execution and displays coverage percentages to help monitor pipeline execution quality.\n\n#### Coverage Options\n\n- `--since, -s` (default: \"30min\") - Analyze execution results since the specified time period\n- `--full-report, -f` (default: false) - Display detailed coverage report including per-resolver breakdown\n- `--workspace-id` - Target workspace ID to analyze\n\n#### Usage Examples\n\n```bash\n# Basic coverage analysis (last 30 minutes)\npatterner coverage\n\n# Coverage for the past hour\npatterner coverage --since 1hour\n\n# Detailed coverage report\npatterner coverage --full-report\n\n# Detailed report for the past 24 hours\npatterner coverage --since 24hours --full-report\n```\n\n#### Output Format\n\n**Standard output:**\n\n```\nPipeline Resolver Step Coverage 75.0% [3/4]\n```\n\n**Detailed report:**\nShows coverage breakdown per resolver in addition to overall coverage statistics.\n\n#### Available Metrics\n\nThe following metrics are collected and displayed:\n\n**Pipeline Metrics:**\n\n- `pipelines_total` - Total number of pipelines (Unit: count)\n- `pipeline_resolvers_total` - Total number of pipeline resolvers (Unit: count)\n- `pipeline_resolver_steps_total` - Total number of pipeline resolver steps (Unit: count)\n- `pipeline_resolver_graphql_steps_total` - Total number of Pipeline resolver GraphQL steps (Unit: count)\n- `pipeline_resolver_function_steps_total` - Total number of Pipeline resolver Function steps (Unit: count)\n- `pipeline_resolver_execution_paths_total` - Total number of pipeline resolver execution paths (Unit: count)\n  - Calculation: Based on the number of steps and tests in each resolver (steps \\* 2^tests)\n  - Includes overflow detection: Reports error if negative values are encountered\n  - Used to understand the total number of execution paths based on testable step combinations\n\n**TailorDB Metrics:**\n\n- `tailordbs_total` - Total number of TailorDBs (Unit: count)\n- `tailordb_types_total` - Total number of TailorDB types (Unit: count)\n- `tailordb_type_fields_total` - Total number of TailorDB type fields (Unit: count)\n\n**StateFlow Metrics:**\n\n- `stateflows_total` - Total number of StateFlows (Unit: count)\n\n**Coverage Metrics:**\n\n- `pipeline_resolver_step_coverage_percentage` - Pipeline resolver step coverage (Unit: %)\n  - Calculation: (covered steps / total steps) * 100\n  - Provides percentage representation of pipeline resolver step execution coverage\n\n**Lint Metrics:**\n\n- `lint_warnings_total` - Total number of lint warnings (Unit: count)\n  - Calculation: Number of warnings returned from the lint function\n  - Helps monitor code quality and adherence to best practices\n\n## Configuration\n\nPatterner uses a `.patterner.yml` file for configuration. The configuration includes various lint rules for different Tailor Platform components:\n\n```yaml\nworkspaceID: xxxxxxxXXxxxxxxxxxxxxx\nlint:\n  acceptable: 5\n  rules:\n    pipeline:\n      deprecatedFeature:\n        enabled: true\n        allowCELScript: false\n        allowDraft: false\n        allowStateFlow: false\n      insecureAuthorization:\n        enabled: false\n      stepCount:\n        enabled: true\n        max: 30\n      multipleMutations:\n        enabled: true\n      queryBeforeMutation:\n        enabled: true\n    tailordb:\n      deprecatedFeature:\n        enabled: true\n        allowDraft: false\n        allowCELHooks: false\n    stateflow:\n      deprecatedFeature:\n        enabled: true\nmetrics:\n  octocov:\n    acceptables:\n      - \"current.pipeline_resolver_step_coverage_percentage \u003e= 80\"\n      - \"diff.lint_warnings_total \u003c= 0\"\n```\n\n### Metrics Configuration\n\n#### Octocov Integration\n\n- **octocov** - Configuration for octocov custom metrics format output\n  - `acceptables` - List of acceptable threshold conditions for metrics\n    - Define minimum acceptable values for metrics in octocov format\n    - Used when outputting metrics with `--out-octocov-path` option\n    - Format: `\"metric_name operator value\"` (e.g., `\"coverage_percentage \u003e= 80\"`)\n    - Supports various metrics including coverage percentages and lint warning counts\n    - Example: `[\"pipeline_resolver_step_coverage_percentage \u003e= 80\", \"lint_warnings_total \u003c= 5\"]`\n\n### Lint Configuration\n\n#### Acceptable Warnings\n\n- **acceptable** - Set the maximum number of acceptable lint warnings (default: 0)\n  - When the number of warnings exceeds this value, the lint command will exit with a failure status\n  - This allows you to gradually improve code quality by setting a reasonable warning threshold\n  - Example: `acceptable: 5` allows up to 5 warnings before failing\n\n### Lint Rules\n\n#### Pipeline Rules\n\n- **deprecatedFeature** - Identify deprecated features and promote modern alternatives\n  - `enabled` (default: true) - Enable/disable deprecated feature detection\n  - `allowCELScript` (default: false) - Allow CEL script usage in pipelines\n  - `allowDraft` (default: false) - Allow draft resources in pipeline configurations\n  - `allowStateFlow` (default: false) - Allow StateFlow resources in pipeline configurations\n  - Detects deprecated patterns and recommends modern Pipeline alternatives\n    - https://docs.tailor.tech/reference/service-lifecycle-policy\n  - Enabled by default to promote migration away from deprecated features\n- **insecureAuthorization** - Detect insecure authorization patterns\n- **stepCount** - Ensure pipeline steps don't exceed maximum count\n- **multipleMutations** - Identify multiple mutations in a single operation\n- **queryBeforeMutation** - Check for queries before mutations\n\n#### TailorDB Rules\n\n- **deprecatedFeature** - Identify deprecated TailorDB features and promote modern alternatives\n  - `enabled` (default: true) - Enable/disable deprecated feature detection\n  - `allowDraft` (default: false) - Allow draft resources in TailorDB configurations\n  - `allowCELHooks` (default: false) - Allow CEL hook usage in TailorDB configurations\n  - Detects deprecated patterns and recommends modern TailorDB alternatives\n    - https://docs.tailor.tech/reference/service-lifecycle-policy\n  - Enabled by default to promote migration away from deprecated features\n\n#### StateFlow Rules\n\n- **deprecatedFeature** - Identify deprecated StateFlow features and promote modern alternatives\n  - `enabled` (default: true) - Enable/disable deprecated feature detection\n  - Detects deprecated StateFlow patterns and recommends modern alternatives\n    - https://docs.tailor.tech/reference/service-lifecycle-policy\n  - Enabled by default to promote migration away from deprecated features\n\n## Command Reference\n\n### Global Flags\n\n- `-w, --workspace-id string` - Workspace ID (can be set in configuration file)\n\n### Commands\n\n- `patterner init` - Initialize configuration file\n- `patterner lint` - Lint workspace resources\n- `patterner metrics` - Display workspace metrics\n  - `--since, -s` (default: \"30min\") - Analyze execution results since the specified time period\n  - `--out-octocov-path` - Output metrics in octocov custom metrics format to the specified file\n  - `--with-lint-warnings` - Display lint warnings along with metrics output\n  - `--with-coverage-full-report` - Display detailed pipeline resolver step coverage along with metrics output\n- `patterner coverage` - Display pipeline resolver step coverage\n\n---\n\nCopyright © 2025 Tailor Inc.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftailor-platform%2Fpatterner","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftailor-platform%2Fpatterner","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftailor-platform%2Fpatterner/lists"}