Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 25 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# QueryPackwerk

QueryPackwerk is a Ruby gem for querying and analyzing Packwerk violations in Ruby applications.
It provides a friendly API for exploring package.yml and package_todo.yml files, making it easier to manage module boundaries and dependencies in your codebase.
QueryPackwerk is a Ruby gem for querying and analyzing [Packwerk](https://github.com/Shopify/packwerk) violations in Ruby applications.
It provides a friendly API for exploring `package.yml` and `package_todo.yml` files, making it easier to manage module boundaries and dependencies in your codebase.

## Installation

This gem provides a cli interface that can be used independently from your application.
This gem provides a CLI interface that can be used independently from your application.

```bash
gem install query_packwerk
Expand All @@ -21,19 +21,32 @@ bundle add query_packwerk --group=development

### Console Interface

The easiest way to use QueryPackwerk is through its interactive console:
The easiest way to use QueryPackwerk is through its interactive console. This will use the local directory Packwerk context and provide you with all QueryPackwerk methods.

```bash
query_packwerk console
```

When the console loads, it will print a welcome message. You can access it any time with `help`:
The CLI includes a welcome message with a list of commands. You can access it any time with `welcome`:

```
query_packwerk:001:0> help
query_packwerk:001:0> welcome
```

The console will use the local directory Packwerk context and provide you with all QueryPackwerk methods.
Find packages to work with:

```ruby
# Get a package
query_packwerk:001:0> package("pack_name")

# Get all packages
query_packwerk:001:0> Packages.all

# Find a package
query_packwerk:001:0> Packages.where(name: /service/)
```

Explore violations:

```ruby
# Get all violations for a pack
Expand All @@ -54,28 +67,21 @@ query_packwerk:001:0> anonymous_violation_counts_for("pack_name")
# Get who consumes this pack
query_packwerk:001:0> consumers("pack_name")

# Get a package
query_packwerk:001:0> package("pack_name")

# Get all packages
query_packwerk:001:0> Packages.all

# Find a package
query_packwerk:001:0> Packages.where(name: /service/)

# Get all violations
query_packwerk:001:0> Violations.all

# Find violations
query_packwerk:001:0> Packages.where(constant_name: /Feature/, producing_pack: /service/)
```

If you change any of the package.yml or package_todo.yml files, you can reload the running console:

```ruby
# Reset the cache
query_packwerk:001:0> reload!
```

### Ruby API

You can also use QueryPackwerk programmatically in your Ruby code:
QueryPackwerk can also be used programmatically from Ruby:

```ruby
require 'query_packwerk'
Expand Down
6 changes: 3 additions & 3 deletions query_packwerk.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ Gem::Specification.new do |spec|

spec.summary = 'Query Packwerk'
spec.description = 'Query Packwerk violations and dependencies.'
spec.homepage = 'https://github.com/gusto/query_packwerk'
spec.homepage = 'https://github.com/rubyatscale/query_packwerk'
spec.license = 'MIT'
spec.required_ruby_version = '>= 3.1.0'

spec.metadata['allowed_push_host'] = 'https://rubygems.org'

spec.metadata['homepage_uri'] = spec.homepage
spec.metadata['source_code_uri'] = 'https://github.com/gusto/query_packwerk'
spec.metadata['changelog_uri'] = 'https://github.com/gusto/query_packwerk/blob/main/CHANGELOG.md'
spec.metadata['source_code_uri'] = 'https://github.com/rubyatscale/query_packwerk'
spec.metadata['changelog_uri'] = 'https://github.com/rubyatscale/query_packwerk/blob/main/CHANGELOG.md'

# Specify which files should be added to the gem when it is released.
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
Expand Down
4 changes: 0 additions & 4 deletions sig/query_packwerk.rbs

This file was deleted.