shipguard-ai 0.1.1__tar.gz

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.
Files changed (40) hide show
  1. shipguard_ai-0.1.1/.env.example +4 -0
  2. shipguard_ai-0.1.1/.github/ISSUE_TEMPLATE/bug_report.md +45 -0
  3. shipguard_ai-0.1.1/.github/ISSUE_TEMPLATE/feature_request.md +33 -0
  4. shipguard_ai-0.1.1/.github/pull_request_template.md +36 -0
  5. shipguard_ai-0.1.1/.github/workflows/ci.yml +48 -0
  6. shipguard_ai-0.1.1/.github/workflows/publish-pypi.yml +55 -0
  7. shipguard_ai-0.1.1/.github/workflows/shipguard.yml +59 -0
  8. shipguard_ai-0.1.1/.gitignore +225 -0
  9. shipguard_ai-0.1.1/CHANGELOG.md +40 -0
  10. shipguard_ai-0.1.1/CODE_OF_CONDUCT.md +58 -0
  11. shipguard_ai-0.1.1/CONTRIBUTING.md +111 -0
  12. shipguard_ai-0.1.1/LICENSE +21 -0
  13. shipguard_ai-0.1.1/MAINTAINER_BACKLOG.md +342 -0
  14. shipguard_ai-0.1.1/PKG-INFO +595 -0
  15. shipguard_ai-0.1.1/README.md +568 -0
  16. shipguard_ai-0.1.1/ROADMAP.md +64 -0
  17. shipguard_ai-0.1.1/SECURITY.md +49 -0
  18. shipguard_ai-0.1.1/action.yml +194 -0
  19. shipguard_ai-0.1.1/docs/github-action-design.md +323 -0
  20. shipguard_ai-0.1.1/docs/github-action-usage.md +245 -0
  21. shipguard_ai-0.1.1/docs/pypi-release.md +103 -0
  22. shipguard_ai-0.1.1/pyproject.toml +50 -0
  23. shipguard_ai-0.1.1/scripts/create_demo_repo.py +493 -0
  24. shipguard_ai-0.1.1/shipguard/__main__.py +5 -0
  25. shipguard_ai-0.1.1/shipguard/cli.py +391 -0
  26. shipguard_ai-0.1.1/shipguard/context_builder.py +1158 -0
  27. shipguard_ai-0.1.1/shipguard/env_loader.py +59 -0
  28. shipguard_ai-0.1.1/shipguard/git_analyzer.py +136 -0
  29. shipguard_ai-0.1.1/shipguard/github_client.py +737 -0
  30. shipguard_ai-0.1.1/shipguard/llm_client.py +156 -0
  31. shipguard_ai-0.1.1/shipguard/models.py +189 -0
  32. shipguard_ai-0.1.1/shipguard/pr_commenter.py +791 -0
  33. shipguard_ai-0.1.1/shipguard/pr_url_parser.py +39 -0
  34. shipguard_ai-0.1.1/shipguard/project_memory.py +173 -0
  35. shipguard_ai-0.1.1/shipguard/report_generator.py +794 -0
  36. shipguard_ai-0.1.1/tests/__init__.py +1 -0
  37. shipguard_ai-0.1.1/tests/test_context_builder.py +285 -0
  38. shipguard_ai-0.1.1/tests/test_env_loader.py +86 -0
  39. shipguard_ai-0.1.1/tests/test_pr_commenter.py +319 -0
  40. shipguard_ai-0.1.1/tests/test_report_generator.py +119 -0
