kestrel-feature-github 0.1.0__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.
@@ -0,0 +1,147 @@
1
+ name: kestrel-feature-github CI
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ - 'feat/*'
8
+ - 'fix/*'
9
+ - 'release/*'
10
+ - 'codex/*'
11
+ pull_request:
12
+ branches: [main]
13
+ workflow_dispatch:
14
+ workflow_call:
15
+ inputs:
16
+ ref:
17
+ description: 'Tag or commit to test'
18
+ required: false
19
+ type: string
20
+
21
+ env:
22
+ PYTHON_VERSION: "3.13"
23
+
24
+ jobs:
25
+ lint-and-imports:
26
+ runs-on: ubuntu-latest
27
+ steps:
28
+ - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
29
+ with:
30
+ ref: ${{ inputs.ref || github.ref }}
31
+ - name: Install uv
32
+ uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78
33
+ with:
34
+ enable-cache: true
35
+ - name: Set up Python
36
+ run: uv python install ${{ env.PYTHON_VERSION }}
37
+ - name: Install package + test extras
38
+ run: |
39
+ uv venv --python ${{ env.PYTHON_VERSION }} .venv
40
+ . .venv/bin/activate
41
+ uv pip install -e '.[test]'
42
+ - name: Validate package imports
43
+ run: |
44
+ . .venv/bin/activate
45
+ python -c "
46
+ from kestrel_feature_github import GitHubFeature
47
+ import importlib.metadata as md
48
+ eps = md.entry_points(group='kestrel_sovereign.features')
49
+ names = [e.name for e in eps]
50
+ assert 'GitHubFeature' in names, f'Entry-point not registered: {names}'
51
+ print('kestrel_feature_github imports OK; feature class:', GitHubFeature.__name__)
52
+ "
53
+ timeout-minutes: 3
54
+
55
+ build-check:
56
+ runs-on: ubuntu-latest
57
+ needs: lint-and-imports
58
+ steps:
59
+ - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
60
+ with:
61
+ ref: ${{ inputs.ref || github.ref }}
62
+ - name: Install uv
63
+ uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78
64
+ with:
65
+ enable-cache: true
66
+ - name: Set up Python
67
+ run: uv python install ${{ env.PYTHON_VERSION }}
68
+ - name: Build sdist + wheel
69
+ run: uv build
70
+ - name: Inspect wheel contents
71
+ run: |
72
+ set -e
73
+ WHEEL=$(ls dist/*.whl | head -1)
74
+ echo "Inspecting $WHEEL"
75
+ uv run --no-project python -c "
76
+ import sys, zipfile
77
+ z = zipfile.ZipFile('$WHEEL')
78
+ names = z.namelist()
79
+ forbidden = [n for n in names if n.startswith('kestrel_sovereign/') or n.startswith('kestrel_sdk/')]
80
+ if forbidden:
81
+ print('ERROR: wheel contains framework/SDK content:', forbidden, file=sys.stderr)
82
+ sys.exit(1)
83
+ required = [
84
+ 'kestrel_feature_github/__init__.py',
85
+ 'kestrel_feature_github/feature.py',
86
+ 'kestrel_feature_github/client.py',
87
+ 'kestrel_feature_github/models.py',
88
+ 'kestrel_feature_github/cache.py',
89
+ 'kestrel_feature_github/ast_analyzer.py',
90
+ ]
91
+ missing = [m for m in required if m not in names]
92
+ if missing:
93
+ print('ERROR: wheel missing expected files:', missing, file=sys.stderr)
94
+ sys.exit(1)
95
+ print(f'Wheel OK ({len(names)} entries)')
96
+ "
97
+
98
+ install-check:
99
+ runs-on: ubuntu-latest
100
+ needs: build-check
101
+ strategy:
102
+ matrix:
103
+ python-version: ["3.11", "3.12", "3.13"]
104
+ steps:
105
+ - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
106
+ with:
107
+ ref: ${{ inputs.ref || github.ref }}
108
+ - name: Install uv
109
+ uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78
110
+ with:
111
+ enable-cache: true
112
+ - name: Set up Python ${{ matrix.python-version }}
113
+ run: uv python install ${{ matrix.python-version }}
114
+ - name: Clean install + smoke test
115
+ run: |
116
+ uv venv --python ${{ matrix.python-version }} .venv-test
117
+ . .venv-test/bin/activate
118
+ uv pip install .
119
+ python -c "
120
+ from kestrel_feature_github import GitHubFeature
121
+ import importlib.metadata as md
122
+ eps = md.entry_points(group='kestrel_sovereign.features')
123
+ names = [e.name for e in eps]
124
+ assert 'GitHubFeature' in names, f'Entry-point not registered: {names}'
125
+ print(f'kestrel-feature-github installs + entry-point OK on Python ${{ matrix.python-version }}')
126
+ "
127
+
128
+ test:
129
+ runs-on: ubuntu-latest
130
+ needs: lint-and-imports
131
+ steps:
132
+ - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
133
+ with:
134
+ ref: ${{ inputs.ref || github.ref }}
135
+ - name: Install uv
136
+ uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78
137
+ with:
138
+ enable-cache: true
139
+ - name: Set up Python
140
+ run: uv python install ${{ env.PYTHON_VERSION }}
141
+ - name: Install + run pytest
142
+ run: |
143
+ uv venv --python ${{ env.PYTHON_VERSION }} .venv
144
+ . .venv/bin/activate
145
+ uv pip install -e '.[test]'
146
+ uv run --no-sync pytest tests/ -v --tb=short
147
+ timeout-minutes: 10
@@ -0,0 +1,76 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ push:
5
+ tags: ['v[0-9]+.[0-9]+.[0-9]+']
6
+ workflow_dispatch:
7
+ inputs:
8
+ ref:
9
+ description: 'Tag or commit to publish (e.g. v0.1.0)'
10
+ required: true
11
+
12
+ permissions:
13
+ contents: read
14
+
15
+ jobs:
16
+ ci:
17
+ name: CI gate
18
+ uses: ./.github/workflows/ci.yml
19
+ with:
20
+ ref: ${{ inputs.ref || github.ref }}
21
+ secrets: inherit
22
+
23
+ build:
24
+ name: Build sdist + wheel
25
+ needs: ci
26
+ runs-on: ubuntu-latest
27
+ steps:
28
+ - name: Checkout
29
+ uses: actions/checkout@v4
30
+ with:
31
+ ref: ${{ inputs.ref || github.ref }}
32
+ - name: Install uv
33
+ uses: astral-sh/setup-uv@v3
34
+ - name: Build
35
+ run: uv build
36
+ - name: Verify the version metadata matches the tag
37
+ if: startsWith(inputs.ref, 'v') || startsWith(github.ref, 'refs/tags/v')
38
+ env:
39
+ INPUT_REF: ${{ inputs.ref }}
40
+ run: |
41
+ if [ -n "$INPUT_REF" ]; then
42
+ TAG_NAME="$INPUT_REF"
43
+ else
44
+ TAG_NAME="$GITHUB_REF_NAME"
45
+ fi
46
+ TAG_VERSION="${TAG_NAME#v}"
47
+ PKG_VERSION=$(uv run --no-project python -c "import tomllib; print(tomllib.loads(open('pyproject.toml').read())['project']['version'])")
48
+ if [ "$TAG_VERSION" != "$PKG_VERSION" ]; then
49
+ echo "::error::tag $TAG_NAME does not match pyproject.toml version $PKG_VERSION"
50
+ exit 1
51
+ fi
52
+ echo "tag $TAG_NAME matches pyproject.toml version $PKG_VERSION"
53
+ - name: Show artifacts
54
+ run: ls -la dist/
55
+ - name: Upload artifacts
56
+ uses: actions/upload-artifact@v4
57
+ with:
58
+ name: dist
59
+ path: dist/
60
+ if-no-files-found: error
61
+
62
+ publish:
63
+ name: Upload to PyPI
64
+ needs: build
65
+ runs-on: ubuntu-latest
66
+ environment: pypi
67
+ permissions:
68
+ id-token: write
69
+ steps:
70
+ - name: Download build artifacts
71
+ uses: actions/download-artifact@v4
72
+ with:
73
+ name: dist
74
+ path: dist/
75
+ - name: Publish via OIDC trusted publishing
76
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,2 @@
1
+ __pycache__/
2
+ *.pyc
@@ -0,0 +1,41 @@
1
+ # kestrel-feature-github — Agent Instructions
2
+
3
+ See [README.md](README.md) for package overview.
4
+
5
+ ## Package Structure
6
+
7
+ ```
8
+ kestrel-feature-github/
9
+ ├── pyproject.toml
10
+ ├── README.md
11
+ └── kestrel_feature_github/
12
+ ├── __init__.py
13
+ ├── SKILL.md
14
+ ├── feature.py # GitHubFeature entry point
15
+ ├── client.py # GitHub API client
16
+ ├── models.py # Data models
17
+ ├── ast_analyzer.py # AST analysis utilities
18
+ └── cache.py # Response caching
19
+ ```
20
+
21
+ ## Entry Points
22
+
23
+ - `kestrel_sovereign.features`: `GitHubFeature = "kestrel_feature_github:GitHubFeature"`
24
+
25
+ ## Key Files to Read First
26
+
27
+ 1. `kestrel_feature_github/feature.py` — Main feature class and tool registration
28
+ 2. `kestrel_feature_github/client.py` — GitHub API client implementation
29
+ 3. `kestrel_feature_github/SKILL.md` — Full skill/command reference
30
+
31
+ ## Running Tests
32
+
33
+ ```bash
34
+ uv run pytest
35
+ ```
36
+
37
+ ## Agent-Specific Instructions
38
+
39
+ - Imports are from `kestrel_feature_github`
40
+ - Requires `GITHUB_TOKEN` environment variable for API access
41
+ - API responses are cached via `cache.py` to reduce rate limiting
@@ -0,0 +1,106 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction, and
10
+ distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by the
13
+ copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all other
16
+ entities that control, are controlled by, or are under common control with
17
+ that entity. For the purposes of this definition, "control" means (i) the
18
+ power, direct or indirect, to cause the direction or management of such
19
+ entity, whether by contract or otherwise, or (ii) ownership of fifty percent
20
+ (50%) or more of the outstanding shares, or (iii) beneficial ownership of
21
+ such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity exercising
24
+ permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation source, and
28
+ configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical transformation
31
+ or translation of a Source form, including but not limited to compiled object
32
+ code, generated documentation, and conversions to other media types.
33
+
34
+ "Work" shall mean the work of authorship, whether in Source or Object form,
35
+ made available under the License, as indicated by a copyright notice that is
36
+ included in or attached to the work.
37
+
38
+ "Derivative Works" shall mean any work, whether in Source or Object form,
39
+ that is based on (or derived from) the Work and for which the editorial
40
+ revisions, annotations, elaborations, or other modifications represent, as a
41
+ whole, an original work of authorship. For the purposes of this License,
42
+ Derivative Works shall not include works that remain separable from, or
43
+ merely link (or bind by name) to the interfaces of, the Work and Derivative
44
+ Works thereof.
45
+
46
+ "Contribution" shall mean any work of authorship, including the original
47
+ version of the Work and any modifications or additions to that Work or
48
+ Derivative Works thereof, that is intentionally submitted to Licensor for
49
+ inclusion in the Work by the copyright owner or by an individual or Legal
50
+ Entity authorized to submit on behalf of the copyright owner.
51
+
52
+ "Contributor" shall mean Licensor and any individual or Legal Entity on
53
+ behalf of whom a Contribution has been received by Licensor and subsequently
54
+ incorporated within the Work.
55
+
56
+ 2. Grant of Copyright License. Subject to the terms and conditions of this
57
+ License, each Contributor hereby grants to You a perpetual, worldwide,
58
+ non-exclusive, no-charge, royalty-free, irrevocable copyright license to
59
+ reproduce, prepare Derivative Works of, publicly display, publicly perform,
60
+ sublicense, and distribute the Work and such Derivative Works in Source or
61
+ Object form.
62
+
63
+ 3. Grant of Patent License. Subject to the terms and conditions of this
64
+ License, each Contributor hereby grants to You a perpetual, worldwide,
65
+ non-exclusive, no-charge, royalty-free, irrevocable patent license to make,
66
+ have made, use, offer to sell, sell, import, and otherwise transfer the Work.
67
+
68
+ 4. Redistribution. You may reproduce and distribute copies of the Work or
69
+ Derivative Works thereof in any medium, with or without modifications, and in
70
+ Source or Object form, provided that You meet the following conditions:
71
+
72
+ (a) You must give any other recipients of the Work or Derivative Works a copy
73
+ of this License; and
74
+
75
+ (b) You must cause any modified files to carry prominent notices stating that
76
+ You changed the files; and
77
+
78
+ (c) You must retain, in the Source form of any Derivative Works that You
79
+ distribute, all copyright, patent, trademark, and attribution notices from
80
+ the Source form of the Work, excluding those notices that do not pertain to
81
+ any part of the Derivative Works; and
82
+
83
+ (d) If the Work includes a "NOTICE" text file as part of its distribution,
84
+ then any Derivative Works that You distribute must include a readable copy of
85
+ the attribution notices contained within such NOTICE file.
86
+
87
+ 5. Submission of Contributions. Unless You explicitly state otherwise, any
88
+ Contribution intentionally submitted for inclusion in the Work by You to the
89
+ Licensor shall be under the terms and conditions of this License.
90
+
91
+ 6. Trademarks. This License does not grant permission to use the trade names,
92
+ trademarks, service marks, or product names of the Licensor.
93
+
94
+ 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in
95
+ writing, Licensor provides the Work on an "AS IS" BASIS, WITHOUT WARRANTIES
96
+ OR CONDITIONS OF ANY KIND, either express or implied.
97
+
98
+ 8. Limitation of Liability. In no event and under no legal theory, whether in
99
+ tort, contract, or otherwise, unless required by applicable law, shall any
100
+ Contributor be liable to You for damages.
101
+
102
+ 9. Accepting Warranty or Additional Liability. While redistributing the Work
103
+ or Derivative Works thereof, You may choose to offer support, warranty,
104
+ indemnity, or other liability obligations. However, in accepting such
105
+ obligations, You may act only on Your own behalf and on Your sole
106
+ responsibility.
@@ -0,0 +1,51 @@
1
+ Metadata-Version: 2.4
2
+ Name: kestrel-feature-github
3
+ Version: 0.1.0
4
+ Summary: Kestrel GitHub integration feature
5
+ License: Apache-2.0
6
+ License-File: LICENSE
7
+ Requires-Python: >=3.11
8
+ Requires-Dist: aiosqlite>=0.21.0
9
+ Requires-Dist: httpx>=0.27.0
10
+ Requires-Dist: kestrel-sovereign-sdk<1,>=0.11
11
+ Requires-Dist: pyyaml>=6.0
12
+ Provides-Extra: test
13
+ Requires-Dist: pytest-asyncio>=0.23.0; extra == 'test'
14
+ Requires-Dist: pytest>=8.0.0; extra == 'test'
15
+ Description-Content-Type: text/markdown
16
+
17
+ # kestrel-feature-github
18
+
19
+ GitHub integration for Kestrel Sovereign agents — manage issues, pull requests, and repositories directly from agent conversations.
20
+
21
+ ## Installation
22
+
23
+ ```bash
24
+ uv pip install kestrel-feature-github
25
+ ```
26
+
27
+ ## Dependencies
28
+
29
+ - `kestrel-sovereign-sdk`
30
+ - `httpx`
31
+ - `pyyaml`
32
+ - `aiosqlite`
33
+
34
+ ## Usage
35
+
36
+ Once installed, the `GitHubFeature` is automatically discovered by kestrel-sovereign via the `kestrel_sovereign.features` entry point.
37
+
38
+ See [SKILL.md](SKILL.md) for the full skill reference.
39
+
40
+ ## Configuration
41
+
42
+ | Variable | Description |
43
+ |----------|-------------|
44
+ | `GITHUB_TOKEN` | GitHub personal access token with repo access |
45
+
46
+ ## Development
47
+
48
+ ```bash
49
+ uv sync --extra test
50
+ uv run --extra test pytest
51
+ ```
@@ -0,0 +1,35 @@
1
+ # kestrel-feature-github
2
+
3
+ GitHub integration for Kestrel Sovereign agents — manage issues, pull requests, and repositories directly from agent conversations.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ uv pip install kestrel-feature-github
9
+ ```
10
+
11
+ ## Dependencies
12
+
13
+ - `kestrel-sovereign-sdk`
14
+ - `httpx`
15
+ - `pyyaml`
16
+ - `aiosqlite`
17
+
18
+ ## Usage
19
+
20
+ Once installed, the `GitHubFeature` is automatically discovered by kestrel-sovereign via the `kestrel_sovereign.features` entry point.
21
+
22
+ See [SKILL.md](SKILL.md) for the full skill reference.
23
+
24
+ ## Configuration
25
+
26
+ | Variable | Description |
27
+ |----------|-------------|
28
+ | `GITHUB_TOKEN` | GitHub personal access token with repo access |
29
+
30
+ ## Development
31
+
32
+ ```bash
33
+ uv sync --extra test
34
+ uv run --extra test pytest
35
+ ```
@@ -0,0 +1,101 @@
1
+ # GitHubFeature
2
+
3
+ > GitHub integration for issues, PRs, repository access, and code introspection.
4
+
5
+ ## Skills
6
+
7
+ ### read_github_file
8
+ - **Description**: Read a file from a GitHub repository
9
+ - **Category**: data_access
10
+ - **Parameters**:
11
+ - `repo` (string, required): Repository in 'owner/repo' format, or 'self'
12
+ - `path` (string, required): Path to file within the repository
13
+ - `ref` (string, optional): Branch, tag, or commit SHA (default: main)
14
+
15
+ ### list_github_files
16
+ - **Description**: List files in a GitHub repository directory
17
+ - **Category**: data_access
18
+ - **Parameters**:
19
+ - `repo` (string, required): Repository in 'owner/repo' format, or 'self'
20
+ - `path` (string, optional): Directory path (empty for root)
21
+ - `ref` (string, optional): Branch, tag, or commit SHA
22
+ - `recursive` (boolean, optional): If true, list all files recursively
23
+
24
+ ### search_github_code
25
+ - **Description**: Search for code in GitHub repositories
26
+ - **Category**: data_access
27
+ - **Parameters**:
28
+ - `query` (string, required): Search query
29
+ - `repo` (string, optional): Limit to specific repo
30
+ - `path` (string, optional): Limit to path prefix
31
+ - `extension` (string, optional): Limit to file extension
32
+ - `max_results` (integer, optional): Maximum results (default 20)
33
+
34
+ ### get_code_definition
35
+ - **Description**: Get a function or class definition from a Python file using AST
36
+ - **Category**: data_access
37
+ - **Parameters**:
38
+ - `repo` (string, required): Repository or 'self'
39
+ - `path` (string, required): Path to Python file
40
+ - `name` (string, required): Function or class name
41
+ - `ref` (string, optional): Branch, tag, or commit SHA
42
+
43
+ ### list_code_definitions
44
+ - **Description**: List all functions and classes in a Python file
45
+ - **Category**: data_access
46
+ - **Parameters**:
47
+ - `repo` (string, required): Repository or 'self'
48
+ - `path` (string, required): Path to Python file
49
+ - `ref` (string, optional): Branch, tag, or commit SHA
50
+
51
+ ### get_self_repo_info
52
+ - **Description**: Get information about the agent's own source repository
53
+ - **Category**: data_access
54
+
55
+ ### list_source_components
56
+ - **Description**: List all feature components in the agent's source code
57
+ - **Category**: data_access
58
+ - **Parameters**:
59
+ - `include_files` (boolean, optional): Include file listings for each component
60
+
61
+ ### get_component_source
62
+ - **Description**: Get all source files for a specific feature component
63
+ - **Category**: data_access
64
+ - **Parameters**:
65
+ - `component` (string, required): Component name
66
+ - `include_content` (boolean, optional): Include file contents
67
+
68
+ ### invalidate_github_cache
69
+ - **Description**: Invalidate cached GitHub content to force fresh fetch
70
+ - **Category**: data_access
71
+ - **Parameters**:
72
+ - `repo` (string, required): Repository to invalidate (or 'self')
73
+ - `path` (string, optional): Specific path to invalidate
74
+
75
+ ### list_github_issues
76
+ - **Description**: List issues in a GitHub repository
77
+ - **Category**: data_access
78
+ - **Parameters**:
79
+ - `repo` (string, optional): Repository or 'self' (default: self)
80
+ - `state` (string, optional): Issue state filter (default: open)
81
+ - `labels` (string, optional): Comma-separated label names
82
+ - `max_results` (integer, optional): Maximum results (default 30)
83
+
84
+ ### get_github_issue
85
+ - **Description**: Get details of a specific GitHub issue
86
+ - **Category**: data_access
87
+ - **Parameters**:
88
+ - `issue_number` (integer, required): Issue number
89
+ - `repo` (string, optional): Repository or 'self' (default: self)
90
+
91
+ ### get_github_issue_comments
92
+ - **Description**: Get comments on a specific GitHub issue
93
+ - **Category**: data_access
94
+ - **Parameters**:
95
+ - `issue_number` (integer, required): Issue number
96
+ - `repo` (string, optional): Repository or 'self' (default: self)
97
+ - `max_results` (integer, optional): Maximum comments (default 30)
98
+
99
+ ## Dependencies
100
+
101
+ - Requires: kestrel-sovereign, httpx, pyyaml, aiosqlite
@@ -0,0 +1,4 @@
1
+ """Kestrel Feature: GitHub integration for issues, PRs, and repository management."""
2
+ from .feature import GitHubFeature
3
+
4
+ __all__ = ["GitHubFeature"]