Commit graph

105 commits

Author SHA1 Message Date
snider
22e42d721a feat: SMSG v2 binary format with zstd compression + RFC-001 spec
- Add SMSG v2 format: binary attachments instead of base64 (~25% smaller)
   - Add zstd compression (klauspost/compress) - faster than gzip
   - Add RFC-001: Open Source DRM specification (status: Proposed)
   - Add live demo page at demo.dapp.fm with WASM decryption
   - Add mkdemo tool for generating encrypted demo files
   - Update README with proper documentation
   - Add format examples and failure case documentation

   Demo: https://demo.dapp.fm
   Master Password: PMVXogAJNVe_DDABfTmLYztaJAzsD0R7
2026-01-10 19:57:33 +00:00
snider
ef3d6e9731 feat: Add dapp.fm native desktop player (Wails)
- cmd/dapp-fm-app: Native desktop app with WebView (Wails)
   - cmd/dapp-fm: CLI binary for HTTP server mode
   - pkg/player: Shared player core with Go bindings

   Architecture: Go decrypts SMSG content, serves via asset handler.
   Frontend calls Go directly via Wails bindings for manifest/license
   checks.
2026-01-06 18:42:30 +00:00
snider
727072e2e5 feat: Zero-Trust DRM - EUPL-1.2 - Viva La OpenSource <3 2026-01-06 16:53:58 +00:00
Snider
741bbe11e8 feat: Add Borg Console and release workflow 2025-12-27 02:32:31 +00:00
Snider
b3755da69d feat: Add STMF form encryption and SMSG secure message packages
STMF (Sovereign Form Encryption):
- X25519 ECDH + ChaCha20-Poly1305 hybrid encryption
- Go library (pkg/stmf/) with encrypt/decrypt and HTTP middleware
- WASM module for client-side browser encryption
- JavaScript wrapper with TypeScript types (js/borg-stmf/)
- PHP library for server-side decryption (php/borg-stmf/)
- Full cross-platform interoperability (Go <-> PHP)

SMSG (Secure Message):
- Password-based ChaCha20-Poly1305 message encryption
- Support for attachments, metadata, and PKI reply keys
- WASM bindings for browser-based decryption

Demos:
- index.html: Form encryption demo with modern dark UI
- support-reply.html: Decrypt password-protected messages
- examples/smsg-reply/: CLI tool for creating encrypted replies

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-27 00:49:07 +00:00
snider
376517d7a2 feat: Add ChaCha20-Poly1305 encryption and decryption for TIM files (.stim), enhance CLI for encryption format handling (stim), and include metadata inspection support 2025-12-26 01:25:03 +00:00
b8f5390fb0
Merge pull request #20 from Snider/update-docs
Update documentation to match current codebase state
2025-11-25 00:10:24 +00:00
google-labs-jules[bot]
629a6e6464 Update documentation for CLI and library usage
- Update docs/cli.md to include all current commands (all, compile, run, decode) and correct terminology (TIM).
- Update docs/library.md with correct, runnable Go code examples and updated import paths.
- Update docs/development.md, docs/installation.md, and docs/releasing.md to reflect the project's Go version (1.25.0).
- Remove outdated "No functional changes" notes from documentation files.
2025-11-24 23:58:50 +00:00
89388e9c9b
Merge pull request #19 from Snider/improve-test-coverage
Improve test coverage and fix cmd tests
2025-11-23 19:31:28 +00:00
google-labs-jules[bot]
bd14b14483 Improve test coverage for datanode and tim packages, and fix cmd tests
- Added unit tests for `ToTar` and `FromTar` in `pkg/datanode`, including a round-trip test and invalid input handling.
- Added unit tests for `Walk` options (`MaxDepth`, `Filter`, `SkipErrors`) in `pkg/datanode`.
- Added security tests for `pkg/tim` to verify protection against path traversal (Zip Slip) attacks and handling of invalid inputs.
- Fixed `cmd` package tests execution by adding `TestHelperProcess` to `cmd/run_test.go` to support mocked command execution.
- Increased coverage for `pkg/datanode` to 84.2%, `pkg/tim` to 74.2%, and `cmd` to 44.1%.
2025-11-23 18:58:32 +00:00
860c150a3d
Merge pull request #16 from Snider/feature-trix-encryption
feat: Add trix encryption and format
2025-11-14 14:26:59 +00:00
google-labs-jules[bot]
38bce5acde feat: Add trix encryption and format
This commit introduces the `Enchantrix` library to add support for the `.trix` encrypted file format.

