Skip to content

💥 Rewrite for v4 #120

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Jun 21, 2025
Merged

💥 Rewrite for v4 #120

merged 15 commits into from
Jun 21, 2025

Conversation

stoe
Copy link
Owner

@stoe stoe commented Jun 3, 2025

Note

This release represents a complete architectural rewrite of the action-reporting-cli with significant enhancements and breaking changes.

💥 Breaking Changes

  • Complete rewrite of the codebase architecture
  • Changed entry point from index.js to cli.js
  • Modified module exports structure in package.json
  • Removed deprecated utils/ directory in favor of organized src/ structure
  • Changed API contracts and interfaces

✨ New Features

  • Enhanced Logging System

    • Added Winston-based logging with multiple output levels
    • Implemented spinners with Ora for better UX during long operations
    • Added debug mode with file-based logging
    • Improved warning log usage (🔊 Use warn logging more often)
  • Improved Caching

    • Added dedicated cache management system in cache.js
    • Enhanced performance with persistent API response caching
  • Modular Architecture

    • Created specialized GitHub entity classes (Enterprise, Repository, Owner)
    • Implemented pluggable report formats (CSV, JSON, Markdown)
    • Added options to skip archived/forked repositories
  • User Experience

    • Improved report logic and generation
    • Added messaging to display report and output options
    • Enhanced CLI help text

🧰 Technical Improvements

  • Code Organization

    • Reorganized codebase into logical directories:
      • src/github/: GitHub API interactions
      • src/report/: Report generation logic
      • src/util/: Utility functions
  • Documentation

    • Improved README clarity and usage instructions
    • Added comprehensive contributing guidelines
    • Enhanced inline code documentation
  • Testing Infrastructure

    • Complete rewrite of tests with Jest framework
    • Implemented mocks for core functionality
    • Added unit tests across all components

🐛 Bug Fixes

No specific bug fixes were included in this release as it's a complete rewrite.

🆙 Dependencies

  • Node Requirements

    • Updated Node.js requirement to >=20
    • Updated npm requirement to >=10
  • New Dependencies

    • ora (v8.2.0) for terminal spinners and progress indicators
    • winston (v3.17.0) for advanced logging
  • Updated Core Dependencies

    • @octokit/core to v7.0.2
    • @octokit/plugin-paginate-rest to v13.1.0
    • @octokit/plugin-throttling to v11.0.1
    • got to v14.4.7
    • csv to v6.3.11
    • meow to v13.2.0
    • normalize-url to v8.0.2
  • Updated Dev Dependencies

    • All development dependencies updated to latest versions

📊 File Statistics

  • Added: 25 new JavaScript files
  • Removed: 3 files (index.js, utils/reporting.js, utils/wait.js)
  • Total Changes: 15,557 insertions, 2,551 deletions across 54 files

🔄 Migration Guide

Users upgrading from v3.x will need to:

  1. Update Node.js to version 20 or later and npm to version 10 or later

  2. Update imports/requires to use the new module structure:

    // Old imports (v3)
    import Reporting from '@stoe/action-reporting-cli'
    
    // New imports (v4)
    import Report from '@stoe/action-reporting-cli'
    // or for specific components
    import {CSVReporter} from '@stoe/action-reporting-cli/report'
    import {Repository} from '@stoe/action-reporting-cli/github'
  3. Review the updated CLI options and parameters

  4. Update any code that directly uses the library's exports

See the documentation for detailed migration instructions.

@stoe stoe self-assigned this Jun 3, 2025
@stoe stoe added bug 🐛 Something not working? feature-request 🚧 Want something new? dependency 🤖 Dependency update (dependabot) labels Jun 21, 2025
@stoe stoe marked this pull request as ready for review June 21, 2025 10:37
@stoe stoe requested a review from Copilot June 21, 2025 10:37
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR is a complete v4 architectural rewrite of the action-reporting-cli, introducing a modular codebase, new CLI entry point, enhanced logging, caching, and pluggable report formats.

  • Swapped out index.js for new cli.js as entry point
  • Reorganized into src/github/, src/report/, and src/util/ modules
  • Added Winston-based logging, persistent caching, and Jest tests

Reviewed Changes

Copilot reviewed 20 out of 54 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
test/cli.test.js Added placeholder tests for CLI help/version flags
test/mocks/fs.js Created an fs mock for node file operations
src/util/log.js New Log class implementing Winston and Ora
src/util/cache.js New Cache class for persistent API response caching
src/report/reporter.js Base Reporter class supporting multiple formats
src/report/markdown.js Markdown report generator with table and unique uses extraction
src/github/owner.js Owner class fetching repositories via GraphQL
src/github/base.js Base class initializing Octokit and logger
package.json Updated to v4, new exports field and updated dependencies
Comments suppressed due to low confidence (2)

test/cli.test.js:10

  • These tests are currently placeholders. Implement assertions for the --help and --version flags to ensure CLI functionality is covered.
    // TODO: Implement test logic

test/mocks/fs.js:2

  • The file provides mocks for fs/promises methods, not input validation. Update the comment to accurately describe its purpose.
 * Unit tests for input validation functions.

@stoe stoe merged commit 5efecca into main Jun 21, 2025
7 checks passed
@stoe stoe deleted the stoe/v4 branch June 21, 2025 10:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something not working? dependency 🤖 Dependency update (dependabot) feature-request 🚧 Want something new?
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Markdown report generation fails for a big org => ERROR: Cannot read properties of undefined (reading 'map')
1 participant