use_packwerk 0.54.0 → 0.56.0
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.
- checksums.yaml +4 -4
- data/lib/use_packwerk/cli.rb +10 -10
- data/lib/use_packwerk/code_ownership_post_processor.rb +3 -3
- data/lib/use_packwerk/configuration.rb +18 -14
- data/lib/use_packwerk/default_user_event_logger.rb +7 -0
- data/lib/use_packwerk/logging.rb +1 -2
- data/lib/use_packwerk/per_file_processor_interface.rb +1 -2
- data/lib/use_packwerk/private/file_move_operation.rb +9 -11
- data/lib/use_packwerk/private/pack_relationship_analyzer.rb +24 -108
- data/lib/use_packwerk/private.rb +117 -155
- data/lib/use_packwerk/rubocop_post_processor.rb +17 -17
- data/lib/use_packwerk/user_event_logger.rb +265 -0
- data/lib/use_packwerk.rb +28 -74
- metadata +49 -19
| @@ -0,0 +1,265 @@ | |
| 1 | 
            +
            # typed: strict
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            module UsePackwerk
         | 
| 4 | 
            +
              module UserEventLogger
         | 
| 5 | 
            +
                extend T::Sig
         | 
| 6 | 
            +
                extend T::Helpers
         | 
| 7 | 
            +
             | 
| 8 | 
            +
                abstract!
         | 
| 9 | 
            +
             | 
| 10 | 
            +
                sig { params(pack_name: String).returns(String) }
         | 
| 11 | 
            +
                def before_create_pack(pack_name)
         | 
| 12 | 
            +
                  <<~MSG
         | 
| 13 | 
            +
                    You are creating a pack, which is great. Check out #{documentation_link} for more info!
         | 
| 14 | 
            +
                  MSG
         | 
| 15 | 
            +
                end
         | 
| 16 | 
            +
             | 
| 17 | 
            +
                sig { params(pack_name: String).returns(String) }
         | 
| 18 | 
            +
                def after_create_pack(pack_name)
         | 
| 19 | 
            +
                  <<~MSG
         | 
| 20 | 
            +
                    Your next steps might be:
         | 
| 21 | 
            +
             | 
| 22 | 
            +
                    1) Move files into your pack with `bin/use_packwerk move #{pack_name} path/to/file.rb`
         | 
| 23 | 
            +
             | 
| 24 | 
            +
                    2) Run `bin/packwerk update-deprecations` to update the violations. Make sure to run `spring stop` if you've added new load paths (new top-level directories) in your pack.
         | 
| 25 | 
            +
             | 
| 26 | 
            +
                    3) Update TODO lists for rubocop implemented protections. See #{documentation_link} for more info
         | 
| 27 | 
            +
             | 
| 28 | 
            +
                    4) Expose public API in #{pack_name}/app/public. Try `bin/use_packwerk make_public #{pack_name}/path/to/file.rb`
         | 
| 29 | 
            +
             | 
| 30 | 
            +
                    5) Update your readme at #{pack_name}/README.md
         | 
| 31 | 
            +
                  MSG
         | 
| 32 | 
            +
                end
         | 
| 33 | 
            +
             | 
| 34 | 
            +
                sig { params(pack_name: String).returns(String) }
         | 
| 35 | 
            +
                def before_move_to_pack(pack_name)
         | 
| 36 | 
            +
                  <<~MSG
         | 
| 37 | 
            +
                    You are moving a file to a pack, which is great. Check out #{documentation_link} for more info!
         | 
| 38 | 
            +
                  MSG
         | 
| 39 | 
            +
                end
         | 
| 40 | 
            +
             | 
| 41 | 
            +
                sig { params(pack_name: String).returns(String) }
         | 
| 42 | 
            +
                def after_move_to_pack(pack_name)
         | 
| 43 | 
            +
                  <<~MSG
         | 
| 44 | 
            +
                    Your next steps might be:
         | 
| 45 | 
            +
             | 
| 46 | 
            +
                    1) Run `bin/packwerk update-deprecations` to update the violations. Make sure to run `spring stop` if you've added new load paths (new top-level directories) in your pack.
         | 
| 47 | 
            +
             | 
| 48 | 
            +
                    2) Update TODO lists for rubocop implemented protections. See #{documentation_link} for more info
         | 
| 49 | 
            +
             | 
| 50 | 
            +
                    3) Touch base with each team who owns files involved in this move
         | 
| 51 | 
            +
             | 
| 52 | 
            +
                    4) Expose public API in #{pack_name}/app/public. Try `bin/use_packwerk make_public #{pack_name}/path/to/file.rb`
         | 
| 53 | 
            +
             | 
| 54 | 
            +
                    5) Update your readme at #{pack_name}/README.md
         | 
| 55 | 
            +
                  MSG
         | 
| 56 | 
            +
                end
         | 
| 57 | 
            +
             | 
| 58 | 
            +
                sig { returns(String) }
         | 
| 59 | 
            +
                def before_make_public
         | 
| 60 | 
            +
                  <<~MSG
         | 
| 61 | 
            +
                    You are moving some files into public API. See #{documentation_link} for other utilities!
         | 
| 62 | 
            +
                  MSG
         | 
| 63 | 
            +
                end
         | 
| 64 | 
            +
             | 
| 65 | 
            +
                sig { returns(String) }
         | 
| 66 | 
            +
                def after_make_public
         | 
| 67 | 
            +
                  <<~MSG
         | 
| 68 | 
            +
                    Your next steps might be:
         | 
