patterner

command module
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 8, 2025 License: MIT Imports: 1 Imported by: 0

README

Patterner

patterner is a tool to analyze and present best practices (patterns) for Tailor Platform applications.

Overview

Patterner 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.

Features

  • Lint - Analyze resources in your workspace and identify potential issues or deviations from best practices
  • Metrics - Collect and display metrics about resources in your workspace
  • Configuration - Flexible configuration system with YAML-based settings

Installation

go install github.com/tailor-platform/patterner@latest

Usage

Initialize Configuration

Create a .patterner.yml configuration file in your project:

patterner init

You can also specify a workspace ID during initialization:

patterner init -w YOUR_WORKSPACE_ID
Lint Your Workspace

Check your workspace resources against configured patterns:

patterner lint

Or specify a workspace ID directly:

patterner lint -w YOUR_WORKSPACE_ID

Note: The lint command requires a Tailor Platform access token. Set the TAILOR_TOKEN environment variable:

# Using tailorctl to get access token
env TAILOR_TOKEN=$(tailorctl auth get accessToken) patterner lint

# Or set the token directly
export TAILOR_TOKEN=your_access_token
patterner lint
View Metrics

Display metrics about resources in your workspace:

patterner metrics

Note: The metrics command requires a Tailor Platform access token. Set the TAILOR_TOKEN environment variable:

# Using tailorctl to get access token
env TAILOR_TOKEN=$(tailorctl auth get accessToken) patterner metrics

# Or set the token directly
export TAILOR_TOKEN=your_access_token
patterner metrics

The metrics command outputs detailed JSON data about your workspace resources.

Configuration

Patterner uses a .patterner.yml file for configuration. The configuration includes various lint rules for different Tailor Platform components:

workspaceID: xxxxxxxXXxxxxxxxxxxxxx
lint:
  pipeline:
    deprecatedFeature:
      enabled: true
      allowCELScript: false
      allowDraft: false
      allowStateFlow: false
    insecureAuthorization:
      enabled: false
    stepLength:
      enabled: true
      max: 30
    multipleMutations:
      enabled: true
    queryBeforeMutation:
      enabled: true
  tailordb:
    deprecatedFeature:
      enabled: true
      allowDraft: false
      allowCELHooks: false
  stateflow:
    deprecatedFeature:
      enabled: true
Lint Rules
Pipeline Rules
  • deprecatedFeature - Identify deprecated features and promote modern alternatives
    • enabled (default: true) - Enable/disable deprecated feature detection
    • allowCELScript (default: false) - Allow CEL script usage in pipelines
    • allowDraft (default: false) - Allow draft resources in pipeline configurations
    • allowStateFlow (default: false) - Allow StateFlow resources in pipeline configurations
    • Detects deprecated patterns and recommends modern Pipeline alternatives
    • Enabled by default to promote migration away from deprecated features
  • insecureAuthorization - Detect insecure authorization patterns
  • stepLength - Ensure pipeline steps don't exceed maximum length
  • multipleMutations - Identify multiple mutations in a single operation
  • queryBeforeMutation - Check for queries before mutations
TailorDB Rules
  • deprecatedFeature - Identify deprecated TailorDB features and promote modern alternatives
    • enabled (default: true) - Enable/disable deprecated feature detection
    • allowDraft (default: false) - Allow draft resources in TailorDB configurations
    • allowCELHooks (default: false) - Allow CEL hook usage in TailorDB configurations
    • Detects deprecated patterns and recommends modern TailorDB alternatives
    • Enabled by default to promote migration away from deprecated features
StateFlow Rules
  • deprecatedFeature - Identify deprecated StateFlow features and promote modern alternatives

Command Reference

Global Flags
  • -w, --workspace-id string - Workspace ID (can be set in configuration file)
Commands
  • patterner init - Initialize configuration file
  • patterner lint - Lint workspace resources
  • patterner metrics - Display workspace metrics

License

MIT License

Copyright © 2025 Tailor Inc.

Documentation

Overview

Copyright © 2025 Tailor Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL