Skip to content

Conversation

@xaoscience
Copy link
Owner

Architecture Enhancements

This PR implements 8 major architecture improvements to transform git-control into a modern, extensible CLI toolkit.

Summary of Changes

1. ✅ Modular CLI Framework

  • New gc entry point as unified command dispatcher
  • Commands organized in commands/ directory
  • Automatic command discovery and help generation
  • Global flags support (--json, --quiet, --verbose)

2. ✅ Configuration System

  • scripts/lib/config.sh - hierarchical config management
  • Pure bash YAML parser (no external dependencies)
  • Config hierarchy: global → project → CLI flags
  • Locations: ~/.config/git-control/config.yaml, .gc-init.yaml

3. ✅ Plugin Architecture

  • plugins/ directory with auto-discovery
  • Plugin manifest format (plugin.yaml)
  • gc plugin command for management
  • Example plugin included as template

4. ✅ Interactive TUI Mode

  • scripts/lib/tui.sh - rich terminal UI library
  • Auto-detects gum → fzf → bash fallbacks
  • Functions: tui_choose(), tui_confirm(), tui_input(), tui_spin()
  • Works in any terminal environment

5. ✅ Output Format Support

  • scripts/lib/output.sh - consistent output handling
  • Modes: --json (machine), --quiet (minimal), --verbose (debug)
  • Functions: out(), verbose(), debug(), json_output()

6. ✅ Install Script

  • Single-file install.sh for easy distribution
  • curl-pipe-bash installation support
  • Options: --prefix, --bin, --uninstall, --upgrade
  • Auto-installs bash aliases

7. ✅ Testing Framework

  • bats-core integration with auto-install
  • tests/lib/*.bats - unit tests for libraries
  • tests/gc.bats - integration tests
  • .github/workflows/test.yml - CI automation

8. ✅ Version Management

  • scripts/lib/version.sh - version utilities
  • gc version command with subcommands
  • Update checking from GitHub releases
  • CHANGELOG.md following Keep a Changelog format

New Files

gc                              # Main entry point
commands/
├── config.sh                   # Interactive config management
├── plugin.sh                   # Plugin management
├── status.sh                   # Status with output formats
└── version.sh                  # Version/update commands
scripts/lib/
├── config.sh                   # Config library
├── output.sh                   # Output format library
├── tui.sh                      # TUI library
└── version.sh                  # Version library
plugins/example/
├── plugin.yaml                 # Example plugin manifest
└── commands/hello.sh           # Example plugin command
tests/
├── gc.bats                     # Integration tests
├── run_tests.sh                # Test runner
└── lib/*.bats                  # Unit tests
config/
├── example-global.config.yaml  # Global config example
└── example-project.gc-init.yaml # Project config example
install.sh                      # Installer
CHANGELOG.md                    # Changelog
docs/INSTALL.md                 # Installation guide
docs/TESTING.md                 # Testing guide
.github/workflows/test.yml      # CI workflow

Installation (after merge)

curl -sSL https://raw.githubusercontent.com/xaoscience/git-control/Main/install.sh | bash

Usage Examples

gc --help                    # Show all commands
gc init                      # Initialize repo
gc config show               # Show configuration
gc config set defaults.license MIT  # Set config value
gc plugin list               # List plugins
gc version check             # Check for updates
gc status --json             # JSON output

Breaking Changes

None - all existing scripts remain functional.

Testing

./tests/run_tests.sh         # Run all tests

Closes: N/A (feature enhancement)

- Create gc wrapper script as main entry point
- Add commands/ directory structure for modular commands
- Implement command auto-discovery and dispatching
- Support both direct invocation and subcommand style
- Create config.sh library with YAML parsing (pure bash)
- Support global config (~/.config/git-control/config.yaml)
- Support project config (.gc-init.yaml)
- Maintain backward compatibility with legacy gc-init.* git config
- Add example configuration files
- Create plugins/ directory structure
- Add plugin.sh command for plugin management
- Implement plugin install/remove/update/list
- Support GitHub and local plugin sources
- Add example plugin demonstrating the system
- Auto-discover plugin commands in gc entry point
- Create tui.sh library with rich interactive functions
- Auto-detect gum/fzf availability with bash fallbacks
- Add tui_choose, tui_multi_choose for selections
- Add tui_input, tui_write, tui_password for input
- Add tui_confirm for yes/no prompts
- Add tui_spin for progress indication
- Add tui_table for formatted tables
- Add tui_file_picker, tui_dir_picker for file selection
- Create config.sh command using TUI for interactive setup
- Create output.sh library with conditional output functions
- Add out, verbose, debug wrappers that respect modes
- Add JSON output helpers (json_field, json_array, json_output)
- Add parse_output_flags for command argument parsing
- Create status.sh command demonstrating all output modes
- Create install.sh with curl-pipe-bash support
- Support --prefix, --bin, --uninstall, --upgrade options
- Auto-install bash aliases
- Create default config file
- Add comprehensive post-install instructions
- Add INSTALL.md documentation
- Add tests/lib/*.bats for unit testing library functions
- Add tests/gc.bats for integration testing
- Add tests/run_tests.sh - auto-installs bats if needed
- Add .github/workflows/test.yml for CI
- Add docs/TESTING.md with testing guide
- Tests for common.sh, config.sh, output.sh libraries
- Add scripts/lib/version.sh with version utilities
- Add CHANGELOG.md following Keep a Changelog format
- Add commands/version.sh for gc version subcommand
- Support version comparison, update checking
- gc version check - check for updates
- gc version update - perform update
- gc version changelog - show recent changes
@xaoscience xaoscience force-pushed the feat/architecture-enhancements branch from ed89efd to d3ddcf2 Compare January 12, 2026 22:33
@xaoscience xaoscience merged commit 8bbbb6a into Main Jan 12, 2026
0 of 2 checks passed
xaoscience added a commit that referenced this pull request Jan 12, 2026
- SC2145: Fix echo array expansion in output.sh (use  instead of )
- SC2206: Quote array expansions in version.sh properly
- SC2034: Remove unused install_type variable in version.sh
- Fix quiet mode in out() function to check both OUTPUT_QUIET and GC_QUIET
- Fix test load paths from 'test_helper' to '../test_helper'
- Properly declare arrays before assignment in version.sh

These fixes address all shellcheck lint errors and test import failures
in the architecture enhancements PR.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant