issuer 0.1.0 → 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.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/README.adoc +1 -1
  3. data/issuer.gemspec +5 -9
  4. data/lib/issuer/cli.rb +5 -5
  5. data/lib/issuer/issue.rb +26 -13
  6. data/lib/issuer/sites/base.rb +2 -1
  7. data/lib/issuer/sites/github.rb +29 -4
  8. metadata +2 -36
  9. data/.rspec +0 -3
  10. data/.vale/config/vocabularies/issuer/accept.txt +0 -63
  11. data/.vale/config/vocabularies/issuer/reject.txt +0 -21
  12. data/.vale.ini +0 -42
  13. data/Dockerfile +0 -43
  14. data/Rakefile +0 -70
  15. data/bin/console +0 -0
  16. data/bin/issuer +0 -13
  17. data/bin/setup +0 -0
  18. data/examples/README.adoc +0 -56
  19. data/scripts/build.sh +0 -40
  20. data/scripts/lint-docs.sh +0 -64
  21. data/scripts/manage-runs.rb +0 -175
  22. data/scripts/pre-commit-template.sh +0 -54
  23. data/scripts/publish.sh +0 -92
  24. data/scripts/setup-vale.sh +0 -59
  25. data/specs/tests/README.adoc +0 -451
  26. data/specs/tests/check-github-connectivity.sh +0 -130
  27. data/specs/tests/cleanup-github-tests.sh +0 -374
  28. data/specs/tests/github-api/01-auth-connection.yml +0 -21
  29. data/specs/tests/github-api/02-basic-issues.yml +0 -90
  30. data/specs/tests/github-api/03-milestone-tests.yml +0 -58
  31. data/specs/tests/github-api/04-label-tests.yml +0 -98
  32. data/specs/tests/github-api/05-assignment-tests.yml +0 -55
  33. data/specs/tests/github-api/06-automation-tests.yml +0 -102
  34. data/specs/tests/github-api/07-error-tests.yml +0 -29
  35. data/specs/tests/github-api/08-complex-tests.yml +0 -197
  36. data/specs/tests/github-api/config.yml.example +0 -17
  37. data/specs/tests/rspec/cli_spec.rb +0 -127
  38. data/specs/tests/rspec/issue_spec.rb +0 -184
  39. data/specs/tests/rspec/issuer_spec.rb +0 -5
  40. data/specs/tests/rspec/ops_spec.rb +0 -124
  41. data/specs/tests/rspec/spec_helper.rb +0 -54
  42. data/specs/tests/run-github-api-tests.sh +0 -424