The main changes are:

- The `matrix` format has been renamed to `tim` (Terminal Isolation Matrix).
- The `.tim` format is now a specialized `.trix` file.
- A new `decode` command has been added to decode `.trix` and `.tim` files.
- The `collect` commands now support the `trix` and `tim` formats.
- A `--password` flag has been added to the `collect` commands for encryption.
- A `--i-am-in-isolation` flag has been added to the `decode` command for safely decoding `.tim` files.
- The decryption functionality is currently disabled due to a bug in the `Enchantrix` library. A follow-up PR will be created to re-enable it.
- Path traversal vulnerability in `pkg/tim/run.go` has been fixed.
- File descriptor leak in `pkg/tim/run.go` has been fixed.
- Improved error handling in `pkg/trix/trix.go`.
2025-11-14 14:12:31 +00:00
google-labs-jules[bot]
3398fabb14 feat: Add trix encryption and format
This commit introduces the `Enchantrix` library to add support for the `.trix` encrypted file format.

The main changes are:

- The `matrix` format has been renamed to `tim` (Terminal Isolation Matrix).
- The `.tim` format is now a specialized `.trix` file.
- A new `decode` command has been added to decode `.trix` and `.tim` files.
- The `collect` commands now support the `trix` and `tim` formats.
- A `--password` flag has been added to the `collect` commands for encryption.
- A `--i-am-in-isolation` flag has been added to the `decode` command for safely decoding `.tim` files.
- The decryption functionality is currently disabled due to a bug in the `Enchantrix` library. A follow-up PR will be created to re-enable it.
2025-11-14 13:47:27 +00:00
bbf9bddbcc
Merge pull request #15 from Snider/docs-update-examples-and-matrix
Feat: Implement Go examples and refactor matrix execution
2025-11-14 11:21:38 +00:00
google-labs-jules[bot]
47286e2714 feat: Implement Go examples and refactor matrix execution
- Implements all placeholder Go examples in the `examples` directory.
- Corrects the `run_matrix_programmatically` example to use the `borg` package.
- Refactors the code to centralize the matrix execution logic in the `matrix` package.
- Updates the documentation to include a new "Programmatic Usage" section that describes all of the Go examples.
- Updates the "Terminal Isolation Matrix" section to remove manual 'runc' instructions, emphasizing that 'borg run' handles this process to maintain security and isolation.
- Adds missing examples for 'collect github repos', 'collect github release', and 'compile' commands to the documentation.
- Makes `pkg/matrix.Run` testable by exposing `exec.Command` as a public variable.
- Adds tests for the `matrix` package that mock the `runc` command.
- Updates the `cmd` package tests to mock `matrix.ExecCommand` instead of the old `cmd.execCommand`.
2025-11-14 11:19:48 +00:00
google-labs-jules[bot]
80aacc85a4 feat: Implement Go examples and refactor matrix execution
- Implements all placeholder Go examples in the `examples` directory.
- Corrects the `run_matrix_programmatically` example to use the `borg` package.
- Refactors the code to centralize the matrix execution logic in the `matrix` package.
- Updates the documentation to include a new "Programmatic Usage" section that describes all of the Go examples.
- Updates the "Terminal Isolation Matrix" section to remove manual 'runc' instructions, emphasizing that 'borg run' handles this process to maintain security and isolation.
- Adds missing examples for 'collect github repos', 'collect github release', and 'compile' commands to the documentation.
2025-11-14 11:12:15 +00:00
952a287872
Merge pull request #14 from Snider/refactor-add-good-bad-ugly-tests
Add _Good, _Bad, and _Ugly tests
2025-11-14 10:44:32 +00:00
google-labs-jules[bot]
8ba0deab91 feat: Add _Good, _Bad, and _Ugly tests
Refactored the existing tests to use the `_Good`, `_Bad`, and `_Ugly`
testing convention. This provides a more structured approach to testing
and ensures that a wider range of scenarios are covered, including
valid inputs, invalid inputs, and edge cases.