| 69 | 
            +
             | 
| 70 | 
            +
                    1) Run `bin/packwerk update-deprecations` to update the violations. Make sure to run `spring stop` if you've added new load paths (new top-level directories) in your pack.
         | 
| 71 | 
            +
             | 
| 72 | 
            +
                    2) Update TODO lists for rubocop implemented protections. See #{documentation_link} for more info
         | 
| 73 | 
            +
             | 
| 74 | 
            +
                    3) Work to migrate clients of private API to your new public API
         | 
| 75 | 
            +
             | 
| 76 | 
            +
                    4) Update your README at packs/your_package_name/README.md
         | 
| 77 | 
            +
                  MSG
         | 
| 78 | 
            +
                end
         | 
| 79 | 
            +
             | 
| 80 | 
            +
                sig { params(pack_name: String).returns(String) }
         | 
| 81 | 
            +
                def before_add_dependency(pack_name)
         | 
| 82 | 
            +
                  <<~MSG
         | 
| 83 | 
            +
                    You are adding a dependency. See #{documentation_link} for other utilities!
         | 
| 84 | 
            +
                  MSG
         | 
| 85 | 
            +
                end
         | 
| 86 | 
            +
             | 
| 87 | 
            +
                sig { params(pack_name: String).returns(String) }
         | 
| 88 | 
            +
                def after_add_dependency(pack_name)
         | 
| 89 | 
            +
                  <<~MSG
         | 
| 90 | 
            +
                    Your next steps might be:
         | 
| 91 | 
            +
             | 
| 92 | 
            +
                    1) Run `bin/packwerk validate` to ensure you haven't introduced a cyclic dependency
         | 
| 93 | 
            +
             | 
| 94 | 
            +
                    2) Run `bin/packwerk update-deprecations` to update the violations.
         | 
| 95 | 
            +
                  MSG
         | 
| 96 | 
            +
                end
         | 
| 97 | 
            +
             | 
| 98 | 
            +
                sig { params(pack_name: String).returns(String) }
         | 
| 99 | 
            +
                def before_move_to_parent(pack_name)
         | 
| 100 | 
            +
                  <<~MSG
         | 
| 101 | 
            +
                    You are moving one pack to be a child of a different pack. Check out #{documentation_link} for more info!
         | 
| 102 | 
            +
                  MSG
         | 
| 103 | 
            +
                end
         | 
| 104 | 
            +
             | 
| 105 | 
            +
                sig { params(pack_name: String).returns(String) }
         | 
| 106 | 
            +
                def after_move_to_parent(pack_name)
         | 
| 107 | 
            +
                  <<~MSG
         | 
| 108 | 
            +
                    Your next steps might be:
         | 
| 109 | 
            +
             | 
| 110 | 
            +
                    1) Delete the old pack when things look good: `rm -rf #{pack_name}`
         | 
| 111 | 
            +
             | 
| 112 | 
            +
                    2) Run `bin/packwerk update-deprecations` to update the violations. Make sure to run `spring stop` first.
         | 
| 113 | 
            +
                  MSG
         | 
| 114 | 
            +
                end
         | 
| 115 | 
            +
             | 
| 116 | 
            +
                sig { params(pack_name: String).returns(String) }
         | 
| 117 | 
            +
                def on_create_public_directory_todo(pack_name)
         | 
| 118 | 
            +
                  <<~MSG
         | 
| 119 | 
            +
                    This directory holds your public API!
         | 
| 120 | 
            +
             | 
| 121 | 
            +
                    Any classes, constants, or modules that you want other packs to use and you intend to support should go in here.
         | 
| 122 | 
            +
                    Anything that is considered private should go in other folders.
         | 
| 123 | 
            +
             | 
| 124 | 
            +
                    If another pack uses classes, constants, or modules that are not in your public folder, it will be considered a "privacy violation" by packwerk.
         | 
| 125 | 
            +
                    You can prevent other packs from using private API by using package_protections.
         | 
| 126 | 
            +
             | 
| 127 | 
            +
                    Want to find how your private API is being used today?
         | 
| 128 | 
            +
                    Try running: `bin/use_packwerk list_top_privacy_violations #{pack_name}`
         | 
| 129 | 
            +
             | 
| 130 | 
            +
                    Want to move something into this folder?
         | 
| 131 | 
            +
                    Try running: `bin/use_packwerk make_public #{pack_name}/path/to/file.rb`
         | 
| 132 | 
            +
             | 
| 133 | 
            +
                    One more thing -- feel free to delete this file and replace it with a README.md describing your package in the main package directory.
         | 
| 134 | 
            +
             | 
| 135 | 
            +
                    See #{documentation_link} for more info!
         | 
| 136 | 
            +
                  MSG
         | 
| 137 | 
            +
                end
         | 
| 138 | 
            +
             | 
| 139 | 
            +
                sig { params(pack_name: String).returns(String) }
         | 
| 140 | 
            +
                def on_create_readme_todo(pack_name)
         | 
| 141 | 
            +
                  <<~MSG
         | 
| 142 | 
            +
                    Welcome to `#{pack_name}`!
         | 
| 143 | 
            +
             | 
| 144 | 
            +
                    If you're the author, please consider replacing this file with a README.md, which may contain:
         | 
| 145 | 
            +
                    - What your pack is and does
         | 
| 146 | 
            +
                    - How you expect people to use your pack
         | 
| 147 | 
            +
                    - Example usage of your pack's public API (which lives in `#{pack_name}/app/public`)
         | 