@@ -1,451 +0,0 @@
1
- = GitHub API Integration Testing Suite
2
- :toc: macro
3
- :toclevels: 3
4
-
5
- This directory contains comprehensive tests for the issuer CLI's GitHub API integration functionality.
6
-
7
- toc::[]
8
-
9
- == Overview
10
-
11
- The testing suite validates:
12
-
13
- * GitHub API authentication and connectivity
14
- * Issue creation with various configurations
15
- * Milestone/version management
16
- * Label/tag management
17
- * Assignment functionality
18
- * Automation flags (`--auto-metadata`, etc.)
19
- * Error handling and edge cases
20
- * Run logging and artifact tracking
21
-
22
- == Artifact Logging System
23
-
24
- The issuer CLI automatically logs all created artifacts (issues, milestones, labels) to `~/.config/issuer/logs/` directory (user-wide) for tracking and potential cleanup operations.
25
-
26
- === How It Works
27
-
28
- When you run issuer with live operations (not `--dry`):
29
-
30
- 1. *Run Tracking*: A unique run ID is generated (example: `run_20250711_143022_abcd`)
31
- 2. *Artifact Logging*: All created issues, milestones, and labels are logged with metadata
32
- 3. *Status Tracking*: Run status is tracked (`in_progress`, `completed`, `failed`)
33
- 4. *JSON Storage*: All data is stored in JSON format in `~/.config/issuer/logs/<RUN_ID>.json`
34
-
35
- === Log Structure
36
-
37
- Each run log contains:
38
-
39
- [source,json]
40
- ----
41
- {
42
- "run_id": "run_20250711_143022_abcd",
43
- "started_at": "2025-07-11T14:30:22Z",
44
- "status": "completed",
45
- "metadata": { "issues_planned": 15 },
46
- "artifacts": {
47
- "issues": [
48
- {
49
- "number": 42,
50
- "title": "Fix authentication bug",
51
- "url": "https://github.com/user/repo/issues/42",
52
- "created_at": "2025-07-11T14:30:25Z",
53
- "repository": "user/repo"
54
- }
55
- ],
56
- "milestones": [ ... ],
57
- "labels": [ ... ]
58
- },
59
- "summary": {
60
- "issues_created": 15,
61
- "milestones_created": 2,
62
- "labels_created": 5
63
- },
64
- "completed_at": "2025-07-11T14:32:15Z"
65
- }
66
- ----
67
-
68
- === Testing with Logging
69
-
70
- During test runs, artifacts are automatically logged. This enables:
71
-
72
- * *Verification*: Confirm that all expected artifacts were created
73
- * *Debugging*: Track what was created when tests fail
74
- * *Cleanup Planning*: Prepare for future cleanup script development
75
-
76
- The test cleanup scripts can read these logs to understand what needs to be cleaned up.
77
-
78
- === Run Management Script
79
-
80
- A standalone script is available for managing cached runs:
81
-
82
- [source,bash]
83
- ----
84
- # List all cached runs
85
- bundle exec ruby scripts/manage-runs.rb list
86
-
87
- # List recent runs only (last 10)
88
- bundle exec ruby scripts/manage-runs.rb list --recent
89
-
90
- # Show detailed information for a specific run
91
- bundle exec ruby scripts/manage-runs.rb show run_20250711_180124_97d1f1f3
92
-
93
- # Clean all log files (use with caution)
94
- bundle exec ruby scripts/manage-runs.rb clean-logs
95
- ----
96
-
97
- This script provides a convenient way to inspect what artifacts were created during testing without needing to manually parse JSON files.
98
-
99
- == Quick Start
100
-
101
- === 1. Setup Configuration
102
-
103
- Copy the example config file and customize it:
104
-
105
- [source,bash]
106
- ----
107
- cp specs/tests/github-api/config.yml.example specs/tests/github-api/config.yml
108
- ----
109
-
110
- Edit `config.yml` with your test repository and GitHub username:
111
-
112
- [source,yaml]
113
- ----
114
- test_repo: "your-username/issuer-test-repo"
115
- test_username: "your-username"
116
- cleanup_after_tests: false
117
- dry_run_first: true
118
- verbose_output: false
119
- ----
120
-
121
- === 2. Set GitHub Token
122
-
123
- Ensure you have a GitHub personal access token set:
124
-
125
- [source,bash]
126
- ----
127
- export GITHUB_TOKEN="your_github_token_here"
128
- # or any of: GITHUB_ACCESS_TOKEN, ISSUER_API_TOKEN, ISSUER_GITHUB_TOKEN
129
- ----
130
-
131
- === 3. Create Test Repository
132
-
133
- Create a GitHub repository for testing (or use an existing one):
134
-
135
- [source,bash]
136
- ----
137
- gh repo create issuer-test-repo --public --description "Test repository for issuer CLI"
138
- ----
139
-
140
- === 4. Run Tests
141
-
142
- Execute the complete test suite:
143
-
144
- [source,bash]
145
- ----
146
- ./specs/tests/run-github-api-tests.sh
147
- ----
148
-
149
- Or run with options:
150
-
151
- [source,bash]
152
- ----
153
- ./specs/tests/run-github-api-tests.sh --verbose --no-dry-run
154
- ./specs/tests/run-github-api-tests.sh --help # Show all options
155
- ----
156
-
157
- == Test Files
158
-
159
- === Core Functionality Tests
160
-
161
- * *`01-auth-connection.yml`*: Basic authentication and API connectivity
162
- * *`02-basic-issues.yml`*: Simple issue creation, markdown support, special characters
163
- * *`03-milestone-tests.yml`*: Milestone creation and assignment
164
- * *`04-label-tests.yml`*: Label creation, default/append logic
165
- * *`05-assignment-tests.yml`*: User assignment functionality
166
-
167
- === Advanced Tests
168
-
169
- * *`06-automation-tests.yml`*: Automation flags (`--auto-metadata`, `--auto-versions`, etc.)
170
- * *`07-error-tests.yml`*: Error handling scenarios (invalid repo, etc.)
171
- * *`08-complex-tests.yml`*: Complex integration scenarios with multiple features
172
-
173
- === Configuration
174
-
175
- * *`config.yml.example`*: Template configuration file
176
- * *`config.yml`*: Your customized configuration (create from example)
177
-
178
- == Test Runner Features
179
-
180
- === Command Line Options
181
-
182
- [source,bash]
183
- ----
184
- ./specs/tests/run-github-api-tests.sh [options]
185
-
186
- Options:
187
- --help, -h Show help message
188
- --config FILE Use specific config file
189
- --verbose, -v Verbose output
190
- --no-dry-run Skip dry-run tests
191
- --cleanup Clean up after tests
192
- --non-interactive Run without prompts
193
- ----
194
-
195
- === Test Categories
196
-
197
- 1. *Dry-run tests*: Validate IMYML parsing without API calls
198
- 2. *Basic functionality*: Core issue creation features
199
- 3. *Advanced features*: Milestones, labels, assignments
200
- 4. *Automation*: Testing `--auto-*` flags
201
- 5. *Error scenarios*: Invalid inputs and error handling
202
- 6. *Edge cases*: Unicode, large content, special characters
203
-
204
- == Results and Logging
205
-
206
- === Test Results
207
-
208
- Results are saved to `specs/tests/results/` with timestamps:
209
-
210
- ----
211
- specs/tests/results/
212
- ├── test_results_20250711_143022.log # Main results log
213
- ├── 01-auth-connection_20250711_143022.log # Individual test output
214
- ├── 02-basic-issues_20250711_143022.log
215
- └── ...
216
- ----
217
-
218
- === Success Criteria
219
-
220
- Tests are considered successful when:
221
-
222
- * ✅ All issues are created without errors
223
- * ✅ Milestones are created when needed
224
- * ✅ Labels are created when needed
225
- * ✅ Assignments work correctly
226
- * ✅ Automation flags work as expected
227
- * ✅ Error scenarios fail gracefully
228
-
229
- == Cleanup
230
-
231
- === Automated Cleanup
232
-
233
- Run the cleanup script to remove test artifacts:
234
-
235
- [source,bash]
236
- ----
237
- ./specs/tests/cleanup-github-tests.sh your-username/test-repo
238
- ----
239
-
240
- Options:
241
-
242
- [source,bash]
243
- ----
244
- ./specs/tests/cleanup-github-tests.sh --help # Show help
245
- ./specs/tests/cleanup-github-tests.sh --dry-run your-repo # Show what would be cleaned
246
- ./specs/tests/cleanup-github-tests.sh --issues-only your-repo # Only clean issues
247
- ----
248
-
249
- === Manual Cleanup
250
-
251
- The cleanup script generates commands for manual execution if needed.
252
-
253
- Test artifacts to clean up:
254
- * Issues with `[TEST]` in the title
255
- * Milestones with `test-*` patterns
256
- * Labels with `test-*` patterns
257
-
258
- == Continuous Integration
259
-
260
- === Pre-commit Testing
261
-
262
- Run basic tests before committing:
263
-
264
- [source,bash]
265
- ----
266
- ./specs/tests/run-github-api-tests.sh --no-dry-run --non-interactive
267
- ----
268
-
269
- === Release Testing
270
-
271
- Run full test suite before releases:
272
-
273
- [source,bash]
274
- ----
275
- ./specs/tests/run-github-api-tests.sh --verbose --cleanup
276
- ----
277
-
278
- == Troubleshooting
279
-
280
- === Common Issues
281
-
282
- 1. *Authentication Errors*
283
- +
284
- ----
285
- GitHub token not found in environment variables
286
- ----
287
- +
288
- Solution: Set `GITHUB_TOKEN` or other token environment variables
289
-
290
- 2. *Repository Access Errors*
291
- +
292
- ----
293
- Not Found (HTTP 404)
294
- ----
295
- +
296
- Solution: Verify repository name and token permissions
297
-
298
- 3. *Rate Limiting*
299
- +
300
- ----
301
- API rate limit exceeded
302
- ----
303
- +
304
- Solution: Wait or use a token with higher rate limits
305
-
306
- 4. *Permission Errors*
307
- +
308
- ----
309
- Resource not accessible by integration
310
- ----
311
- +
312
- Solution: Ensure token has Issues read/write permissions
313
-
314
- === Debug Mode
315
-
316
- Run tests with verbose output to see detailed information:
317
-
318
- [source,bash]
319
- ----
320
- ./specs/tests/run-github-api-tests.sh --verbose
321
- ----
322
-
323
- === Individual Test Execution
324
-
325
- Run individual test files manually:
326
-
327
- [source,bash]
328
- ----
329
- # Update test file with your repo first
330
- sed -i 's/your-username\/issuer-test-repo/yourusername\/yourrepo/g' specs/tests/github-api/01-auth-connection.yml
331
-
332
- # Run the test
333
- issuer specs/tests/github-api/01-auth-connection.yml --dry
334
- issuer specs/tests/github-api/01-auth-connection.yml
335
- ----
336
-
337
- == Test Development
338
-
339
- === Adding New Tests
340
-
341
- 1. Create a new `.yml` file in `specs/tests/github-api/`
342
- 2. Follow the naming convention: `NN-description.yml`
343
- 3. Use `[TEST]` prefix in issue summaries
344
- 4. Update the test runner script to include the new test
345
- 5. Document expected behavior in issue bodies
346
-
347
- === Test File Template
348
-
349
- [source,yaml]
350
- ----
351
- $meta:
352
- proj: your-username/issuer-test-repo
353
-
354
- issues:
355
- - summ: "[TEST] Description of what this tests"
356
- body: |
357
- # Test Description
358
-
359
- **What this tests:**
360
- - Feature 1
361
- - Feature 2
362
-
363
- **Expected behavior:**
364
- - Expected outcome 1
365
- - Expected outcome 2
366
-
367
- **Test commands:**
368
- ```bash
369
- issuer test-file.yml --dry
370
- issuer test-file.yml --auto-metadata
371
- ```
372
- ----
373
-
374
- == Integration with CI/CD
375
-
376
- === GitHub Actions
377
-
378
- Example workflow for automated testing:
379
-
380
- [source,yaml]
381
- ----
382
- name: GitHub API Integration Tests
383
-
384
- on:
385
- push:
386
- branches: [ main ]
387
- pull_request:
388
- branches: [ main ]
389
-
390
- jobs:
391
- test:
392
- runs-on: ubuntu-latest
393
- steps:
394
- - uses: actions/checkout@v3
395
- - name: Set up Ruby
396
- uses: ruby/setup-ruby@v1
397
- with:
398
- bundler-cache: true
399
- - name: Run GitHub API tests
400
- env:
401
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
402
- run: |
403
- # Setup test configuration
404
- cp specs/tests/github-api/config.yml.example specs/tests/github-api/config.yml
405
- sed -i 's/your-username/github-actions-test/g' specs/tests/github-api/config.yml
406
-
407
- # Run tests
408
- ./specs/tests/run-github-api-tests.sh --non-interactive --cleanup
409
- ----
410
-
411
- === Local Development
412
-
413
- Set up a git hook for pre-commit testing:
414
-
415
- [source,bash]
416
- ----
417
- # .git/hooks/pre-commit
418
- #!/bin/sh
419
- echo "Running GitHub API integration tests..."
420
- ./specs/tests/run-github-api-tests.sh --no-dry-run --non-interactive
421
- ----
422
-
423
- == Security Considerations
424
-
425
- 1. *Token Security*: Never commit GitHub tokens to version control
426
- 2. *Test Repository*: Use a dedicated test repository, not production repos
427
- 3. *Cleanup*: Always clean up test artifacts to avoid clutter
428
- 4. *Rate Limits*: Be mindful of GitHub API rate limits during testing
429
- 5. *Permissions*: Use tokens with minimal required permissions
430
-
431
- == Contributing
432
-
433
- When contributing to the test suite:
434
-
435
- 1. *Add tests for new features*: Every new feature should have corresponding tests
436
- 2. *Update existing tests*: Modify tests when changing functionality
437
- 3. *Test edge cases*: Include tests for error conditions and edge cases
438
- 4. *Document expectations*: Clearly document what each test validates
439
- 5. *Clean up*: Ensure tests can be cleaned up properly
440
-
441
- == Support
442
-
443
- For issues with the testing suite:
444
-
445
- 1. Check the troubleshooting section above
446
- 2. Review test logs in `specs/tests/results/`
447
- 3. Run individual tests manually for debugging
448
- 4. Open an issue in the main repository with:
449
- * Test configuration used
450
- * Error messages
451
- * Expected vs actual behavior
@@ -1,130 +0,0 @@
1
- #!/usr/bin/env zsh
2
- # Quick GitHub connectivity test for issuer CLI
3
-
4
- set -e
5
-
6
- # Colors for output
7
- GREEN='\033[0;32m'
8
- RED='\033[0;31m'
9
- YELLOW='\033[1;33m'
10
- BLUE='\033[0;34m'
11
- NC='\033[0m' # No Color
12
-
13
- print_success() {
14
- echo -e "${GREEN}✅ $1${NC}"
15
- }
16
-
17
- print_error() {
18
- echo -e "${RED}❌ $1${NC}"
19
- }
20
-
21
- print_warning() {
22
- echo -e "${YELLOW}⚠️ $1${NC}"
23
- }
24
-
25
- print_info() {
26
- echo -e "${BLUE}ℹ️ $1${NC}"
27
- }
28
-
29
- echo
30
- echo -e "${BLUE}🔍 GitHub Connectivity Check${NC}"
31
- echo -e "${BLUE}=============================${NC}"
32
- echo
33
-
34
- # Check for GitHub tokens
35
- echo "Checking for GitHub authentication tokens..."
36
- token_found=false
37
-
38
- if [[ -n "$ISSUER_API_TOKEN" ]]; then
39
- print_success "ISSUER_API_TOKEN found (length: ${#ISSUER_API_TOKEN})"
40
- token_found=true
41
- fi
42
-
43
- if [[ -n "$ISSUER_GITHUB_TOKEN" ]]; then
44
- print_success "ISSUER_GITHUB_TOKEN found (length: ${#ISSUER_GITHUB_TOKEN})"
45
- token_found=true
46
- fi
47
-
48
- if [[ -n "$GITHUB_ACCESS_TOKEN" ]]; then
49
- print_success "GITHUB_ACCESS_TOKEN found (length: ${#GITHUB_ACCESS_TOKEN})"
50
- token_found=true
51
- fi
52
-
53
- if [[ -n "$GITHUB_TOKEN" ]]; then
54
- print_success "GITHUB_TOKEN found (length: ${#GITHUB_TOKEN})"
55
- token_found=true
56
- fi
57
-
58
- if [[ "$token_found" == "false" ]]; then
59
- print_error "No GitHub tokens found!"
60
- echo
61
- print_info "Please set one of the following environment variables:"
62
- echo " export ISSUER_API_TOKEN='your_token_here'"
63
- echo " export ISSUER_GITHUB_TOKEN='your_token_here'"
64
- echo " export GITHUB_ACCESS_TOKEN='your_token_here'"
65
- echo " export GITHUB_TOKEN='your_token_here'"
66
- echo
67
- exit 1
68
- fi
69
-
70
- echo
71
-
72
- # Test issuer CLI basic functionality
73
- echo "Testing issuer CLI availability..."
74
- if command -v issuer >/dev/null 2>&1; then
75
- print_success "issuer command found"
76
-
77
- # Test version
78
- echo -n "Version: "
79
- issuer --version || print_warning "Could not get version"
80
- echo
81
- else
82
- print_error "issuer command not found"
83
- print_info "Make sure issuer is installed and in PATH"
84
- print_info "From project directory: bundle exec bin/issuer --version"
85
- echo
86
- exit 1
87
- fi
88
-
89
- # Test basic GitHub API connectivity using a minimal test
90
- echo "Testing GitHub API connectivity..."
91
-
92
- # Create a minimal test file
93
- test_file=$(mktemp -t issuer-connectivity-test.XXXXXX.yml)
94
- cat > "$test_file" << EOF
95
- \$meta:
96
- proj: octocat/Hello-World # Public GitHub repository for testing
97
-
98
- issues:
99
- - summ: "[CONNECTIVITY-TEST] This is just a connectivity test"
100
- body: |
101
- # GitHub API Connectivity Test
102
-
103
- This is a test to verify that the issuer CLI can connect to GitHub API.
104
-
105
- **This should NOT be created** - we're running in dry-run mode only.
106
- EOF
107
-
108
- echo "Running dry-run test against GitHub API..."
109
- if issuer "$test_file" --dry >/dev/null 2>&1; then
110
- print_success "GitHub API connectivity working!"
111
- else
112
- print_error "GitHub API connectivity failed"
113
- print_info "Try running manually for more details:"
114
- echo " issuer $test_file --dry"
115
- rm -f "$test_file"
116
- exit 1
117
- fi
118
-
119
- # Clean up
120
- rm -f "$test_file"
121
-
122
- echo
123
- print_success "All connectivity checks passed! 🎉"
124
- echo
125
- print_info "You're ready to run the GitHub API integration tests:"
126
- echo " ./specs/tests/run-github-api-tests.sh --help"
127
- echo
128
- print_info "Or run a quick manual test:"
129
- echo " issuer examples/minimal-example.yml --dry"
130
- echo