In addition to refactoring the tests, this change also includes several
bug fixes that were uncovered by the new tests. These fixes improve the
robustness and reliability of the codebase.

The following packages and commands were affected:
- `pkg/datanode`
- `pkg/compress`
- `pkg/github`
- `pkg/matrix`
- `pkg/pwa`
- `pkg/vcs`
- `pkg/website`
- `cmd/all`
- `cmd/collect`
- `cmd/collect_github_repo`
- `cmd/collect_website`
- `cmd/compile`
- `cmd/root`
- `cmd/run`
- `cmd/serve`
2025-11-14 10:36:35 +00:00
936e2a7134
Merge pull request #13 from Snider/feat-runc-compile-run
Feat runc compile run
2025-11-13 21:09:06 +00:00
google-labs-jules[bot]
bc3cf41aac revert: Revert changes made to increase test coverage
This reverts the following commits:
- feat: Increase test coverage for pkg/datanode
- feat: Increase test coverage for pkg/compress
- feat: Increase test coverage for pkg/pwa
- feat: Increase test coverage for pkg/website
- feat: Increase test coverage for pkg/vcs

These changes are being reverted because they were causing test failures
and were not contributing to the overall stability of the project.
2025-11-13 21:08:15 +00:00
google-labs-jules[bot]
2fa52bc8b4 fix: Address various issues in compile, run, and matrix tests
This commit addresses three separate issues:

1.  **cmd/compile.go**: The `Borgfile` parsing now returns an error for
    unknown instructions instead of silently ignoring them.
2.  **cmd/run_test.go**: The `execCommand` mock is now properly cleaned
    up after the test, preventing it from leaking into other tests.
3.  **pkg/matrix/matrix_test.go**: The EOF check in the tar reader loop
    now uses a direct error comparison (`io.EOF`) instead of a string
    comparison.
2025-11-13 19:56:13 +00:00
google-labs-jules[bot]
7a76d55411 feat: Increase test coverage for pkg/datanode
This commit increases the test coverage for the `pkg/datanode` package
from 58.1% to 66.9%.

The following changes were made:
- Added a new test file, `pkg/datanode/fromtar_test.go`, to test the
  `FromTar` function.
- Added a new test file, `pkg/datanode/fs_test.go`, to test the `Stat`,
  `Exists`, and `Walk` functions.
- Refactored the existing tests in `pkg/datanode/datanode_test.go` to
  remove the monolithic test function and improve the organization of
  the tests.
2025-11-13 19:48:15 +00:00
google-labs-jules[bot]
3598d7d5ac feat: Add placeholder examples for all features
This commit adds placeholder Go programs to the `examples` directory for
all of Borg's features. This provides a clear roadmap for future
implementation and ensures that we have a testing strategy for each
function.

The new placeholder examples are:
- `examples/all`
- `examples/collect_github_release`
- `examples/collect_github_repo`
- `examples/collect_github_repos`
- `examples/collect_pwa`
- `examples/collect_website`
- `examples/serve`
2025-11-13 19:38:23 +00:00
google-labs-jules[bot]
757a12086c feat: Add programmatic examples for matrix creation and execution
This commit adds two new Go programs to the `examples` directory to
demonstrate how to use the `pkg/matrix` and `pkg/datanode` packages
programmatically:

- `examples/create_matrix_programmatically`: Shows how to create a
  `.matrix` file from scratch.
- `examples/run_matrix_programmatically`: Shows how to unpack and execute
  a `.matrix` file using `runc`.

The `examples` directory has been reorganized to place each runnable
example in its own subdirectory, which is the standard Go practice for
handling multiple `main` packages.
2025-11-13 19:27:12 +00:00
google-labs-jules[bot]
5711b6c13c feat: Add compile and run commands for RUNC matrices
This commit introduces two new commands to the `borg` CLI:

- `borg compile`: Compiles a `Borgfile` into a "Terminal Isolation
  Matrix" (`.matrix` file). The `Borgfile` format is a simple text file
  with `ADD <src> <dest>` instructions.

- `borg run`: Executes a `.matrix` file using `runc`. The command
  unpacks the matrix into a temporary directory and then executes `runc
  run`.