| 148 | 
            +
                    - Limitations, risks, and important considerations of usage
         | 
| 149 | 
            +
                    - How to get in touch with eng and other stakeholders for questions or issues pertaining to this pack (note: it is recommended to add ownership in `#{pack_name}/package.yml` under the `owner` metadata key)
         | 
| 150 | 
            +
                    - What SLAs/SLOs (service level agreements/objectives), if any, your package provides
         | 
| 151 | 
            +
                    - When in doubt, keep it simple
         | 
| 152 | 
            +
                    - Anything else you may want to include!
         | 
| 153 | 
            +
             | 
| 154 | 
            +
                    README.md files are under version control and should change as your public API changes.#{' '}
         | 
| 155 | 
            +
             | 
| 156 | 
            +
                    See #{documentation_link} for more info!
         | 
| 157 | 
            +
                  MSG
         | 
| 158 | 
            +
                end
         | 
| 159 | 
            +
             | 
| 160 | 
            +
                sig { params(pack_name: T.nilable(String), limit: Integer).returns(String) }
         | 
| 161 | 
            +
                def before_list_top_dependency_violations(pack_name, limit)
         | 
| 162 | 
            +
                  if pack_name.nil?
         | 
| 163 | 
            +
                    pack_specific_content = <<~PACK_CONTENT
         | 
| 164 | 
            +
                      You are listing top #{limit} dependency violations for all packs. See #{documentation_link} for other utilities!
         | 
| 165 | 
            +
                      Pass in a limit to display more or less, e.g. `use_packwerk list_top_dependency_violations #{pack_name} -l 1000`
         | 
| 166 | 
            +
             | 
| 167 | 
            +
                      This script is intended to help you find which of YOUR pack's private classes, constants, or modules other packs are using the most.
         | 
| 168 | 
            +
                      Anything not in pack_name/app/public is considered private API.
         | 
| 169 | 
            +
                    PACK_CONTENT
         | 
| 170 | 
            +
                  else
         | 
| 171 | 
            +
                    pack_specific_content = <<~PACK_CONTENT
         | 
| 172 | 
            +
                      You are listing top #{limit} dependency violations for #{pack_name}. See #{documentation_link} for other utilities!
         | 
| 173 | 
            +
                      Pass in a limit to display more or less, e.g. `bin/use_packwerk list_top_dependency_violations #{pack_name} -l 1000`
         | 
| 174 | 
            +
             | 
| 175 | 
            +
                      This script is intended to help you find which of YOUR pack's private classes, constants, or modules other packs are using the most.
         | 
| 176 | 
            +
                      Anything not in #{pack_name}/app/public is considered private API.
         | 
| 177 | 
            +
                    PACK_CONTENT
         | 
| 178 | 
            +
                  end
         | 
| 179 | 
            +
             | 
| 180 | 
            +
                  <<~MSG
         | 
| 181 | 
            +
                    #{pack_specific_content}
         | 
| 182 | 
            +
             | 
| 183 | 
            +
                    When using this script, ask yourself some questions like:
         | 
| 184 | 
            +
                    - What do I want to support?
         | 
| 185 | 
            +
                    - What do I *not* want to support?
         | 
| 186 | 
            +
                    - Which direction should a dependency go?
         | 
| 187 | 
            +
                    - What packs should depend on you, and what packs should not depend on you?
         | 
| 188 | 
            +
                    - Would it be simpler if other packs only depended on interfaces to your pack rather than implementation?
         | 
| 189 | 
            +
             | 
| 190 | 
            +
                    Looking at dependency violations can help guide the development of your public API, but it is just the beginning!
         | 
| 191 | 
            +
             | 
| 192 | 
            +
                    The script will output in the following format:
         | 
| 193 | 
            +
             | 
| 194 | 
            +
                    SomeConstant # This is the name of a class, constant, or module defined in your pack, outside of app/public
         | 
| 195 | 
            +
                      - Total Count: 5 # This is the total number of unstated uses of this outside your pack
         | 
| 196 | 
            +
                      - By package: # This is a breakdown of the use of this constant by other packages
         | 
| 197 | 
            +
                        # This is the number of files in this pack that this constant is used.
         | 
| 198 | 
            +
                        # Check `packs/other_pack_a/deprecated_references.yml` under the '#{pack_name}'.'SomeConstant' key to see where this constant is used
         | 
| 199 | 
            +
                        - packs/other_pack_a: 3
         | 
| 200 | 
            +
                        - packs/other_pack_b: 2
         | 
| 201 | 
            +
                    SomeClass # This is the second most violated class, constant, or module defined in your pack
         | 
| 202 | 
            +
                      - Total Count: 2
         | 
| 203 | 
            +
                      - By package:
         | 
| 204 | 
            +
                        - packs/other_pack_a: 1
         | 
| 205 | 
            +
                        - packs/other_pack_b: 1
         | 
| 206 | 
            +
                  MSG
         | 
| 207 | 
            +
                end
         | 
| 208 | 
            +
             | 
| 209 | 
            +
                sig { params(pack_name: T.nilable(String), limit: Integer).returns(String) }
         | 
| 210 | 
            +
                def before_list_top_privacy_violations(pack_name, limit)
         | 
| 211 | 
            +
                  if pack_name.nil?
         | 
| 212 | 
            +
                    pack_specific_content = <<~PACK_CONTENT
         | 
| 213 | 
            +
                      You are listing top #{limit} privacy violations for all packs. See #{documentation_link} for other utilities!
         | 