@@ -0,0 +1,4 @@
1
+ SHIPGUARD_LLM_BASE_URL=
2
+ SHIPGUARD_LLM_API_KEY=
3
+ SHIPGUARD_LLM_MODEL=
4
+ SHIPGUARD_GITHUB_TOKEN=
@@ -0,0 +1,45 @@
1
+ ---
2
+ name: Bug report
3
+ about: Report a reproducible problem in ShipGuard
4
+ title: "[Bug] "
5
+ labels: ""
6
+ assignees: ""
7
+ ---
8
+
9
+ ## Summary
10
+
11
+ Describe the problem and its impact.
12
+
13
+ ## Environment
14
+
15
+ - ShipGuard version or commit:
16
+ - Python version:
17
+ - Operating system:
18
+ - Command used:
19
+ - Analysis type: local diff / GitHub PR
20
+
21
+ ## Steps to reproduce
22
+
23
+ 1.
24
+ 2.
25
+ 3.
26
+
27
+ ## Expected behavior
28
+
29
+ What did you expect to happen?
30
+
31
+ ## Actual behavior
32
+
33
+ What happened instead?
34
+
35
+ ## Logs or sample input
36
+
37
+ Provide the smallest sanitized example that reproduces the issue.
38
+
39
+ Do not include API keys, tokens, private repository content, private URLs, or
40
+ other sensitive data.
41
+
42
+ ## Additional context
43
+
44
+ Include any relevant diff size, file type, model endpoint behavior, or
45
+ workaround.
@@ -0,0 +1,33 @@
1
+ ---
2
+ name: Feature request
3
+ about: Propose an improvement to ShipGuard
4
+ title: "[Feature] "
5
+ labels: ""
6
+ assignees: ""
7
+ ---
8
+
9
+ ## Maintainer problem
10
+
11
+ What release-review or pull request workflow problem should ShipGuard solve?
12
+
13
+ ## Proposed outcome
14
+
15
+ Describe the behavior or result you would like.
16
+
17
+ ## Example
18
+
19
+ Provide a sanitized, synthetic example of the input and expected output when
20
+ possible.
21
+
22
+ ## Alternatives considered
23
+
24
+ How is this handled today, and what other approaches did you consider?
25
+
26
+ ## Scope and risks
27
+
28
+ Does the proposal affect prompts, risk scoring, report schemas, GitHub
29
+ permissions, comments, privacy, or compatibility?
30
+
31
+ ## Contribution
32
+
33
+ Are you interested in implementing or testing this change?
@@ -0,0 +1,36 @@
1
+ ## Summary
2
+
3
+ Describe the change and the maintainer or user problem it addresses.
4
+
5
+ ## Changes
6
+
7
+ - Describe the main changes here.
8
+
9
+ ## Verification
10
+
11
+ List the commands run and relevant results.
12
+
13
+ ```text
14
+ python -m unittest discover -s tests
15
+ python -m compileall shipguard scripts tests
16
+ ```
17
+
18
+ ## Release-risk review
19
+
20
+ - [ ] No public API, output schema, or CLI behavior changes.
21
+ - [ ] No database or state migration is required.
22
+ - [ ] No new environment variables, permissions, or secrets are required.
23
+ - [ ] No dependency or model-provider behavior changes.
24
+ - [ ] Tests cover the changed behavior.
25
+ - [ ] Rollback is straightforward or explained below.
26
+
27
+ Explain any unchecked item:
28
+
29
+ ## Contributor checklist
30
+
31
+ - [ ] I kept this pull request focused.
32
+ - [ ] I added or updated tests where behavior changed.
33
+ - [ ] I updated documentation for command, configuration, or output changes.
34
+ - [ ] I added a user-visible change to `CHANGELOG.md` when applicable.
35
+ - [ ] I removed secrets, private repository data, and sensitive logs.
36
+ - [ ] I have read and followed `CONTRIBUTING.md` and the Code of Conduct.
@@ -0,0 +1,48 @@
1
+ name: CI
2
+
3
+ on:
4
+ pull_request:
5
+ push:
6
+ branches:
7
+ - main
8
+
9
+ permissions:
10
+ contents: read
11
+
12
+ jobs:
13
+ validation:
14
+ runs-on: ubuntu-latest
15
+ strategy:
16
+ fail-fast: false
17
+ matrix:
18
+ python-version:
19
+ - "3.11"
20
+ - "3.12"
21
+
22
+ steps:
23
+ - name: Check out repository
24
+ uses: actions/checkout@v4
25
+
26
+ - name: Set up Python
27
+ uses: actions/setup-python@v5
28
+ with:
29
+ python-version: ${{ matrix.python-version }}
30
+
31
+ - name: Upgrade pip
32
+ run: python -m pip install --upgrade pip
33
+
34
+ - name: Install ShipGuard
35
+ run: python -m pip install -e .
36
+
37
+ - name: Run unit tests
38
+ run: python -m unittest discover -s tests
39
+
40
+ - name: Compile Python sources
41
+ run: python -m compileall shipguard scripts tests
42
+
43
+ - name: Check CLI help
44
+ run: |
45
+ python -m shipguard --help
46
+ python -m shipguard analyze --help
47
+ python -m shipguard analyze-pr --help
48
+ python -m shipguard clear-comments --help
@@ -0,0 +1,55 @@
1
+ name: Publish Python Package
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+ workflow_dispatch:
7
+
8
+ permissions:
9
+ contents: read
10
+
11
+ jobs:
12
+ build:
13
+ runs-on: ubuntu-latest
14
+ steps:
15
+ - name: Check out repository
16
+ uses: actions/checkout@v4
17
+
18
+ - name: Set up Python
19
+ uses: actions/setup-python@v5
20
+ with:
21
+ python-version: "3.11"
22
+
23
+ - name: Install build tools
24
+ run: python -m pip install build twine
25
+
26
+ - name: Build package distributions
27
+ run: python -m build
28
+
29
+ - name: Check package metadata
30
+ run: python -m twine check dist/*
31
+
32
+ - name: Upload package distributions
33
+ uses: actions/upload-artifact@v4
34
+ with:
35
+ name: python-package-distributions
36
+ path: dist/
37
+
38
+ publish:
39
+ needs: build
40
+ runs-on: ubuntu-latest
41
+ environment: pypi
42
+ permissions:
43
+ contents: read
44
+ id-token: write
45
+ steps:
46
+ - name: Download package distributions
47
+ uses: actions/download-artifact@v4
48
+ with:
49
+ name: python-package-distributions
50
+ path: dist/
51
+
52
+ # Configure a PyPI Trusted Publisher for this repository, workflow, and
53
+ # the "pypi" GitHub environment before this step can publish.
54
+ - name: Publish package distributions to PyPI
55
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,59 @@
1
+ name: ShipGuard Release Risk Review
2
+
3
+ on:
4
+ pull_request:
5
+ types: [opened, synchronize, reopened]
6
+
7
+ permissions:
8
+ contents: read
9
+ pull-requests: read
10
+
11
+ jobs:
12
+ shipguard:
13
+ runs-on: ubuntu-latest
14
+ steps:
15
+ - name: Check out trusted action source
16
+ uses: actions/checkout@v4
17
+ with:
18
+ ref: ${{ github.event.pull_request.base.sha }}
19
+
20
+ - name: Check model configuration
21
+ id: model-secrets
22
+ shell: bash
23
+ env:
24
+ SHIPGUARD_LLM_BASE_URL: ${{ secrets.SHIPGUARD_LLM_BASE_URL }}
25
+ SHIPGUARD_LLM_API_KEY: ${{ secrets.SHIPGUARD_LLM_API_KEY }}
26
+ SHIPGUARD_LLM_MODEL: ${{ secrets.SHIPGUARD_LLM_MODEL }}
27
+ run: |
28
+ set -euo pipefail
29
+
30
+ if [[ -n "$SHIPGUARD_LLM_BASE_URL" \
31
+ && -n "$SHIPGUARD_LLM_API_KEY" \
32
+ && -n "$SHIPGUARD_LLM_MODEL" ]]; then
33
+ echo "available=true" >> "$GITHUB_OUTPUT"
34
+ else
35
+ echo "available=false" >> "$GITHUB_OUTPUT"
36
+ fi
37
+
38
+ - name: Run ShipGuard
39
+ if: ${{ steps.model-secrets.outputs.available == 'true' }}
40
+ uses: ./
41
+ with:
42
+ pr_url: ${{ github.event.pull_request.html_url }}
43
+ github_token: ${{ github.token }}
44
+ upload_artifacts: "true"
45
+ html: "true"
46
+ dry_run_comments: "false"
47
+ post_comment: "false"
48
+ post_inline_comments: "false"
49
+ request_changes: "false"
50
+ env:
51
+ SHIPGUARD_LLM_BASE_URL: ${{ secrets.SHIPGUARD_LLM_BASE_URL }}
52
+ SHIPGUARD_LLM_API_KEY: ${{ secrets.SHIPGUARD_LLM_API_KEY }}
53
+ SHIPGUARD_LLM_MODEL: ${{ secrets.SHIPGUARD_LLM_MODEL }}
54
+
55
+ - name: Explain skipped ShipGuard review
56
+ if: ${{ steps.model-secrets.outputs.available != 'true' }}
57
+ shell: bash
58
+ run: |
59
+ echo "ShipGuard review skipped: all three SHIPGUARD_LLM_* secrets must be configured."
@@ -0,0 +1,225 @@
1
+ .DS_Store
2
+ sample-app/
3
+ .shipguard/memory/
4
+ .shipguard/reports/
5
+
6
+ # Byte-compiled / optimized / DLL files
7
+ __pycache__/
8
+ *.py[codz]
9
+ *$py.class
10
+
11
+ # C extensions
12
+ *.so
13
+
14
+ # Distribution / packaging
15
+ .Python
16
+ build/
17
+ develop-eggs/
18
+ dist/
19
+ downloads/
20
+ eggs/
21
+ .eggs/
22
+ lib/
23
+ lib64/
24
+ parts/
25
+ sdist/
26
+ var/
27
+ wheels/
28
+ share/python-wheels/
29
+ *.egg-info/
30
+ .installed.cfg
31
+ *.egg
32
+ MANIFEST
33
+
34
+ # PyInstaller
35
+ # Usually these files are written by a python script from a template
36
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
37
+ *.manifest
38
+ *.spec
39
+
40
+ # Installer logs
41
+ pip-log.txt
42
+ pip-delete-this-directory.txt
43
+
44
+ # Unit test / coverage reports
45
+ htmlcov/
46
+ .tox/
47
+ .nox/
48
+ .coverage
49
+ .coverage.*
50
+ .cache
51
+ nosetests.xml
52
+ coverage.xml
53
+ *.cover
54
+ *.py.cover
55
+ .hypothesis/
56
+ .pytest_cache/
57
+ cover/
58
+
59
+ # Translations
60
+ *.mo
61
+ *.pot
62
+
63
+ # Django stuff:
64
+ *.log
65
+ local_settings.py
66
+ db.sqlite3
67
+ db.sqlite3-journal
68
+
69
+ # Flask stuff:
70
+ instance/
71
+ .webassets-cache
72
+
73
+ # Scrapy stuff:
74
+ .scrapy
75
+
76
+ # Sphinx documentation
77
+ docs/_build/
78
+
79
+ # PyBuilder
80
+ .pybuilder/
81
+ target/
82
+
83
+ # Jupyter Notebook
84
+ .ipynb_checkpoints
85
+
86
+ # IPython
87
+ profile_default/
88
+ ipython_config.py
89
+
90
+ # pyenv
91
+ # For a library or package, you might want to ignore these files since the code is
92
+ # intended to run in multiple environments; otherwise, check them in:
93
+ # .python-version
94
+
95
+ # pipenv
96
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
97
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
98
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
99
+ # install all needed dependencies.
100
+ # Pipfile.lock
101
+
102
+ # UV
103
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
104
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
105
+ # commonly ignored for libraries.
106
+ # uv.lock
107
+
108
+ # poetry
109
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
110
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
111
+ # commonly ignored for libraries.
112
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
113
+ # poetry.lock
114
+ # poetry.toml
115
+
116
+ # pdm
117
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
118
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
119
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
120
+ # pdm.lock
121
+ # pdm.toml
122
+ .pdm-python
123
+ .pdm-build/
124
+
125
+ # pixi
126
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
127
+ # pixi.lock
128
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
129
+ # in the .venv directory. It is recommended not to include this directory in version control.
130
+ .pixi
131
+
132
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
133
+ __pypackages__/
134
+
135
+ # Celery stuff
136
+ celerybeat-schedule
137
+ celerybeat.pid
138
+
139
+ # Redis
140
+ *.rdb
141
+ *.aof
142
+ *.pid
143
+
144
+ # RabbitMQ
145
+ mnesia/
146
+ rabbitmq/
147
+ rabbitmq-data/
148
+
149
+ # ActiveMQ
150
+ activemq-data/
151
+
152
+ # SageMath parsed files
153
+ *.sage.py
154
+
155
+ # Environments
156
+ .env
157
+ .env.*
158
+ !.env.example
159
+ .envrc
160
+ .venv
161
+ env/
162
+ venv/
163
+ ENV/
164
+ env.bak/
165
+ venv.bak/
166
+
167
+ # Spyder project settings
168
+ .spyderproject
169
+ .spyproject
170
+
171
+ # Rope project settings
172
+ .ropeproject
173
+
174
+ # mkdocs documentation
175
+ /site
176
+
177
+ # mypy
178
+ .mypy_cache/
179
+ .dmypy.json
180
+ dmypy.json
181
+
182
+ # Pyre type checker
183
+ .pyre/
184
+
185
+ # pytype static type analyzer
186
+ .pytype/
187
+
188
+ # Cython debug symbols
189
+ cython_debug/
190
+
191
+ # PyCharm
192
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
193
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
194
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
195
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
196
+ # .idea/
197
+
198
+ # Abstra
199
+ # Abstra is an AI-powered process automation framework.
200
+ # Ignore directories containing user credentials, local state, and settings.
201
+ # Learn more at https://abstra.io/docs
202
+ .abstra/
203
+
204
+ # Visual Studio Code
205
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
206
+ # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
207
+ # and can be added to the global gitignore or merged into this file. However, if you prefer,
208
+ # you could uncomment the following to ignore the entire vscode folder
209
+ # .vscode/
210
+ # Temporary file for partial code execution
211
+ tempCodeRunnerFile.py
212
+
213
+ # Ruff stuff:
214
+ .ruff_cache/
215
+
216
+ # PyPI configuration file
217
+ .pypirc
218
+
219
+ # Marimo
220
+ marimo/_static/
221
+ marimo/_lsp/
222
+ __marimo__/
223
+
224
+ # Streamlit
225
+ .streamlit/secrets.toml
@@ -0,0 +1,40 @@
1
+ # Changelog
2
+
3
+ All notable changes to ShipGuard will be documented in this file.
4
+
5
+ The project intends to follow [Keep a
6
+ Changelog](https://keepachangelog.com/en/1.1.0/) and semantic versioning once a
7
+ stable release process is established.
8
+
9
+ ## [Unreleased]
10
+
11
+ ### Added
12
+
13
+ - Standard open-source governance and contribution documentation.
14
+ - GitHub issue and pull request templates.
15
+ - A maintainer-oriented roadmap.
16
+ - GitHub Actions validation for tests, compilation, and CLI help on supported
17
+ Python versions.
18
+ - Maintainer backlog guidance with suggested labels and actionable issue
19
+ drafts.
20
+ - A proposed, design-only GitHub Action integration covering safety,
21
+ permissions, artifacts, failures, and privacy.
22
+ - An initial advisory composite GitHub Action wrapper that runs PR analysis and
23
+ uploads Release Passport artifacts.
24
+ - GitHub Action usage documentation covering secrets, permissions, limitations,
25
+ artifact privacy, and troubleshooting.
26
+ - A read-only, secret-gated dogfooding workflow for advisory pull request
27
+ Release Passport artifacts.
28
+ - Documentation for verifying the dogfooding workflow with a small pull
29
+ request.
30
+ - A PyPI Trusted Publishing workflow that builds, checks, and publishes package
31
+ distributions without an API token.
32
+ - PyPI release documentation for local validation and repository setup.
33
+
34
+ ### Changed
35
+
36
+ - Reframed the README around pull request release-risk review, current
37
+ capabilities, limitations, and supported workflows.
38
+ - Changed the intended PyPI distribution name to `shipguard-ai` and bumped the
39
+ package version to `0.1.1`, while preserving the `shipguard` import namespace
40
+ and CLI command.
@@ -0,0 +1,58 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our pledge
4
+
5
+ We pledge to make participation in the ShipGuard community a harassment-free
6
+ experience for everyone, regardless of age, body size, disability, ethnicity,
7
+ sex characteristics, gender identity and expression, level of experience,
8
+ education, socioeconomic status, nationality, personal appearance, race,
9
+ religion, or sexual identity and orientation.
10
+
11
+ We pledge to act and interact in ways that contribute to an open, welcoming,
12
+ diverse, inclusive, and healthy community.
13
+
14
+ ## Our standards
15
+
16
+ Examples of behavior that contributes to a positive community include:
17
+
18
+ - demonstrating empathy and kindness;
19
+ - respecting differing opinions, viewpoints, and experiences;
20
+ - giving and accepting constructive feedback;
21
+ - taking responsibility, apologizing, and learning from mistakes; and
22
+ - focusing on what is best for the community.
23
+
24
+ Unacceptable behavior includes:
25
+
26
+ - sexualized language or attention;
27
+ - insulting, derogatory, or inflammatory comments;
28
+ - public or private harassment;
29
+ - publishing another person's private information without permission; and
30
+ - other conduct that could reasonably be considered inappropriate in a
31
+ professional setting.
32
+
33
+ ## Enforcement responsibilities
34
+
35
+ Project maintainers are responsible for clarifying and enforcing these
36
+ standards. They may remove, edit, or reject comments, commits, code, issues, and
37
+ other contributions that do not align with this Code of Conduct.
38
+
39
+ ## Scope
40
+
41
+ This Code of Conduct applies in project spaces and when an individual is
42
+ officially representing the project in public spaces.
43
+
44
+ ## Reporting and enforcement
45
+
46
+ Report conduct concerns privately to a maintainer using a private contact
47
+ listed on their GitHub profile. If no private contact is available, open a
48
+ non-sensitive issue asking how to report the concern privately. Do not publish
49
+ personal or sensitive details in the issue.
50
+
51
+ Maintainers will respect the privacy and safety of reporters as far as
52
+ reasonably possible. Enforcement may include a correction, warning, temporary
53
+ restriction, or permanent ban, depending on the impact and pattern of behavior.
54
+
55
+ ## Attribution
56
+
57
+ This Code of Conduct is adapted from the [Contributor Covenant, version
58
+ 2.1](https://www.contributor-covenant.org/version/2/1/code_of_conduct.html).