This commit also adds comprehensive tests for the new commands and the
`pkg/matrix` package, significantly increasing the overall test
coverage. The tests for the `run` command use a mocking pattern to
avoid environment dependencies.
2025-11-13 19:21:35 +00:00
google-labs-jules[bot]
03337982dd feat: Add compile and run commands for RUNC matrices
This commit introduces two new commands to the `borg` CLI:

- `borg compile`: Compiles a `Borgfile` into a "Terminal Isolation
  Matrix" (`.matrix` file). The `Borgfile` format is a simple text file
  with `ADD <src> <dest>` instructions.

- `borg run`: Executes a `.matrix` file using `runc`. The command
  unpacks the matrix into a temporary directory and then executes `runc
  run`.

Tests have been added for both commands, mocking the `runc` execution
to avoid environment dependencies.
2025-11-13 19:16:12 +00:00
Snider
4529aba089 feat: Update project configuration and documentation for Go 1.25 compatibility 2025-11-04 11:46:49 +00:00
02993fe87b
Merge pull request #12 from Snider/feature-improve-test-coverage
feat: Improve test coverage and refactor for testability
2025-11-03 20:20:44 +00:00
google-labs-jules[bot]
5c65673432 feat: Bug fixes and refactoring
This commit introduces a significant number of bug fixes, refactorings, and improvements to the codebase.

Key changes include:
- Refactored Cobra commands to use `RunE` for better error handling and testing.
- Extracted business logic from command handlers into separate, testable functions.
- Added comprehensive unit tests for the `cmd`, `compress`, `github`, `logger`, and `pwa` packages.
- Added tests for missing command-line arguments, as requested.
- Implemented the `borg all` command to clone all public repositories for a GitHub user or organization.
- Restored and improved the `collect pwa` functionality.
- Removed duplicate code and fixed various bugs.
- Addressed a resource leak in the `all` command.
- Improved error handling in the `pwa` package.
- Refactored `main.go` to remove duplicated logic.
- Fixed several other minor bugs and inconsistencies.
- Made tests platform-independent by removing hardcoded `/dev/null` paths.
- Fixed potential panics in tests by adding `nil` checks for errors.
- Fixed test state leakage by using `t.Cleanup` to restore mocked package-level variables.
- Added validation for command-line flags.
- Ensured output directories are created before writing files.
- Fixed naming conventions for Cobra command constructors.
- Consolidated tests for `ParseRepoFromURL`.
- Improved test failure messages.
- Added validation for release tags.
- Aggregated errors during asset downloads.
2025-11-03 20:14:47 +00:00
google-labs-jules[bot]
145d9e4a80 feat: Improve test coverage and refactor for testability
This commit introduces a significant refactoring of the `cmd` package to improve testability and increases test coverage across the application.

Key changes include:
- Refactored Cobra commands to use `RunE` for better error handling and testing.
- Extracted business logic from command handlers into separate, testable functions.
- Added comprehensive unit tests for the `cmd`, `compress`, `github`, `logger`, and `pwa` packages.
- Added tests for missing command-line arguments, as requested.
- Implemented the `borg all` command to clone all public repositories for a GitHub user or organization.
- Restored and improved the `collect pwa` functionality.
- Removed duplicate code and fixed various bugs.
- Addressed a resource leak in the `all` command.
- Improved error handling in the `pwa` package.
- Refactored `main.go` to remove duplicated logic.
- Fixed several other minor bugs and inconsistencies.
- Made tests platform-independent by removing hardcoded `/dev/null` paths.
- Fixed potential panics in tests by adding `nil` checks for errors.
- Fixed test state leakage by using `t.Cleanup` to restore mocked package-level variables.
2025-11-03 19:34:36 +00:00
google-labs-jules[bot]
52c0fa6b6d feat: Improve test coverage and refactor for testability
This commit introduces a significant refactoring of the `cmd` package to improve testability and increases test coverage across the application.