| 214 | 
            +
                      Pass in a limit to display more or less, e.g. `bin/use_packwerk list_top_privacy_violations #{pack_name} -l 1000`
         | 
| 215 | 
            +
             | 
| 216 | 
            +
                      This script is intended to help you find which of YOUR pack's private classes, constants, or modules other packs are using the most.
         | 
| 217 | 
            +
                      Anything not in pack_name/app/public is considered private API.
         | 
| 218 | 
            +
                    PACK_CONTENT
         | 
| 219 | 
            +
                  else
         | 
| 220 | 
            +
                    pack_specific_content = <<~PACK_CONTENT
         | 
| 221 | 
            +
                      You are listing top #{limit} privacy violations for #{pack_name}. See #{documentation_link} for other utilities!
         | 
| 222 | 
            +
                      Pass in a limit to display more or less, e.g. `bin/use_packwerk list_top_privacy_violations #{pack_name} -l 1000`
         | 
| 223 | 
            +
             | 
| 224 | 
            +
                      This script is intended to help you find which of YOUR pack's private classes, constants, or modules other packs are using the most.
         | 
| 225 | 
            +
                      Anything not in #{pack_name}/app/public is considered private API.
         | 
| 226 | 
            +
                    PACK_CONTENT
         | 
| 227 | 
            +
                  end
         | 
| 228 | 
            +
             | 
| 229 | 
            +
                  <<~MSG
         | 
| 230 | 
            +
                    #{pack_specific_content}
         | 
| 231 | 
            +
             | 
| 232 | 
            +
                    When using this script, ask yourself some questions like:
         | 
| 233 | 
            +
                    - What do I want to support?
         | 
| 234 | 
            +
                    - What do I *not* want to support?
         | 
| 235 | 
            +
                    - What is considered simply an implementation detail, and what is essential to the behavior of my pack?
         | 
| 236 | 
            +
                    - What is a simple, minimialistic API for clients to engage with the behavior of your pack?
         | 
| 237 | 
            +
                    - How do I ensure my public API is not coupled to specific client's use cases?
         | 
| 238 | 
            +
             | 
| 239 | 
            +
                    Looking at privacy violations can help guide the development of your public API, but it is just the beginning!
         | 
| 240 | 
            +
             | 
| 241 | 
            +
                    The script will output in the following format:
         | 
| 242 | 
            +
             | 
| 243 | 
            +
                    SomeConstant # This is the name of a class, constant, or module defined in your pack, outside of app/public
         | 
| 244 | 
            +
                      - Total Count: 5 # This is the total number of uses of this outside your pack
         | 
| 245 | 
            +
                      - By package: # This is a breakdown of the use of this constant by other packages
         | 
| 246 | 
            +
                        # This is the number of files in this pack that this constant is used.
         | 
| 247 | 
            +
                        # Check `packs/other_pack_a/deprecated_references.yml` under the '#{pack_name}'.'SomeConstant' key to see where this constant is used
         | 
| 248 | 
            +
                        - packs/other_pack_a: 3
         | 
| 249 | 
            +
                        - packs/other_pack_b: 2
         | 
| 250 | 
            +
                    SomeClass # This is the second most violated class, constant, or module defined in your pack
         | 
| 251 | 
            +
                      - Total Count: 2
         | 
| 252 | 
            +
                      - By package:
         | 
| 253 | 
            +
                        - packs/other_pack_a: 1
         | 
| 254 | 
            +
                        - packs/other_pack_b: 1
         | 
| 255 | 
            +
             | 
| 256 | 
            +
                    Lastly, remember you can use `bin/use_packwerk make_public #{pack_name}/path/to/file.rb` to make your class, constant, or module public API.
         | 
| 257 | 
            +
                  MSG
         | 
| 258 | 
            +
                end
         | 
| 259 | 
            +
             | 
| 260 | 
            +
                sig { returns(String) }
         | 
| 261 | 
            +
                def documentation_link
         | 
| 262 | 
            +
                  'https://github.com/rubyatscale/use_packwerk#readme'
         | 
| 263 | 
            +
                end
         | 
| 264 | 
            +
              end
         | 
| 265 | 
            +
            end
         | 
    
        data/lib/use_packwerk.rb
    CHANGED
    
    | @@ -24,11 +24,11 @@ require 'use_packwerk/cli' | |
| 24 24 | 
             
            module UsePackwerk
         | 
| 25 25 | 
             
              extend T::Sig
         | 
