Skip to content

ddnetters/stringly-typed

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace
Stringly-Typed

Stringly-Typed

Catch off-brand copy before it ships.

GitHub Marketplace GitHub release License: MIT codecov Website Demo Repo


The Problem

Your style guide says "customers," but someone just merged a PR with "users" in 12 places. Your docs say "click," but your buttons say "tap," "press," and "select."

Brand consistency dies in pull requests. Code review catches bugs, not tone. And nobody has time to manually check every string.


How It Works

Stringly-Typed is a GitHub Action that validates UI strings against your brand voice using AI.

  • Runs on every PR β€” Catches issues before merge, not after deploy
  • Uses your style guide β€” Define rules once in markdown, enforce everywhere
  • 2-minute setup β€” One workflow file, one style guide, done
  • Fast feedback β€” Analyzes only changed files in ~2-5 seconds

Quickstart

1. Create your style guide

Add STYLE_GUIDE.md to your repo:

# Brand Voice

- Use active voice, not passive
- Say "customers" not "users"
- Keep sentences under 20 words
- Be friendly but professional

2. Add the workflow

Create .github/workflows/stringly-typed.yml:

name: Stringly-Typed
on: [push, pull_request]

jobs:
  brand-check:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: ddnetters/stringly-typed@v1
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
        with:
          files: 'src/**/*.{js,ts,tsx}'
          checker: 'brand_style'
          style-guide-file: 'STYLE_GUIDE.md'
          decider: 'threshold'
          decider-options: '{"minValidRatio": 0.9}'

That's it. Stringly-Typed now validates every string against your brand voice.


Example Output

Stringly-Typed Results:
β”œβ”€β”€ src/components/Button.tsx
β”‚   β”œβ”€β”€ Line 12: "Click here to continue" ❌
β”‚   β”‚   └── Use "Select" not "Click" (terminology)
β”‚   └── Line 18: "Your order has been placed" βœ… OK
β”œβ”€β”€ src/utils/errors.ts
β”‚   └── Line 5: "An error was encountered by the system" ❌
β”‚       └── Use active voice: "Something went wrong" (tone)
└── Summary: 4/6 strings valid (67%) - FAILED

Use Cases

Brand Voice Enforcement

Ensure every user-facing string matches your tone guidelines. Define voice rules in your style guide, and Stringly-Typed flags violations like passive voice, wrong terminology, or off-brand phrasing.

checker: 'brand_style'
style-guide-file: 'STYLE_GUIDE.md'
Documentation Consistency

Validate markdown files for consistent terminology and style. Great for docs-as-code workflows where multiple contributors write documentation.

files: 'docs/**/*.md'
checker: 'brand_style'
String Length Limits

Enforce character limits for UI stringsβ€”useful for buttons, tooltips, and mobile interfaces where space is constrained.

checker: 'char_count'
checker-options: '{"maxChars": 40}'
Custom Validation Rules

Write your own JavaScript validation logic for specialized requirements like banned words, required patterns, or domain-specific rules.

checker: 'custom'
checker-options: '{"expression": "!content.toLowerCase().includes(\"todo\")"}'

PR Comments

Stringly-Typed can automatically comment on pull requests with validation results.

Value Behavior
on-failure Comment only when validation fails (default)
always Comment on every PR run
never Disable PR comments
- uses: ddnetters/stringly-typed@v1
  env:
    GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  with:
    comment: 'on-failure'

Checkers

Checker Use Case
brand_style AI-powered voice & tone validation
char_count Enforce max string length
custom Your own JavaScript validation logic

Documentation

Guide Description
Installation Setup, local dev, Docker, npm package
Configuration All options in detail
Checkers char_count, custom, brand_style
Deciders threshold, noCritical, custom
LLM Providers OpenAI, OpenRouter, Anthropic, Azure, AWS Bedrock, Groq, and more
Examples Real-world usage scenarios
API Reference TypeScript interfaces
Troubleshooting Common issues

Common Questions

How much does the AI cost?

You use your own API key. A typical PR check costs $0.01-0.05 depending on how many strings changed.

Is my code sent to the LLM?

Only the string literals you specify are analyzed. Your source code logic is never sent.

Can I use Claude or Gemini instead of OpenAI?

Yes! Stringly-Typed supports multiple LLM providers. See the Providers Guide for setup instructions.

What if it flags false positives?

Configure sensitivity in your style guide, or set the decider threshold lower. You can also use warn mode instead of blocking merges.

Does it work with my stack?

Works with any text filesβ€”TypeScript, JavaScript, JSX, JSON, Markdown, YAML. Configure file patterns to match your project.

How do I ignore certain strings?

Use file patterns to exclude paths, or configure checker options to skip specific patterns. See Configuration for details.


Contributing

Contributions welcome! See CONTRIBUTING.md for guidelines.


License

MIT - see LICENSE

Sponsor this project

Packages

 
 
 

Contributors