contextizer 0.1.1

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: f686acf8deb4c945333560100cca7bc0132461edb87a7e5b75746e9aff9482b1
4
+ data.tar.gz: 95d945436b9f4756fc85fef28c6400b73e22a5f754366c3aefadb7fe13fc76b7
5
+ SHA512:
6
+ metadata.gz: bbb33df56969a8803c1baa62a49525fd8a90399d7a962078c717f40ce2fcf72b055effcf2a4bd959bc11ca01d1641db15b86d460bf0dc7098b64b82656c556a3
7
+ data.tar.gz: f9ed53fbb18f9a819e4b7f3b5b05027b28c676f6df711f1106f3193e0bad2e8fea7a45f2a570e168fad3137a9ed4e36a4133ca85aa8276812e1162041f9c102e
data/.rubocop.yml ADDED
@@ -0,0 +1,8 @@
1
+ AllCops:
2
+ TargetRubyVersion: 3.1
3
+
4
+ Style/StringLiterals:
5
+ EnforcedStyle: double_quotes
6
+
7
+ Style/StringLiteralsInInterpolation:
8
+ EnforcedStyle: double_quotes
data/CHANGELOG.md ADDED
@@ -0,0 +1,9 @@
1
+ # CHANGELOG.md
2
+
3
+ ## 0.1.0 (September 01, 2025)
4
+
5
+ * Initial public release.
6
+ * Core functionality: context extraction for local and remote Git repositories.
7
+ * Automatic stack analysis for Ruby and JavaScript projects.
8
+ * Flexible configuration via `.contextizer.yml`.
9
+ * Markdown report generation with file tree and metadata.
@@ -0,0 +1,132 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our
6
+ community a harassment-free experience for everyone, regardless of age, body
7
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
8
+ identity and expression, level of experience, education, socio-economic status,
9
+ nationality, personal appearance, race, caste, color, religion, or sexual
10
+ identity and orientation.
11
+
12
+ We pledge to act and interact in ways that contribute to an open, welcoming,
13
+ diverse, inclusive, and healthy community.
14
+
15
+ ## Our Standards
16
+
17
+ Examples of behavior that contributes to a positive environment for our
18
+ community include:
19
+
20
+ * Demonstrating empathy and kindness toward other people
21
+ * Being respectful of differing opinions, viewpoints, and experiences
22
+ * Giving and gracefully accepting constructive feedback
23
+ * Accepting responsibility and apologizing to those affected by our mistakes,
24
+ and learning from the experience
25
+ * Focusing on what is best not just for us as individuals, but for the overall
26
+ community
27
+
28
+ Examples of unacceptable behavior include:
29
+
30
+ * The use of sexualized language or imagery, and sexual attention or advances of
31
+ any kind
32
+ * Trolling, insulting or derogatory comments, and personal or political attacks
33
+ * Public or private harassment
34
+ * Publishing others' private information, such as a physical or email address,
35
+ without their explicit permission
36
+ * Other conduct which could reasonably be considered inappropriate in a
37
+ professional setting
38
+
39
+ ## Enforcement Responsibilities
40
+
41
+ Community leaders are responsible for clarifying and enforcing our standards of
42
+ acceptable behavior and will take appropriate and fair corrective action in
43
+ response to any behavior that they deem inappropriate, threatening, offensive,
44
+ or harmful.
45
+
46
+ Community leaders have the right and responsibility to remove, edit, or reject
47
+ comments, commits, code, wiki edits, issues, and other contributions that are
48
+ not aligned to this Code of Conduct, and will communicate reasons for moderation
49
+ decisions when appropriate.
50
+
51
+ ## Scope
52
+
53
+ This Code of Conduct applies within all community spaces, and also applies when
54
+ an individual is officially representing the community in public spaces.
55
+ Examples of representing our community include using an official email address,
56
+ posting via an official social media account, or acting as an appointed
57
+ representative at an online or offline event.
58
+
59
+ ## Enforcement
60
+
61
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
62
+ reported to the community leaders responsible for enforcement at
63
+ [INSERT CONTACT METHOD].
64
+ All complaints will be reviewed and investigated promptly and fairly.
65
+
66
+ All community leaders are obligated to respect the privacy and security of the
67
+ reporter of any incident.
68
+
69
+ ## Enforcement Guidelines
70
+
71
+ Community leaders will follow these Community Impact Guidelines in determining
72
+ the consequences for any action they deem in violation of this Code of Conduct:
73
+
74
+ ### 1. Correction
75
+
76
+ **Community Impact**: Use of inappropriate language or other behavior deemed
77
+ unprofessional or unwelcome in the community.
78
+
79
+ **Consequence**: A private, written warning from community leaders, providing
80
+ clarity around the nature of the violation and an explanation of why the
81
+ behavior was inappropriate. A public apology may be requested.
82
+
83
+ ### 2. Warning
84
+
85
+ **Community Impact**: A violation through a single incident or series of
86
+ actions.
87
+
88
+ **Consequence**: A warning with consequences for continued behavior. No
89
+ interaction with the people involved, including unsolicited interaction with
90
+ those enforcing the Code of Conduct, for a specified period of time. This
91
+ includes avoiding interactions in community spaces as well as external channels
92
+ like social media. Violating these terms may lead to a temporary or permanent
93
+ ban.
94
+
95
+ ### 3. Temporary Ban
96
+
97
+ **Community Impact**: A serious violation of community standards, including
98
+ sustained inappropriate behavior.
99
+
100
+ **Consequence**: A temporary ban from any sort of interaction or public
101
+ communication with the community for a specified period of time. No public or
102
+ private interaction with the people involved, including unsolicited interaction
103
+ with those enforcing the Code of Conduct, is allowed during this period.
104
+ Violating these terms may lead to a permanent ban.
105
+
106
+ ### 4. Permanent Ban
107
+
108
+ **Community Impact**: Demonstrating a pattern of violation of community
109
+ standards, including sustained inappropriate behavior, harassment of an
110
+ individual, or aggression toward or disparagement of classes of individuals.
111
+
112
+ **Consequence**: A permanent ban from any sort of public interaction within the
113
+ community.
114
+
115
+ ## Attribution
116
+
117
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118
+ version 2.1, available at
119
+ [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
120
+
121
+ Community Impact Guidelines were inspired by
122
+ [Mozilla's code of conduct enforcement ladder][Mozilla CoC].
123
+
124
+ For answers to common questions about this code of conduct, see the FAQ at
125
+ [https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
126
+ [https://www.contributor-covenant.org/translations][translations].
127
+
128
+ [homepage]: https://www.contributor-covenant.org
129
+ [v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
130
+ [Mozilla CoC]: https://github.com/mozilla/diversity
131
+ [FAQ]: https://www.contributor-covenant.org/faq
132
+ [translations]: https://www.contributor-covenant.org/translations
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2025 Alexander
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,153 @@
1
+ # Contextizer
2
+
3
+ **Contextizer** is a versatile command-line tool for extracting, analyzing, and packaging the context of any software project. It scans a codebase, gathers key metadata (language, framework, dependencies, git status), and aggregates the source code into a single, easy-to-digest Markdown report.
4
+
5
+ It's the perfect tool for:
6
+ - Preparing context for analysis by Large Language Models (LLMs).
7
+ - Quickly onboarding a new developer to a project.
8
+ - Archiving a project snapshot for a code review.
9
+ - Creating comprehensive bug reports.
10
+
11
+
12
+ ## Key Features
13
+
14
+ * **Polyglot by Design:** Automatically detects a project's primary language and framework (Ruby/Rails, JavaScript, etc.) using a smart "signals and weights" system.
15
+ * **Plug-and-Play Architecture:** Easily extendable to support new languages and frameworks by adding new "Analyzers" and "Providers".
16
+ * **Rich Metadata Collection:** Extracts Git information (branch, commit), key dependencies (`Gemfile`, `package.json`), and the project's structure.
17
+ * **Remote Repository Analysis:** Can clone and analyze any public Git repository directly from a URL, no manual cloning required.
18
+ * **Flexible Configuration:** Controlled via a simple YAML file (`.contextizer.yml`) in your project's root, allowing you to fine-tune the data collection process.
19
+ * **Clean & Readable Reports:** Generates a single Markdown file with a visual file tree, project metadata, and syntax-highlighted source code.
20
+
21
+
22
+ ## Installation
23
+
24
+ ### Standalone (Recommended)
25
+
26
+ Install the gem globally to use it in any project on your system:
27
+
28
+ ```bash
29
+ gem install contextizer
30
+ ```
31
+
32
+ ### As a Project Dependency (Bundler)
33
+
34
+ Add it to your project's `Gemfile` within the `:development` group:
35
+
36
+ ```ruby
37
+ # Gemfile
38
+ group :development do
39
+ gem 'contextizer'
40
+ end
41
+ ```
42
+
43
+ Then, execute:
44
+
45
+ ```bash
46
+ bundle install
47
+ ```
48
+
49
+ ## Usage
50
+
51
+ ### Analyzing a Local Project
52
+
53
+ Navigate to your project's root directory and run:
54
+
55
+ ```bash
56
+ contextizer extract
57
+ ```
58
+
59
+ The report will be saved in the current directory by default.
60
+
61
+ ### Analyzing a Remote Git Repository
62
+
63
+ Use the `--git-url` option to analyze any public repository:
64
+
65
+ ```bash
66
+ contextizer extract --git-url https://github.com/rails/rails
67
+ ```
68
+
69
+ ### Common Options
70
+
71
+ - `[TARGET_PATH]`: (Optional) The path to the directory to analyze. Defaults to the current directory.
72
+ - `--git-url URL`: The URL of a remote Git repository to analyze.
73
+ - `-o, --output PATH`: The destination path for the final report file.
74
+ - `-f, --format FORMAT`: The output format (currently supports `markdown`).
75
+
76
+ ## Configuration
77
+
78
+ To customize Contextizer for your project, create a `.contextizer.yml` file in its root directory.
79
+
80
+ The tool uses a three-tiered configuration system with the following priority:
81
+
82
+ CLI Options > .contextizer.yml > Gem Defaults
83
+
84
+ ### Example `.contextizer.yml`
85
+
86
+ YAML
87
+
88
+ ```yml
89
+ # .contextizer.yml
90
+
91
+ # Path to save the report.
92
+ # Available placeholders: {project_name}, {timestamp}
93
+ output: "docs/context/{project_name}_{timestamp}.md"
94
+
95
+ # Settings for specific providers
96
+ settings:
97
+ # Settings for the Ruby gems provider
98
+ gems:
99
+ key_gems: # List your project's most important gems here
100
+ - rails
101
+ - devise
102
+ - sidekiq
103
+ - rspec-rails
104
+ - pg
105
+ - pundit
106
+
107
+ # Settings for the filesystem provider
108
+ filesystem:
109
+ # Specify which files and directories to include in the report
110
+ components:
111
+ models: "app/models/**/*.rb"
112
+ controllers: "app/controllers/**/*.rb"
113
+ services: "app/services/**/*.rb"
114
+ javascript: "app/javascript/**/*.js"
115
+ config:
116
+ - "config/routes.rb"
117
+ - "config/application.rb"
118
+ documentation:
119
+ - "README.md"
120
+ - "CONTRIBUTING.md"
121
+
122
+ # Global exclusion patterns
123
+ exclude:
124
+ - "tmp/**/*"
125
+ - "log/**/*"
126
+ - "node_modules/**/*"
127
+ - ".git/**/*"
128
+ - "vendor/**/*"
129
+ ```
130
+
131
+ ## Extensibility (Adding a New Language)
132
+
133
+ Thanks to the plug-and-play architecture, adding support for a new language is straightforward:
134
+
135
+ 1. **Create a Specialist Analyzer**: Add a new file in `lib/contextizer/analyzers/` that detects the language based on its characteristic files and directories.
136
+ 2. **Create Providers**: Add a new directory in `lib/contextizer/providers/` with providers that extract language-specific information (e.g., dependencies from a `pom.xml` file for Java).
137
+
138
+ The main `Analyzer` and `Collector` will automatically discover and use your new components.
139
+
140
+ ## Contributing
141
+
142
+ 1. Fork the repository.
143
+ 2. Create your feature branch (`git checkout -b my-new-feature`).
144
+ 3. Commit your changes (`git commit -am 'Add some feature'`).
145
+ 4. Push to the branch (`git push origin my-new-feature`).
146
+ 5. Create a new Pull Request.
147
+
148
+
149
+ ---
150
+
151
+ ## License
152
+
153
+ This project is released under the MIT License.
data/Rakefile ADDED
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rubocop/rake_task"
5
+ require_relative "lib/contextizer/version"
6
+
7
+ RuboCop::RakeTask.new
8
+
9
+ task default: :rubocop
@@ -0,0 +1,53 @@
1
+ # config/default.yml
2
+ # Gem's default configuration. DO NOT EDIT.
3
+ # Create a .contextizer.yml in your project to override.
4
+
5
+ # Default output path.
6
+ # Placeholders: {profile}, {timestamp}, {project_name}
7
+ #output: "tmp/contextizer/{profile}_{timestamp}.md"
8
+ output: "{project_name}_{timestamp}.md"
9
+
10
+ # Default rendering format.
11
+ format: "markdown"
12
+
13
+ # Provider settings.
14
+ providers:
15
+ git: true
16
+ filesystem: true
17
+ gems: true
18
+ project_info: true
19
+ # Framework-specific providers are disabled by default.
20
+ # They will be auto-enabled if the environment is detected.
21
+ rails_routes: "auto"
22
+ rails_schema: "auto"
23
+
24
+ # Settings for specific providers.
25
+ settings:
26
+ gems:
27
+ key_gems:
28
+ - rails
29
+ - devise
30
+ - sidekiq
31
+ - rspec-rails
32
+ - pg
33
+ filesystem:
34
+ # Default component definitions for a typical Ruby/Rails project.
35
+ components:
36
+ models: "app/models/**/*.rb"
37
+ views: "app/views/**/*.{erb,haml,slim,arb}"
38
+ controllers: "app/controllers/**/*.rb"
39
+ services: "app/services/**/*.rb"
40
+ lib: "lib/**/*.rb"
41
+ config: "config/**/*.{rb,yml}"
42
+ gem: # For gem development
43
+ - "*.gemspec"
44
+ - "lib/**/*.rb"
45
+ - "README.md"
46
+ - "CHANGELOG.md"
47
+ documentation: "*.md"
48
+ # Files/directories to exclude globally.
49
+ exclude:
50
+ - "tmp/**/*"
51
+ - "log/**/*"
52
+ - "node_modules/**/*"
53
+ - ".git/**/*"