| 26 26 |  | 
| 27 | 
            -
              PERMITTED_PACK_LOCATIONS = T.let([
         | 
| 28 | 
            -
             | 
| 29 | 
            -
             | 
| 30 | 
            -
             | 
| 31 | 
            -
             | 
| 27 | 
            +
              PERMITTED_PACK_LOCATIONS = T.let(%w[
         | 
| 28 | 
            +
                                                 gems
         | 
| 29 | 
            +
                                                 components
         | 
| 30 | 
            +
                                                 packs
         | 
| 31 | 
            +
                                               ], T::Array[String])
         | 
| 32 32 |  | 
| 33 33 | 
             
              sig do
         | 
| 34 34 | 
             
                params(
         | 
| @@ -45,7 +45,7 @@ module UsePackwerk | |
| 45 45 | 
             
                Private.create_pack!(
         | 
| 46 46 | 
             
                  pack_name: pack_name,
         | 
| 47 47 | 
             
                  enforce_privacy: enforce_privacy,
         | 
| 48 | 
            -
                  enforce_dependencies: enforce_dependencies | 
| 48 | 
            +
                  enforce_dependencies: enforce_dependencies
         | 
| 49 49 | 
             
                )
         | 
| 50 50 | 
             
              end
         | 
| 51 51 |  | 
| @@ -53,7 +53,7 @@ module UsePackwerk | |
| 53 53 | 
             
                params(
         | 
| 54 54 | 
             
                  pack_name: String,
         | 
| 55 55 | 
             
                  paths_relative_to_root: T::Array[String],
         | 
| 56 | 
            -
                  per_file_processors: T::Array[PerFileProcessorInterface] | 
| 56 | 
            +
                  per_file_processors: T::Array[PerFileProcessorInterface]
         | 
| 57 57 | 
             
                ).void
         | 
| 58 58 | 
             
              end
         | 
| 59 59 | 
             
              def self.move_to_pack!(
         | 
| @@ -62,36 +62,18 @@ module UsePackwerk | |
| 62 62 | 
             
                per_file_processors: []
         | 
| 63 63 | 
             
              )
         | 
| 64 64 | 
             
                Logging.section('👋 Hi!') do
         | 
| 65 | 
            -
                  intro =  | 
| 66 | 
            -
                    You are moving a file to a pack, which is great. Check out #{UsePackwerk.config.documentation_link} for more info!
         | 
| 67 | 
            -
             | 
| 68 | 
            -
                    Please bring any questions or issues you have in your development process to #ruby-modularity or #product-infrastructure.
         | 
| 69 | 
            -
                    We'd be happy to try to help through pairing, accepting feedback, changing our process, changing our tools, and more.
         | 
| 70 | 
            -
                  INTRO
         | 
| 65 | 
            +
                  intro = UsePackwerk.config.user_event_logger.before_move_to_pack(pack_name)
         | 
| 71 66 | 
             
                  Logging.print_bold_green(intro)
         | 
| 72 67 | 
             
                end
         | 
| 73 68 |  | 
| 74 69 | 
             
                Private.move_to_pack!(
         | 
| 75 70 | 
             
                  pack_name: pack_name,
         | 
| 76 71 | 
             
                  paths_relative_to_root: paths_relative_to_root,
         | 
| 77 | 
            -
                  per_file_processors: per_file_processors | 
| 72 | 
            +
                  per_file_processors: per_file_processors
         | 
| 78 73 | 
             
                )
         | 
| 79 74 |  | 
| 80 75 | 
             
                Logging.section('Next steps') do
         | 
| 81 | 
            -
                  next_steps =  | 
| 82 | 
            -
                    Your next steps might be:
         | 
| 83 | 
            -
             | 
| 84 | 
            -
                    1) Run `bin/packwerk update-deprecations` to update the violations. Make sure to run `spring stop` if you've added new load paths (new top-level directories) in your pack.
         | 
| 85 | 
            -
             | 
| 86 | 
            -
                    2) Update TODO lists for rubocop implemented protections. See #{UsePackwerk.config.documentation_link} for more info
         | 
| 87 | 
            -
             | 
| 88 | 
            -
                    3) Touch base with each team who owns files involved in this move
         | 
| 89 | 
            -
             | 
| 90 | 
            -
                    4) Expose public API in #{pack_name}/app/public. Try `bin/use_packwerk make_public #{pack_name}/path/to/file.rb`
         | 
| 91 | 
            -
             | 
| 92 | 
            -
                    5) Update your readme at #{pack_name}/README.md
         | 
| 93 | 
            -
                  NEXT_STEPS
         | 
| 94 | 
            -
             | 
| 76 | 
            +
                  next_steps = UsePackwerk.config.user_event_logger.after_move_to_pack(pack_name)
         | 
| 95 77 | 
             
                  Logging.print_bold_green(next_steps)
         | 
| 96 78 | 
             
                end
         | 
| 97 79 | 
             
              end
         | 
| @@ -99,7 +81,7 @@ module UsePackwerk | |
| 99 81 | 
             
              sig do
         | 
| 100 82 | 
             
                params(
         | 
| 101 83 | 
             
                  paths_relative_to_root: T::Array[String],
         | 
| 102 | 
            -
                  per_file_processors: T::Array[PerFileProcessorInterface] | 
| 84 | 
            +
                  per_file_processors: T::Array[PerFileProcessorInterface]
         | 
| 103 85 | 
             
                ).void
         | 
| 104 86 | 
             
              end
         | 
| 105 87 | 
             
              def self.make_public!(
         | 
| @@ -107,9 +89,7 @@ module UsePackwerk | |
| 107 89 | 
             
                per_file_processors: []
         | 
| 108 90 | 
             
              )
         | 
| 109 91 | 
             
                Logging.section('Making files public') do
         | 
| 110 | 
            -
                  intro =  | 
| 111 | 
            -
                    You are moving some files into public API. See #{UsePackwerk.config.documentation_link} for other utilities!
         | 
| 112 | 
            -
                  INTRO
         | 
| 92 | 
            +
                  intro = UsePackwerk.config.user_event_logger.before_make_public
         | 
| 113 93 | 
             
                  Logging.print_bold_green(intro)
         | 
| 114 94 | 
             
                end
         | 
| 115 95 |  | 
| @@ -117,20 +97,9 @@ module UsePackwerk | |
| 117 97 | 
             
                  paths_relative_to_root: paths_relative_to_root,
         | 
| 118 98 | 
             
                  per_file_processors: per_file_processors
         | 
| 119 99 | 
             
                )
         | 
| 120 | 
            -
              
         | 
