github-issue-exporter 0.0.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.
- github_issue_exporter-0.0.1/.github/workflows/publish.yml +39 -0
- github_issue_exporter-0.0.1/.gitignore +12 -0
- github_issue_exporter-0.0.1/.python-version +1 -0
- github_issue_exporter-0.0.1/PKG-INFO +195 -0
- github_issue_exporter-0.0.1/README.md +179 -0
- github_issue_exporter-0.0.1/architecture.md +241 -0
- github_issue_exporter-0.0.1/pyproject.toml +32 -0
- github_issue_exporter-0.0.1/src/github_issue_exporter/__init__.py +18 -0
- github_issue_exporter-0.0.1/src/github_issue_exporter/__main__.py +6 -0
- github_issue_exporter-0.0.1/src/github_issue_exporter/cli/__init__.py +0 -0
- github_issue_exporter-0.0.1/src/github_issue_exporter/cli/main.py +311 -0
- github_issue_exporter-0.0.1/src/github_issue_exporter/core/__init__.py +0 -0
- github_issue_exporter-0.0.1/src/github_issue_exporter/core/auth.py +186 -0
- github_issue_exporter-0.0.1/src/github_issue_exporter/core/config.py +237 -0
- github_issue_exporter-0.0.1/src/github_issue_exporter/core/export_engine.py +344 -0
- github_issue_exporter-0.0.1/src/github_issue_exporter/core/filesystem.py +241 -0
- github_issue_exporter-0.0.1/src/github_issue_exporter/core/github_client.py +334 -0
- github_issue_exporter-0.0.1/src/github_issue_exporter/core/transformer.py +148 -0
- github_issue_exporter-0.0.1/uv.lock +395 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
publish:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
environment: release
|
|
11
|
+
permissions:
|
|
12
|
+
contents: read # Required for actions/checkout
|
|
13
|
+
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
|
|
14
|
+
|
|
15
|
+
steps:
|
|
16
|
+
- name: Checkout code
|
|
17
|
+
uses: actions/checkout@v4
|
|
18
|
+
|
|
19
|
+
- name: Set up Python
|
|
20
|
+
uses: actions/setup-python@v5
|
|
21
|
+
with:
|
|
22
|
+
python-version: '3.11'
|
|
23
|
+
|
|
24
|
+
- name: Install uv
|
|
25
|
+
uses: astral-sh/setup-uv@v4
|
|
26
|
+
with:
|
|
27
|
+
version: "latest"
|
|
28
|
+
|
|
29
|
+
- name: Update version from Git tag and build package
|
|
30
|
+
run: |
|
|
31
|
+
VERSION=$(git describe --tags --abbrev=0)
|
|
32
|
+
echo "Setting version to: $VERSION"
|
|
33
|
+
uv version $VERSION
|
|
34
|
+
uv build
|
|
35
|
+
|
|
36
|
+
- name: Publish to PyPI
|
|
37
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
38
|
+
with:
|
|
39
|
+
verbose: true
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.11
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: github-issue-exporter
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: Export GitHub issues to individual JSON files with incremental updates and credential management
|
|
5
|
+
Project-URL: Homepage, https://github.com/Beep-Boop-Digital/github-issue-exporter
|
|
6
|
+
Project-URL: Repository, https://github.com/Beep-Boop-Digital/github-issue-exporter
|
|
7
|
+
Project-URL: Issues, https://github.com/Beep-Boop-Digital/github-issue-exporter/issues
|
|
8
|
+
Author-email: Adam McKay <adam@beepboop.digital>
|
|
9
|
+
Requires-Python: >=3.11
|
|
10
|
+
Requires-Dist: cryptography>=45.0.3
|
|
11
|
+
Requires-Dist: httpx>=0.28.1
|
|
12
|
+
Requires-Dist: pydantic>=2.11.5
|
|
13
|
+
Requires-Dist: rich>=14.0.0
|
|
14
|
+
Requires-Dist: typer>=0.16.0
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
|
|
17
|
+
# GitHub Issue Exporter
|
|
18
|
+
|
|
19
|
+
A command-line tool that exports GitHub issues to individual JSON files, with incremental updates and credential management. Supports multiple repositories with per-repo configuration.
|
|
20
|
+
|
|
21
|
+
Authored by Claude Code.
|
|
22
|
+
|
|
23
|
+
## Features
|
|
24
|
+
|
|
25
|
+
- **Incremental Updates**: Only exports issues that have been modified since last export
|
|
26
|
+
- **Multiple Repositories**: Process multiple repositories concurrently
|
|
27
|
+
- **Secure Credential Storage**: Encrypted storage of GitHub tokens
|
|
28
|
+
- **Rich Progress Display**: Beautiful progress bars and status updates
|
|
29
|
+
- **Flexible Configuration**: Per-repository settings and global configuration
|
|
30
|
+
- **Comprehensive Export**: Includes issue metadata, comments, labels, and assignees
|
|
31
|
+
|
|
32
|
+
## Installation
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
# Install with uv
|
|
36
|
+
uv tool install github-issue-exporter
|
|
37
|
+
|
|
38
|
+
# Or install in development mode
|
|
39
|
+
uv pip install -e .
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Quick Start
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
# Export issues from a single repository
|
|
46
|
+
github-issue-exporter owner/repo
|
|
47
|
+
|
|
48
|
+
# Export from multiple repositories
|
|
49
|
+
github-issue-exporter owner/repo1,owner/repo2,owner/repo3
|
|
50
|
+
|
|
51
|
+
# Custom output directory
|
|
52
|
+
github-issue-exporter owner/repo --output /path/to/exports
|
|
53
|
+
|
|
54
|
+
# Force re-export (ignore timestamps)
|
|
55
|
+
github-issue-exporter owner/repo --force
|
|
56
|
+
|
|
57
|
+
# Export only open issues
|
|
58
|
+
github-issue-exporter owner/repo --state open
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Authentication
|
|
62
|
+
|
|
63
|
+
The tool will automatically prompt for a GitHub Personal Access Token when needed. You can create one at: https://github.com/settings/tokens
|
|
64
|
+
|
|
65
|
+
Required scopes:
|
|
66
|
+
- `repo` (for private repositories)
|
|
67
|
+
- `public_repo` (for public repositories)
|
|
68
|
+
|
|
69
|
+
Tokens are stored securely using encryption and can be managed per-repository.
|
|
70
|
+
|
|
71
|
+
## Configuration
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
# View current configuration
|
|
75
|
+
github-issue-exporter config --show
|
|
76
|
+
|
|
77
|
+
# Clear stored authentication
|
|
78
|
+
github-issue-exporter config --clear-auth owner/repo
|
|
79
|
+
|
|
80
|
+
# Set default output directory
|
|
81
|
+
github-issue-exporter config --set-output /path/to/exports
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Output Format
|
|
85
|
+
|
|
86
|
+
Issues are exported as individual JSON files with the following structure:
|
|
87
|
+
|
|
88
|
+
```json
|
|
89
|
+
{
|
|
90
|
+
"repository": {
|
|
91
|
+
"owner": "string",
|
|
92
|
+
"name": "string",
|
|
93
|
+
"full_name": "string"
|
|
94
|
+
},
|
|
95
|
+
"issue": {
|
|
96
|
+
"id": "number",
|
|
97
|
+
"number": "number",
|
|
98
|
+
"author": "string",
|
|
99
|
+
"state": "string",
|
|
100
|
+
"title": "string",
|
|
101
|
+
"body": "string",
|
|
102
|
+
"labels": ["string"],
|
|
103
|
+
"assignee": "string|null",
|
|
104
|
+
"assignees": ["string"],
|
|
105
|
+
"milestone": "string|null",
|
|
106
|
+
"created_date": "iso_string",
|
|
107
|
+
"updated_date": "iso_string",
|
|
108
|
+
"closed_date": "iso_string|null"
|
|
109
|
+
},
|
|
110
|
+
"comments": [
|
|
111
|
+
{
|
|
112
|
+
"id": "number",
|
|
113
|
+
"author": "string",
|
|
114
|
+
"body": "string",
|
|
115
|
+
"created_date": "iso_string",
|
|
116
|
+
"updated_date": "iso_string"
|
|
117
|
+
}
|
|
118
|
+
],
|
|
119
|
+
"export_metadata": {
|
|
120
|
+
"exported_at": "iso_string",
|
|
121
|
+
"tool_version": "string"
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## File Organization
|
|
127
|
+
|
|
128
|
+
Files are organized by repository and issue state:
|
|
129
|
+
|
|
130
|
+
```
|
|
131
|
+
exports/
|
|
132
|
+
owner1/
|
|
133
|
+
repo1/
|
|
134
|
+
open/
|
|
135
|
+
1-first-issue-title.json
|
|
136
|
+
3-another-open-issue.json
|
|
137
|
+
...
|
|
138
|
+
closed/
|
|
139
|
+
2-closed-issue-title.json
|
|
140
|
+
4-resolved-issue.json
|
|
141
|
+
...
|
|
142
|
+
owner2/
|
|
143
|
+
repo2/
|
|
144
|
+
open/
|
|
145
|
+
1-some-open-issue.json
|
|
146
|
+
closed/
|
|
147
|
+
2-some-closed-issue.json
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
**Key Features:**
|
|
151
|
+
- Issues are organized into `open` and `closed` subdirectories based on their current state
|
|
152
|
+
- Filenames use the issue number (not internal ID) for easier identification
|
|
153
|
+
- When an issue state changes, the file is automatically moved to the appropriate directory
|
|
154
|
+
|
|
155
|
+
## Commands
|
|
156
|
+
|
|
157
|
+
### export
|
|
158
|
+
Export GitHub issues to JSON files.
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
github-issue-exporter export [OPTIONS] REPOSITORIES
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
Options:
|
|
165
|
+
- `--output, -o`: Output directory (default: ./exports)
|
|
166
|
+
- `--force, -f`: Force re-export, ignoring timestamps
|
|
167
|
+
- `--state, -s`: Issue state (open, closed, all)
|
|
168
|
+
- `--no-comments`: Skip exporting comments
|
|
169
|
+
- `--concurrent, -c`: Max concurrent repositories (1-10)
|
|
170
|
+
|
|
171
|
+
### cleanup
|
|
172
|
+
Remove files for issues that no longer exist.
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
github-issue-exporter cleanup [OPTIONS] REPOSITORY
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### config
|
|
179
|
+
Manage configuration and credentials.
|
|
180
|
+
|
|
181
|
+
```bash
|
|
182
|
+
github-issue-exporter config [OPTIONS]
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
### --version
|
|
186
|
+
Show version information.
|
|
187
|
+
|
|
188
|
+
```bash
|
|
189
|
+
github-issue-exporter --version
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
## Requirements
|
|
193
|
+
|
|
194
|
+
- Python 3.11+
|
|
195
|
+
- GitHub Personal Access Token (for private repos or higher rate limits)
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
# GitHub Issue Exporter
|
|
2
|
+
|
|
3
|
+
A command-line tool that exports GitHub issues to individual JSON files, with incremental updates and credential management. Supports multiple repositories with per-repo configuration.
|
|
4
|
+
|
|
5
|
+
Authored by Claude Code.
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- **Incremental Updates**: Only exports issues that have been modified since last export
|
|
10
|
+
- **Multiple Repositories**: Process multiple repositories concurrently
|
|
11
|
+
- **Secure Credential Storage**: Encrypted storage of GitHub tokens
|
|
12
|
+
- **Rich Progress Display**: Beautiful progress bars and status updates
|
|
13
|
+
- **Flexible Configuration**: Per-repository settings and global configuration
|
|
14
|
+
- **Comprehensive Export**: Includes issue metadata, comments, labels, and assignees
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
# Install with uv
|
|
20
|
+
uv tool install github-issue-exporter
|
|
21
|
+
|
|
22
|
+
# Or install in development mode
|
|
23
|
+
uv pip install -e .
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Quick Start
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
# Export issues from a single repository
|
|
30
|
+
github-issue-exporter owner/repo
|
|
31
|
+
|
|
32
|
+
# Export from multiple repositories
|
|
33
|
+
github-issue-exporter owner/repo1,owner/repo2,owner/repo3
|
|
34
|
+
|
|
35
|
+
# Custom output directory
|
|
36
|
+
github-issue-exporter owner/repo --output /path/to/exports
|
|
37
|
+
|
|
38
|
+
# Force re-export (ignore timestamps)
|
|
39
|
+
github-issue-exporter owner/repo --force
|
|
40
|
+
|
|
41
|
+
# Export only open issues
|
|
42
|
+
github-issue-exporter owner/repo --state open
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Authentication
|
|
46
|
+
|
|
47
|
+
The tool will automatically prompt for a GitHub Personal Access Token when needed. You can create one at: https://github.com/settings/tokens
|
|
48
|
+
|
|
49
|
+
Required scopes:
|
|
50
|
+
- `repo` (for private repositories)
|
|
51
|
+
- `public_repo` (for public repositories)
|
|
52
|
+
|
|
53
|
+
Tokens are stored securely using encryption and can be managed per-repository.
|
|
54
|
+
|
|
55
|
+
## Configuration
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
# View current configuration
|
|
59
|
+
github-issue-exporter config --show
|
|
60
|
+
|
|
61
|
+
# Clear stored authentication
|
|
62
|
+
github-issue-exporter config --clear-auth owner/repo
|
|
63
|
+
|
|
64
|
+
# Set default output directory
|
|
65
|
+
github-issue-exporter config --set-output /path/to/exports
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Output Format
|
|
69
|
+
|
|
70
|
+
Issues are exported as individual JSON files with the following structure:
|
|
71
|
+
|
|
72
|
+
```json
|
|
73
|
+
{
|
|
74
|
+
"repository": {
|
|
75
|
+
"owner": "string",
|
|
76
|
+
"name": "string",
|
|
77
|
+
"full_name": "string"
|
|
78
|
+
},
|
|
79
|
+
"issue": {
|
|
80
|
+
"id": "number",
|
|
81
|
+
"number": "number",
|
|
82
|
+
"author": "string",
|
|
83
|
+
"state": "string",
|
|
84
|
+
"title": "string",
|
|
85
|
+
"body": "string",
|
|
86
|
+
"labels": ["string"],
|
|
87
|
+
"assignee": "string|null",
|
|
88
|
+
"assignees": ["string"],
|
|
89
|
+
"milestone": "string|null",
|
|
90
|
+
"created_date": "iso_string",
|
|
91
|
+
"updated_date": "iso_string",
|
|
92
|
+
"closed_date": "iso_string|null"
|
|
93
|
+
},
|
|
94
|
+
"comments": [
|
|
95
|
+
{
|
|
96
|
+
"id": "number",
|
|
97
|
+
"author": "string",
|
|
98
|
+
"body": "string",
|
|
99
|
+
"created_date": "iso_string",
|
|
100
|
+
"updated_date": "iso_string"
|
|
101
|
+
}
|
|
102
|
+
],
|
|
103
|
+
"export_metadata": {
|
|
104
|
+
"exported_at": "iso_string",
|
|
105
|
+
"tool_version": "string"
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## File Organization
|
|
111
|
+
|
|
112
|
+
Files are organized by repository and issue state:
|
|
113
|
+
|
|
114
|
+
```
|
|
115
|
+
exports/
|
|
116
|
+
owner1/
|
|
117
|
+
repo1/
|
|
118
|
+
open/
|
|
119
|
+
1-first-issue-title.json
|
|
120
|
+
3-another-open-issue.json
|
|
121
|
+
...
|
|
122
|
+
closed/
|
|
123
|
+
2-closed-issue-title.json
|
|
124
|
+
4-resolved-issue.json
|
|
125
|
+
...
|
|
126
|
+
owner2/
|
|
127
|
+
repo2/
|
|
128
|
+
open/
|
|
129
|
+
1-some-open-issue.json
|
|
130
|
+
closed/
|
|
131
|
+
2-some-closed-issue.json
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
**Key Features:**
|
|
135
|
+
- Issues are organized into `open` and `closed` subdirectories based on their current state
|
|
136
|
+
- Filenames use the issue number (not internal ID) for easier identification
|
|
137
|
+
- When an issue state changes, the file is automatically moved to the appropriate directory
|
|
138
|
+
|
|
139
|
+
## Commands
|
|
140
|
+
|
|
141
|
+
### export
|
|
142
|
+
Export GitHub issues to JSON files.
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
github-issue-exporter export [OPTIONS] REPOSITORIES
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
Options:
|
|
149
|
+
- `--output, -o`: Output directory (default: ./exports)
|
|
150
|
+
- `--force, -f`: Force re-export, ignoring timestamps
|
|
151
|
+
- `--state, -s`: Issue state (open, closed, all)
|
|
152
|
+
- `--no-comments`: Skip exporting comments
|
|
153
|
+
- `--concurrent, -c`: Max concurrent repositories (1-10)
|
|
154
|
+
|
|
155
|
+
### cleanup
|
|
156
|
+
Remove files for issues that no longer exist.
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
github-issue-exporter cleanup [OPTIONS] REPOSITORY
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### config
|
|
163
|
+
Manage configuration and credentials.
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
github-issue-exporter config [OPTIONS]
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
### --version
|
|
170
|
+
Show version information.
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
github-issue-exporter --version
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
## Requirements
|
|
177
|
+
|
|
178
|
+
- Python 3.11+
|
|
179
|
+
- GitHub Personal Access Token (for private repos or higher rate limits)
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
# GitHub Issue Exporter Tool Architecture Plan
|
|
2
|
+
|
|
3
|
+
## High-Level Overview
|
|
4
|
+
A command-line tool that exports GitHub issues to individual JSON files, with incremental updates and credential management. Supports multiple repositories with per-repo configuration.
|
|
5
|
+
|
|
6
|
+
## Core Components
|
|
7
|
+
|
|
8
|
+
### 1. Configuration Manager
|
|
9
|
+
- **Purpose**: Handle credential storage and retrieval for multiple repositories
|
|
10
|
+
- **Location**: `~/.config/github-issue-exporter-tool/config.json`
|
|
11
|
+
- **Responsibilities**:
|
|
12
|
+
- Create config directory if it doesn't exist
|
|
13
|
+
- Store/retrieve GitHub tokens per repository or globally
|
|
14
|
+
- Handle config file encryption/decryption for security
|
|
15
|
+
- Validate stored credentials
|
|
16
|
+
- Manage per-repository settings and preferences
|
|
17
|
+
|
|
18
|
+
### 2. Authentication Handler
|
|
19
|
+
- **Purpose**: Manage GitHub API authentication across repositories
|
|
20
|
+
- **Responsibilities**:
|
|
21
|
+
- Detect if repository is private (via API call)
|
|
22
|
+
- Prompt for credentials if needed and not stored for specific repo
|
|
23
|
+
- Test credential validity before proceeding
|
|
24
|
+
- Handle token-based and basic auth methods
|
|
25
|
+
- Store new credentials via Configuration Manager
|
|
26
|
+
- Support both repo-specific and global authentication tokens
|
|
27
|
+
|
|
28
|
+
### 3. File System Manager
|
|
29
|
+
- **Purpose**: Handle file operations and naming with repository organization
|
|
30
|
+
- **Responsibilities**:
|
|
31
|
+
- Generate slugified filenames from issue titles
|
|
32
|
+
- Check for existing files with matching ID prefix (ignore title part)
|
|
33
|
+
- Create output directory structure (organized by repository)
|
|
34
|
+
- Handle file reading/writing operations
|
|
35
|
+
- Implement safe file updates (temp file → rename pattern)
|
|
36
|
+
- Manage repository-specific export directories
|
|
37
|
+
|
|
38
|
+
### 4. GitHub API Client (HTTPX-based)
|
|
39
|
+
- **Purpose**: Interface with GitHub REST API using async HTTP client
|
|
40
|
+
- **Responsibilities**:
|
|
41
|
+
- Fetch repository information with async httpx requests
|
|
42
|
+
- Retrieve issues list with pagination using async operations
|
|
43
|
+
- Fetch individual issue details concurrently
|
|
44
|
+
- Retrieve comments for each issue with pagination
|
|
45
|
+
- Handle rate limiting and retries with exponential backoff
|
|
46
|
+
- Parse API responses into internal data structures
|
|
47
|
+
- Support multiple concurrent repository operations
|
|
48
|
+
- Manage connection pooling and timeout configurations
|
|
49
|
+
|
|
50
|
+
### 5. Data Transformer
|
|
51
|
+
- **Purpose**: Convert API data to desired JSON format
|
|
52
|
+
- **Responsibilities**:
|
|
53
|
+
- Map GitHub API response fields to output schema
|
|
54
|
+
- Extract and format issue metadata (ID, author, state, title, body, labels, assignee, dates)
|
|
55
|
+
- Process comments array with ID, author, message body
|
|
56
|
+
- Handle missing/null fields gracefully
|
|
57
|
+
- Ensure consistent date formatting
|
|
58
|
+
- Include repository context in exported data
|
|
59
|
+
|
|
60
|
+
### 6. Export Engine
|
|
61
|
+
- **Purpose**: Orchestrate the export process
|
|
62
|
+
- **Responsibilities**:
|
|
63
|
+
- Coordinate between all other components
|
|
64
|
+
- Implement incremental update logic per repository
|
|
65
|
+
- Handle batch processing of issues
|
|
66
|
+
- Provide progress feedback to user
|
|
67
|
+
- Manage error handling and recovery
|
|
68
|
+
- Support parallel processing of multiple repositories
|
|
69
|
+
|
|
70
|
+
### 7. CLI Interface (Typer-based)
|
|
71
|
+
- **Purpose**: Handle command-line interaction using Typer framework
|
|
72
|
+
- **Responsibilities**:
|
|
73
|
+
- Define command structure with automatic help generation via Typer
|
|
74
|
+
- Parse command-line arguments (repo URLs, output directory, batch mode, etc.)
|
|
75
|
+
- Display rich progress indicators and status using Rich console
|
|
76
|
+
- Handle user prompts for credentials with Rich prompts
|
|
77
|
+
- Show summary statistics per repository and overall with Rich tables
|
|
78
|
+
- Provide comprehensive help and usage information
|
|
79
|
+
- Support batch mode for multiple repositories
|
|
80
|
+
- Handle subcommands for different operations (export, config, auth)
|
|
81
|
+
|
|
82
|
+
## Data Flow
|
|
83
|
+
|
|
84
|
+
1. **Initialization**
|
|
85
|
+
- Parse CLI arguments (single repo, multiple repos, or config file with repo list)
|
|
86
|
+
- Load existing configuration
|
|
87
|
+
- Validate output directory structure
|
|
88
|
+
|
|
89
|
+
2. **Authentication**
|
|
90
|
+
- For each repository:
|
|
91
|
+
- Check if repo is private
|
|
92
|
+
- Load or prompt for credentials (repo-specific or global)
|
|
93
|
+
- Validate API access
|
|
94
|
+
|
|
95
|
+
3. **Discovery**
|
|
96
|
+
- For each repository:
|
|
97
|
+
- Fetch repository metadata
|
|
98
|
+
- Retrieve issues list (all pages)
|
|
99
|
+
- Scan existing export files in repo-specific directory
|
|
100
|
+
|
|
101
|
+
4. **Processing**
|
|
102
|
+
- For each repository and issue:
|
|
103
|
+
- Check if existing file needs update (compare timestamps)
|
|
104
|
+
- Fetch issue details and comments if needed
|
|
105
|
+
- Transform data to target format
|
|
106
|
+
- Write to appropriately named file in repo directory
|
|
107
|
+
|
|
108
|
+
5. **Completion**
|
|
109
|
+
- Display summary statistics per repository and overall
|
|
110
|
+
- Handle any errors or warnings
|
|
111
|
+
|
|
112
|
+
## File Naming Strategy
|
|
113
|
+
- Directory structure: `{output_dir}/{repo_owner}/{repo_name}/`
|
|
114
|
+
- File pattern: `{issue_id}-{slugified_title}.json`
|
|
115
|
+
- Slugification rules: lowercase, replace spaces/special chars with hyphens, remove consecutive hyphens
|
|
116
|
+
- Update detection: glob pattern `{issue_id}-*.json` to find existing files regardless of title changes
|
|
117
|
+
|
|
118
|
+
## Configuration Schema
|
|
119
|
+
```json
|
|
120
|
+
{
|
|
121
|
+
"global_settings": {
|
|
122
|
+
"default_output_dir": "path",
|
|
123
|
+
"concurrent_repos": 3,
|
|
124
|
+
"api_rate_limit_buffer": 100
|
|
125
|
+
},
|
|
126
|
+
"authentication": {
|
|
127
|
+
"global_token": "encrypted_token",
|
|
128
|
+
"repo_specific": {
|
|
129
|
+
"owner/repo-name": {
|
|
130
|
+
"token": "encrypted_token",
|
|
131
|
+
"username": "encrypted_username",
|
|
132
|
+
"last_export": "iso_date"
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
"repositories": {
|
|
137
|
+
"owner/repo-name": {
|
|
138
|
+
"output_dir": "custom_path",
|
|
139
|
+
"last_export": "iso_date",
|
|
140
|
+
"include_closed": true,
|
|
141
|
+
"export_comments": true
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
## Output JSON Schema
|
|
148
|
+
```json
|
|
149
|
+
{
|
|
150
|
+
"repository": {
|
|
151
|
+
"owner": "string",
|
|
152
|
+
"name": "string",
|
|
153
|
+
"full_name": "string"
|
|
154
|
+
},
|
|
155
|
+
"issue": {
|
|
156
|
+
"id": "number",
|
|
157
|
+
"number": "number",
|
|
158
|
+
"author": "string",
|
|
159
|
+
"state": "string",
|
|
160
|
+
"title": "string",
|
|
161
|
+
"body": "string",
|
|
162
|
+
"labels": ["string"],
|
|
163
|
+
"assignee": "string|null",
|
|
164
|
+
"assignees": ["string"],
|
|
165
|
+
"milestone": "string|null",
|
|
166
|
+
"created_date": "iso_string",
|
|
167
|
+
"updated_date": "iso_string",
|
|
168
|
+
"closed_date": "iso_string|null"
|
|
169
|
+
},
|
|
170
|
+
"comments": [
|
|
171
|
+
{
|
|
172
|
+
"id": "number",
|
|
173
|
+
"author": "string",
|
|
174
|
+
"body": "string",
|
|
175
|
+
"created_date": "iso_string",
|
|
176
|
+
"updated_date": "iso_string"
|
|
177
|
+
}
|
|
178
|
+
],
|
|
179
|
+
"export_metadata": {
|
|
180
|
+
"exported_at": "iso_string",
|
|
181
|
+
"tool_version": "string"
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
## CLI Usage Examples
|
|
187
|
+
```bash
|
|
188
|
+
# Single repository
|
|
189
|
+
github-issue-exporter owner/repo
|
|
190
|
+
|
|
191
|
+
# Multiple repositories
|
|
192
|
+
github-issue-exporter owner/repo1 owner/repo2 owner/repo3
|
|
193
|
+
|
|
194
|
+
# From config file
|
|
195
|
+
github-issue-exporter --config repos.txt
|
|
196
|
+
|
|
197
|
+
# Custom output directory
|
|
198
|
+
github-issue-exporter owner/repo --output /path/to/exports
|
|
199
|
+
|
|
200
|
+
# Force re-export (ignore timestamps)
|
|
201
|
+
github-issue-exporter owner/repo --force
|
|
202
|
+
|
|
203
|
+
# Export only open issues
|
|
204
|
+
github-issue-exporter owner/repo --state open
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
## Error Handling Strategy
|
|
208
|
+
- Network errors: retry with exponential backoff
|
|
209
|
+
- Authentication errors: re-prompt for credentials per repository
|
|
210
|
+
- File system errors: clear error messages with suggested fixes
|
|
211
|
+
- API rate limiting: respect headers and wait appropriately
|
|
212
|
+
- Partial failures: continue processing other repositories/issues, report at end
|
|
213
|
+
- Repository access errors: skip inaccessible repos, continue with others
|
|
214
|
+
|
|
215
|
+
## Technology Stack
|
|
216
|
+
- **Language**: Python 3.11+
|
|
217
|
+
- **Package Manager**: `uv` for fast dependency management and virtual environments
|
|
218
|
+
- **CLI Framework**: `typer` for command-line interface with automatic help generation
|
|
219
|
+
- **Output/Formatting**: `rich` for beautiful terminal output, progress bars, and error formatting
|
|
220
|
+
- **HTTP Client**: `httpx` for async-capable HTTP requests to GitHub API
|
|
221
|
+
- **Additional Dependencies**:
|
|
222
|
+
- JSON handling (built-in `json` module)
|
|
223
|
+
- File system operations (built-in `pathlib`)
|
|
224
|
+
- Async processing (`asyncio` for concurrent API calls)
|
|
225
|
+
- Encryption for credentials (`cryptography` library)
|
|
226
|
+
- Configuration management (built-in or `pydantic` for validation)
|
|
227
|
+
|
|
228
|
+
## Implementation Considerations
|
|
229
|
+
- Security: Encrypt stored credentials, clear sensitive data from memory
|
|
230
|
+
- Performance: Async HTTP calls with `httpx`, efficient file I/O, parallel repository processing
|
|
231
|
+
- Scalability: Handle large numbers of repositories and issues efficiently
|
|
232
|
+
- Rich UI: Progress bars, spinners, and colored output using `rich` console
|
|
233
|
+
- Type Safety: Use type hints throughout for better development experience
|
|
234
|
+
|
|
235
|
+
## Multi-Repository Features
|
|
236
|
+
- Batch processing with progress indicators
|
|
237
|
+
- Repository-specific configuration overrides
|
|
238
|
+
- Parallel processing with configurable concurrency limits
|
|
239
|
+
- Centralized credential management with per-repo overrides
|
|
240
|
+
- Aggregated reporting across all processed repositories
|
|
241
|
+
- Resume capability for interrupted batch operations
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "github-issue-exporter"
|
|
3
|
+
version = "0.0.1"
|
|
4
|
+
description = "Export GitHub issues to individual JSON files with incremental updates and credential management"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.11"
|
|
7
|
+
dependencies = [
|
|
8
|
+
"cryptography>=45.0.3",
|
|
9
|
+
"httpx>=0.28.1",
|
|
10
|
+
"pydantic>=2.11.5",
|
|
11
|
+
"rich>=14.0.0",
|
|
12
|
+
"typer>=0.16.0",
|
|
13
|
+
]
|
|
14
|
+
authors = [
|
|
15
|
+
{name = "Adam McKay", email = "adam@beepboop.digital"}
|
|
16
|
+
]
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
[project.scripts]
|
|
20
|
+
github-issue-exporter = "github_issue_exporter.cli.main:app"
|
|
21
|
+
|
|
22
|
+
[project.urls]
|
|
23
|
+
Homepage = "https://github.com/Beep-Boop-Digital/github-issue-exporter"
|
|
24
|
+
Repository = "https://github.com/Beep-Boop-Digital/github-issue-exporter"
|
|
25
|
+
Issues = "https://github.com/Beep-Boop-Digital/github-issue-exporter/issues"
|
|
26
|
+
|
|
27
|
+
[build-system]
|
|
28
|
+
requires = ["hatchling"]
|
|
29
|
+
build-backend = "hatchling.build"
|
|
30
|
+
|
|
31
|
+
[tool.hatch.build.targets.wheel]
|
|
32
|
+
packages = ["src/github_issue_exporter"]
|