Commit graph

10 commits

Author SHA1 Message Date
google-labs-jules[bot]
7adfff1d0d feat: Add TDD framework and fix build error
This commit introduces a TDD testing framework for the `collect` commands and resolves a build failure.

- A `TDD/` directory has been added to house tests for the `collect` commands.
- An environment variable `BORG_PLEXSUS=0` has been implemented to enable a mock mode, which prevents external network calls during testing.
- The `collect` commands have been updated to use the command's output streams, allowing for output capturing in tests.
- A `pkg/mocks` package has been added to provide mock implementations for testing.
- The `.gitignore` file has been updated to exclude generated `.datanode` files.
- The "flag redefined" build error has been fixed by refactoring the root command initialization in `cmd/root.go` to prevent duplicate flag definitions.
2025-11-02 18:11:04 +00:00
4cb80d970e
Merge branch 'main' into feature-tdd-testing-with-mocking 2025-11-02 17:59:08 +00:00
google-labs-jules[bot]
74b7ba25a3 feat: Add TDD tests with mocking for collect commands
This commit introduces a TDD testing framework for the `collect` commands.

- A `TDD/` directory has been added to house the tests.
- An environment variable `BORG_PLEXSUS=0` has been implemented to enable a mock mode, which prevents external network calls during testing.
- The `collect` commands have been updated to use the command's output streams, allowing for output capturing in tests.
- A `pkg/mocks` package has been added to provide mock implementations for testing.
- The `.gitignore` file has been updated to exclude generated `.datanode` files.
2025-11-02 17:57:09 +00:00
28438e1e96 Merge pull request #10 from Snider/feature-non-interactive-quotes
feat: Implement non-interactive quote display
2025-11-02 17:56:13 +00:00
google-labs-jules[bot]
43f3904072 refactor: Improve code quality, testability, and CI
This commit addresses several issues identified in a code review to improve the overall quality and robustness of the application.

Key changes include:
- Added safe type assertions with `nil` checks when retrieving the logger from the context to prevent panics.
- Moved the `bar.Finish()` call to be inside the loop in the `all` command, so each progress bar finishes after its corresponding repository is cloned.
- Added a check for context cancellation at the start of the pagination loop in the GitHub client to prevent unnecessary API calls.
- Ensured the authenticated client is used consistently, even when falling back to the organization endpoint.
- Added `nil` checks for the progress bar parameter in the `website` and `pwa` packages to prevent panics.
- Updated the `golang.org/x/oauth2` dependency to a patched release to address a reported vulnerability.
2025-11-02 01:54:23 +00:00
google-labs-jules[bot]
beaeb04f03 feat: Add authenticated GitHub access and structured logging
This commit introduces two key improvements to the application:

1.  **Authenticated GitHub API Access:** The GitHub client now uses a personal access token (PAT) from the `GITHUB_TOKEN` environment variable if it is available. This increases the rate limit for GitHub API requests, making the tool more robust for users who need to collect a large number of repositories.

2.  **Structured Logging:** The application now uses the standard library's `slog` package for structured logging. A `--verbose` flag has been added to the root command to control the log level, allowing for more detailed output when needed. This makes the application's output more consistent and easier to parse.
2025-11-02 00:59:46 +00:00
google-labs-jules[bot]
19f6a95964 refactor: Improve code quality, testability, and CI
This commit addresses several issues identified in a code review to improve the overall quality and robustness of the application.

Key changes include:
- Refactored `cmd.Execute()` to return an error instead of calling `os.Exit`, making the application more testable.
- Fixed critical issues in `cmd/main_test.go`, including renaming `TestMain` to avoid conflicts and removing the brittle E2E test.
- Improved the GitHub API client in `pkg/github/github.go` by:
  - Fixing a resource leak where an HTTP response body was not being closed.
  - Restoring a parameterized function to improve testability.
  - Adding support for `context.Context` and API pagination for robustness.
- Updated the `.github/workflows/go.yml` CI workflow to use the `Taskfile.yml` for building and testing, ensuring consistency.
- Added a `test` task to `Taskfile.yml`.
- Ran `go mod tidy` and fixed several unused import errors.
2025-11-02 00:31:15 +00:00
google-labs-jules[bot]
aaa8ab3966 fix: Resolve broken build and improve testing
This commit fixes a critical build issue where the application was being compiled as an archive instead of an executable. This was caused by the absence of a `main` package.

The following changes have been made to resolve this and improve the development process:

- A `main.go` file has been added to the root of the project to serve as the application's entry point.
- A `Taskfile.yml` has been introduced to standardize the build, run, and testing processes.
- The build process has been corrected to produce a runnable binary.
- An end-to-end test (`TestE2E`) has been added to the test suite. This test builds the application and runs it with the `--help` flag to ensure the binary is always executable, preventing similar build regressions in the future.
2025-11-01 23:55:14 +00:00
google-labs-jules[bot]
c68626985e feat: Add go.work, update module path, and add examples
This commit introduces several maintenance improvements to the repository.

- A `go.work` file has been added to define the workspace and make the project easier to work with.
- The module path in `go.mod` has been updated to use a GitHub URL, and all import paths have been updated accordingly.
- `examples` and `docs` directories have been created.
- The `examples` directory contains scripts that demonstrate the tool's functionality.
- The `docs` directory contains documentation for the project.
- Tests have been added to the `pkg/github` package following the `_Good`, `_Bad`, `_Ugly` convention.
- The missing `pkg/borg` package has been added to resolve a build error.
2025-10-31 22:15:05 +00:00
google-labs-jules[bot]
21f9a9ca74 feat: Implement core data collection and Trix cube functionality
This commit introduces the core functionality of the Borg Data Collector.

- Adds the `collect` command to clone a single Git repository and store it in a Trix cube.
- Adds the `collect all` command to clone all public repositories from a GitHub user or organization.
- Implements the Trix cube as a `tar` archive.
- Adds the `ingest` command to add files to a Trix cube.
- Adds the `cat` command to extract files from a Trix cube.
- Integrates Borg-themed status messages for a more engaging user experience.
2025-10-31 05:02:29 +00:00