Key changes include:
- Refactored Cobra commands to use `RunE` for better error handling and testing.
- Extracted business logic from command handlers into separate, testable functions.
- Added comprehensive unit tests for the `cmd`, `compress`, `github`, `logger`, and `pwa` packages.
- Added tests for missing command-line arguments, as requested.
- Implemented the `borg all` command to clone all public repositories for a GitHub user or organization.
- Restored and improved the `collect pwa` functionality.
- Removed duplicate code and fixed various bugs.
- Addressed a resource leak in the `all` command.
- Improved error handling in the `pwa` package.
- Refactored `main.go` to remove duplicated logic.
- Fixed several other minor bugs and inconsistencies.
2025-11-03 18:25:04 +00:00
784e7afef9
Merge branch 'main' into feature-improve-test-coverage 2025-11-03 16:40:16 +00:00
google-labs-jules[bot]
d27d9f3a37 feat: Improve test coverage and refactor for testability
This commit introduces a significant refactoring of the `cmd` package to improve testability and increases test coverage across the application.

Key changes include:
- Refactored Cobra commands to use `RunE` for better error handling and testing.
- Extracted business logic from command handlers into separate, testable functions.
- Added comprehensive unit tests for the `cmd`, `compress`, `github`, `logger`, and `pwa` packages.
- Added tests for missing command-line arguments, as requested.
- Implemented the `borg all` command to clone all public repositories for a GitHub user or organization.
- Restored and improved the `collect pwa` functionality.
- Removed duplicate code and fixed various bugs.
2025-11-03 16:31:26 +00:00
Snider
e7db83bc96 Add initialization comments for command registration in CLI 2025-11-03 03:42:21 +00:00
Snider
057d4a55d0 Refactor package structure and update dependencies 2025-11-03 02:36:38 +00:00
87bb3e1aa9
Merge pull request #11 from Snider/feature-tdd-testing-with-mocking
feat: Add TDD tests with mocking for collect commands
2025-11-02 23:13:16 +00:00
f5bc74becb
Modify newTestPWAClient to accept serverURL parameter 2025-11-02 23:12:16 +00:00
83f2102bf8
Remove unused context import from all.go 2025-11-02 23:10:44 +00:00
ae1e3b6890
Update pkg/pwa/pwa_test.go
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2025-11-02 23:09:15 +00:00
854d781965
Update cmd/all.go
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2025-11-02 23:08:50 +00:00
google-labs-jules[bot]
bb6d30122d refactor: Use dependency injection for mocking
This commit refactors the codebase to use dependency injection for mocking external dependencies, removing the need for in-code mocking with the `BORG_PLEXSUS` environment variable.

- Interfaces have been created for external dependencies in the `pkg/vcs`, `pkg/github`, and `pkg/pwa` packages.
- The `cmd` package has been refactored to use these interfaces, with dependencies exposed as public variables for easy mocking in tests.
- The tests in `TDD/collect_commands_test.go` have been updated to inject mock implementations of these interfaces.
- The `BORG_PLEXSUS` environment variable has been removed from the codebase.
2025-11-02 22:14:52 +00:00
9d5b8c51bb
Add Codecov badge to README
Added Codecov badge to README for coverage tracking.
2025-11-02 22:02:21 +00:00
8d1609e34f
Add coverage report to test command 2025-11-02 22:00:24 +00:00
26e2880dde
Add Codecov upload step to GitHub Actions
Added step to upload coverage reports to Codecov.
2025-11-02 22:00:01 +00:00
google-labs-jules[bot]
19431ed23d refactor: Improve test suite and mocking implementation
This commit refactors the test suite and mocking implementation based on user feedback.

- The mock HTTP client in `pkg/mocks/http.go` has been made thread-safe.
- The `pkg/website/website.go` package has been refactored to use dependency injection for the HTTP client.
- The tests in `TDD/collect_commands_test.go` have been updated to use separate buffers for stdout and stderr, and to use a local test server for the `collect website` command.
2025-11-02 20:03:32 +00:00
google-labs-jules[bot]
a8dc55aba5 fix: Correct mock data and test environment handling
This commit addresses several issues in the testing framework:

- Corrected a malformed URL in the mock response data in `pkg/github/github.go`.
- Fixed a bug in the mock HTTP client in `pkg/mocks/http.go` where the response body was being exhausted after the first read. The client now returns a deep copy of the response for each call.
- Refactored the environment variable handling in `TDD/collect_commands_test.go` to use `t.Setenv`, ensuring proper cleanup after the test.
2025-11-02 18:46:09 +00:00
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
Snider
adff8e9c07 Merge remote-tracking branch 'origin/main' 2025-11-02 17:56:29 +00:00