| 121 | 
            -
                Logging.section('Next steps') do
         | 
| 122 | 
            -
                  next_steps = <<~NEXT_STEPS
         | 
| 123 | 
            -
                    Your next steps might be:
         | 
| 124 | 
            -
             | 
| 125 | 
            -
                    1) Run `bin/packwerk update-deprecations` to update the violations. Make sure to run `spring stop` if you've added new load paths (new top-level directories) in your pack.
         | 
| 126 | 
            -
             | 
| 127 | 
            -
                    2) Update TODO lists for rubocop implemented protections. See #{UsePackwerk.config.documentation_link} for more info
         | 
| 128 | 
            -
             | 
| 129 | 
            -
                    3) Work to migrate clients of private API to your new public API
         | 
| 130 | 
            -
             | 
| 131 | 
            -
                    4) Update your README at packs/your_package_name/README.md
         | 
| 132 | 
            -
                  NEXT_STEPS
         | 
| 133 100 |  | 
| 101 | 
            +
                Logging.section('Next steps') do
         | 
| 102 | 
            +
                  next_steps = UsePackwerk.config.user_event_logger.after_make_public
         | 
| 134 103 | 
             
                  Logging.print_bold_green(next_steps)
         | 
| 135 104 | 
             
                end
         | 
| 136 105 | 
             
              end
         | 
| @@ -146,9 +115,7 @@ module UsePackwerk | |
| 146 115 | 
             
                dependency_name:
         | 
| 147 116 | 
             
              )
         | 
| 148 117 | 
             
                Logging.section('Adding a dependency') do
         | 
| 149 | 
            -
                  intro =  | 
| 150 | 
            -
                    You are adding a dependency. See #{UsePackwerk.config.documentation_link} for other utilities!
         | 
| 151 | 
            -
                  INTRO
         | 
| 118 | 
            +
                  intro = UsePackwerk.config.user_event_logger.before_add_dependency(pack_name)
         | 
| 152 119 | 
             
                  Logging.print_bold_green(intro)
         | 
| 153 120 | 
             
                end
         | 
| 154 121 |  | 
| @@ -158,14 +125,7 @@ module UsePackwerk | |
| 158 125 | 
             
                )
         | 
| 159 126 |  | 
| 160 127 | 
             
                Logging.section('Next steps') do
         | 
| 161 | 
            -
                  next_steps =  | 
| 162 | 
            -
                    Your next steps might be:
         | 
| 163 | 
            -
             | 
| 164 | 
            -
                    1) Run `bin/packwerk validate` to ensure you haven't introduced a cyclic dependency
         | 
| 165 | 
            -
             | 
| 166 | 
            -
                    2) Run `bin/packwerk update-deprecations` to update the violations.
         | 
| 167 | 
            -
                  NEXT_STEPS
         | 
| 168 | 
            -
             | 
| 128 | 
            +
                  next_steps = UsePackwerk.config.user_event_logger.after_add_dependency(pack_name)
         | 
| 169 129 | 
             
                  Logging.print_bold_green(next_steps)
         | 
| 170 130 | 
             
                end
         | 
| 171 131 | 
             
              end
         | 
| @@ -174,7 +134,7 @@ module UsePackwerk | |
| 174 134 | 
             
                params(
         | 
| 175 135 | 
             
                  pack_name: String,
         | 
| 176 136 | 
             
                  parent_name: String,
         | 
| 177 | 
            -
                  per_file_processors: T::Array[PerFileProcessorInterface] | 
| 137 | 
            +
                  per_file_processors: T::Array[PerFileProcessorInterface]
         | 
| 178 138 | 
             
                ).void
         | 
| 179 139 | 
             
              end
         | 
| 180 140 | 
             
              def self.move_to_parent!(
         | 
| @@ -183,29 +143,18 @@ module UsePackwerk | |
| 183 143 | 
             
                per_file_processors: []
         | 
| 184 144 | 
             
              )
         | 
| 185 145 | 
             
                Logging.section('👋 Hi!') do
         | 
| 186 | 
            -
                  intro =  | 
| 187 | 
            -
                    You are moving one pack to be a child of a different pack. Check out #{UsePackwerk.config.documentation_link} for more info!
         | 
| 188 | 
            -
             | 
| 189 | 
            -
                    Please bring any questions or issues you have in your development process to #ruby-modularity or #product-infrastructure.
         | 
| 190 | 
            -
                    We'd be happy to try to help through pairing, accepting feedback, changing our process, changing our tools, and more.
         | 
| 191 | 
            -
                  INTRO
         | 
| 146 | 
            +
                  intro = UsePackwerk.config.user_event_logger.before_move_to_parent(pack_name)
         | 
| 192 147 | 
             
                  Logging.print_bold_green(intro)
         | 
| 193 148 | 
             
                end
         | 
| 194 149 |  | 
| 195 150 | 
             
                Private.move_to_parent!(
         | 
| 196 151 | 
             
                  pack_name: pack_name,
         | 
| 197 152 | 
             
                  parent_name: parent_name,
         | 
| 198 | 
            -
                  per_file_processors: per_file_processors | 
| 153 | 
            +
                  per_file_processors: per_file_processors
         | 
| 199 154 | 
             
                )
         | 
| 200 155 |  | 
| 201 156 | 
             
                Logging.section('Next steps') do
         | 
| 202 | 
            -
                  next_steps =  | 
| 203 | 
            -
                    Your next steps might be:
         | 
| 204 | 
            -
             | 
| 205 | 
            -
                    1) Delete the old pack when things look good: `rm -rf #{pack_name}`
         | 
| 206 | 
            -
             | 
| 207 | 
            -
                    2) Run `bin/packwerk update-deprecations` to update the violations. Make sure to run `spring stop` first.
         | 
| 208 | 
            -
                  NEXT_STEPS
         | 
| 157 | 
            +
                  next_steps = UsePackwerk.config.user_event_logger.after_move_to_parent(pack_name)
         | 
| 209 158 |  | 
| 210 159 | 
             
                  Logging.print_bold_green(next_steps)
         | 
| 211 160 | 
             
                end
         | 
| @@ -214,7 +163,7 @@ module UsePackwerk | |
| 214 163 | 
             
              sig do
         | 
| 215 164 | 
             
                params(
         | 
| 216 165 | 
             
                  pack_name: T.nilable(String),
         | 
| 217 | 
            -
                  limit: Integer | 
| 166 | 
            +
                  limit: Integer
         | 
| 218 167 | 
             
                ).void
         | 
| 219 168 | 
             
              end
         | 
| 220 169 | 
             
              def self.list_top_privacy_violations(
         | 
| @@ -247,14 +196,19 @@ module UsePackwerk | |
| 247 196 | 
             
                params(
         | 
| 248 197 | 
             
                  file: String,
         | 
| 249 198 | 
             
                  find: Pathname,
         | 
| 250 | 
            -
                  replace_with: Pathname | 
| 199 | 
            +
                  replace_with: Pathname
         | 
| 251 200 | 
             
                ).void
         | 
| 252 201 | 
             
              end
         | 
| 253 202 | 
             
              def self.replace_in_file(file:, find:, replace_with:)
         | 
| 254 203 | 
             
                Private.replace_in_file(
         | 
| 255 204 | 
             
                  file: file,
         | 
| 256 205 | 
             
                  find: find,
         | 
| 257 | 
            -
                  replace_with: replace_with | 
| 206 | 
            +
                  replace_with: replace_with
         | 
| 258 207 | 
             
                )
         | 
| 259 208 | 
             
              end
         | 
| 209 | 
            +
             | 
| 210 | 
            +
              sig { void }
         | 
| 211 | 
            +
              def self.bust_cache!
         | 
| 212 | 
            +
                Private.bust_cache!
         | 
| 213 | 
            +
              end
         | 
| 260 214 | 
             
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,17 +1,17 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: use_packwerk
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0. | 
| 4 | 
            +
              version: 0.56.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Gusto Engineers
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2022- | 
| 11 | 
            +
            date: 2022-09-29 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 | 
            -
              name:  | 
| 14 | 
            +
              name: code_ownership
         | 
| 15 15 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 16 16 | 
             
                requirements:
         | 
| 17 17 | 
             
                - - ">="
         | 
| @@ -25,7 +25,7 @@ dependencies: | |
| 25 25 | 
             
                  - !ruby/object:Gem::Version
         | 
| 26 26 | 
             
                    version: '0'
         | 
| 27 27 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 28 | 
            -
              name:  | 
| 28 | 
            +
              name: colorize
         | 
| 29 29 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 30 30 | 
             
                requirements:
         | 
| 31 31 | 
             
                - - ">="
         | 
| @@ -39,7 +39,7 @@ dependencies: | |
| 39 39 | 
             
                  - !ruby/object:Gem::Version
         | 
| 40 40 | 
             
                    version: '0'
         | 
| 41 41 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 42 | 
            -
              name:  | 
| 42 | 
            +
              name: package_protections
         | 
| 43 43 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 44 44 | 
             
                requirements:
         | 
| 45 45 | 
             
                - - ">="
         | 
| @@ -53,7 +53,7 @@ dependencies: | |
| 53 53 | 
             
                  - !ruby/object:Gem::Version
         | 
| 54 54 | 
             
                    version: '0'
         | 
| 55 55 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 56 | 
            -
              name:  | 
| 56 | 
            +
              name: parse_packwerk
         | 
| 57 57 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 58 58 | 
             
                requirements:
         | 
| 59 59 | 
             
                - - ">="
         | 
| @@ -67,7 +67,7 @@ dependencies: | |
| 67 67 | 
             
                  - !ruby/object:Gem::Version
         | 
| 68 68 | 
             
                    version: '0'
         | 
| 69 69 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 70 | 
            -
              name:  | 
| 70 | 
            +
              name: sorbet-runtime
         | 
| 71 71 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 72 72 | 
             
                requirements:
         | 
| 73 73 | 
             
                - - ">="
         | 
| @@ -95,7 +95,21 @@ dependencies: | |
| 95 95 | 
             
                  - !ruby/object:Gem::Version
         | 
| 96 96 | 
             
                    version: '0'
         | 
| 97 97 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 98 | 
            -
              name:  | 
| 98 | 
            +
              name: bundler
         | 
| 99 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 100 | 
            +
                requirements:
         | 
| 101 | 
            +
                - - "~>"
         | 
| 102 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 103 | 
            +
                    version: '2.2'
         | 
| 104 | 
            +
              type: :development
         | 
| 105 | 
            +
              prerelease: false
         | 
| 106 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 107 | 
            +
                requirements:
         | 
| 108 | 
            +
                - - "~>"
         | 
| 109 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 110 | 
            +
                    version: '2.2'
         | 
| 111 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 112 | 
            +
              name: pry
         | 
| 99 113 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 100 114 | 
             
                requirements:
         | 
| 101 115 | 
             
                - - ">="
         | 
| @@ -109,21 +123,21 @@ dependencies: | |
| 109 123 | 
             
                  - !ruby/object:Gem::Version
         | 
| 110 124 | 
             
                    version: '0'
         | 
| 111 125 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 112 | 
            -
              name:  | 
| 126 | 
            +
              name: pry-byebug
         | 
| 113 127 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 114 128 | 
             
                requirements:
         | 
| 115 | 
            -
                - - " | 
| 129 | 
            +
                - - ">="
         | 
| 116 130 | 
             
                  - !ruby/object:Gem::Version
         | 
| 117 | 
            -
                    version: ' | 
| 131 | 
            +
                    version: '0'
         | 
| 118 132 | 
             
              type: :development
         | 
| 119 133 | 
             
              prerelease: false
         | 
| 120 134 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 121 135 | 
             
                requirements:
         | 
| 122 | 
            -
                - - " | 
| 136 | 
            +
                - - ">="
         | 
| 123 137 | 
             
                  - !ruby/object:Gem::Version
         | 
| 124 | 
            -
                    version: ' | 
| 138 | 
            +
                    version: '0'
         | 
| 125 139 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 126 | 
            -
              name:  | 
| 140 | 
            +
              name: rake
         | 
| 127 141 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 128 142 | 
             
                requirements:
         | 
| 129 143 | 
             
                - - ">="
         | 
| @@ -151,7 +165,7 @@ dependencies: | |
| 151 165 | 
             
                  - !ruby/object:Gem::Version
         | 
| 152 166 | 
             
                    version: '3.0'
         | 
| 153 167 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 154 | 
            -
              name:  | 
| 168 | 
            +
              name: rubocop
         | 
| 155 169 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 156 170 | 
             
                requirements:
         | 
| 157 171 | 
             
                - - ">="
         | 
| @@ -165,7 +179,7 @@ dependencies: | |
| 165 179 | 
             
                  - !ruby/object:Gem::Version
         | 
| 166 180 | 
             
                    version: '0'
         | 
| 167 181 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 168 | 
            -
              name:  | 
| 182 | 
            +
              name: rubocop-rspec
         | 
| 169 183 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 170 184 | 
             
                requirements:
         | 
| 171 185 | 
             
                - - ">="
         | 
| @@ -179,7 +193,7 @@ dependencies: | |
| 179 193 | 
             
                  - !ruby/object:Gem::Version
         | 
| 180 194 | 
             
                    version: '0'
         | 
| 181 195 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 182 | 
            -
              name:  | 
| 196 | 
            +
              name: sorbet
         | 
| 183 197 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 184 198 | 
             
                requirements:
         | 
| 185 199 | 
             
                - - ">="
         | 
| @@ -193,7 +207,21 @@ dependencies: | |
| 193 207 | 
             
                  - !ruby/object:Gem::Version
         | 
| 194 208 | 
             
                    version: '0'
         | 
| 195 209 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 196 | 
            -
              name:  | 
| 210 | 
            +
              name: sorbet-static
         | 
| 211 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 212 | 
            +
                requirements:
         | 
| 213 | 
            +
                - - ">="
         | 
| 214 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 215 | 
            +
                    version: '0'
         | 
| 216 | 
            +
              type: :development
         | 
| 217 | 
            +
              prerelease: false
         | 
| 218 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 219 | 
            +
                requirements:
         | 
| 220 | 
            +
                - - ">="
         | 
| 221 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 222 | 
            +
                    version: '0'
         | 
| 223 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 224 | 
            +
              name: tapioca
         | 
| 197 225 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 198 226 | 
             
                requirements:
         | 
| 199 227 | 
             
                - - ">="
         | 
| @@ -221,12 +249,14 @@ files: | |
| 221 249 | 
             
            - lib/use_packwerk/cli.rb
         | 
| 222 250 | 
             
            - lib/use_packwerk/code_ownership_post_processor.rb
         | 
| 223 251 | 
             
            - lib/use_packwerk/configuration.rb
         | 
| 252 | 
            +
            - lib/use_packwerk/default_user_event_logger.rb
         | 
| 224 253 | 
             
            - lib/use_packwerk/logging.rb
         | 
| 225 254 | 
             
            - lib/use_packwerk/per_file_processor_interface.rb
         | 
| 226 255 | 
             
            - lib/use_packwerk/private.rb
         | 
| 227 256 | 
             
            - lib/use_packwerk/private/file_move_operation.rb
         | 
| 228 257 | 
             
            - lib/use_packwerk/private/pack_relationship_analyzer.rb
         | 
| 229 258 | 
             
            - lib/use_packwerk/rubocop_post_processor.rb
         | 
| 259 | 
            +
            - lib/use_packwerk/user_event_logger.rb
         | 
| 230 260 | 
             
            homepage: https://github.com/rubyatscale/use_packwerk
         | 
| 231 261 | 
             
            licenses:
         | 
| 232 262 | 
             
            - MIT
         | 
| @@ -243,7 +273,7 @@ required_ruby_version: !ruby/object:Gem::Requirement | |
| 243 273 | 
             
              requirements:
         | 
| 244 274 | 
             
              - - ">="
         | 
| 245 275 | 
             
                - !ruby/object:Gem::Version
         | 
| 246 | 
            -
                  version:  | 
| 276 | 
            +
                  version: 2.6.0
         | 
| 247 277 | 
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 248 278 | 
             
              requirements:
         | 
| 249 279 | 
             
              - - ">="
         |