Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
8a2b259
Enhance initialization process by adding metadata setup and project t…
Jul 22, 2025
8087e14
Added support for Git-style configuration manager
Jul 23, 2025
ea5bc8b
starting refactor to giv config and subcommand scripts
Jul 23, 2025
6e9f96c
BROKEN: Starting refactor CLI Structure and Enhance Error Handling
Jul 23, 2025
9e7b26e
Refactor config command to enhance error handling and add support for…
Jul 23, 2025
f1bd745
Refactor project metadata handling and improve environment loading
lackeyi Jul 23, 2025
b7d4f56
Refactor argument parsing and configuration handling
Jul 24, 2025
57da3a6
feat: update GIV_HOME directory structure and improve debug output
Jul 24, 2025
950b6fe
Refactor GIV CLI: Consolidate command scripts and improve argument pa…
Jul 24, 2025
194919d
Refactor argument parsing and enhance command handling
Jul 24, 2025
2dbb48f
working on better testing/mocking
Jul 24, 2025
d2c30df
feat(tests): add comprehensive integration tests for subcommands and …
Jul 25, 2025
13efd96
fixed unit tests
Jul 25, 2025
959d198
fixing integration tests
Jul 25, 2025
782ad0b
feat: enhance configuration management and improve testing setup
Jul 25, 2025
7f3eec8
feat: improve config handling and enhance dispatcher tests
Jul 25, 2025
2b5bf2d
feat: add default version handling and improve output mode configuration
Jul 25, 2025
66b197a
feat: enhance documentation and configuration management for `giv`
Jul 25, 2025
7eae46e
feat: enhance command scripts and add comprehensive tests for config …
Jul 25, 2025
f724938
updatding config and build docs
Jul 25, 2025
38632ed
Implement comprehensive package validation framework with Docker support
Jul 25, 2025
7d20c66
feat: Introduce containerized validation system for GIV CLI
Jul 25, 2025
4fa3245
feat: Enhance argument parsing and configuration management
Jul 27, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .github/workflows/dash-shell.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Dash Shell CI

on:
push:
branches: [ "main", "spike/config" ]
pull_request:
branches: [ "main", "spike/config" ]

jobs:
dash-shell:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install dash and bats
run: |
sudo apt-get update
sudo apt-get install -y dash bats
- name: Run Bats tests with dash
run: |
SHELL=/bin/dash bats tests/
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,6 @@ dist
tests/.giv
.notes
.giv/config.bak
CLAUDE.md
.giv/config.bak2
tests/fixtures/giv-home/
53 changes: 10 additions & 43 deletions .giv/config
Original file line number Diff line number Diff line change
@@ -1,43 +1,10 @@
# GIV Configuration Example
## Check the docs/configuration.md for more details.

## Debugging
# ### Set to "true" to enable debug mode, which provides detailed logging
# GIV_DEBUG=""
# ### If set to "true", enables dry run mode (no changes will be made)
# GIV_DRY_RUN=""
# ### Set to "true" to preserve temporary directories after execution for debugging purposes
# GIV_TMPDIR_SAVE=""


## Model and API configuration
# GIV_MODEL="devstral"
# GIV_API_URL="http://localhost:11434/v1/chat/completions"
# GIV_API_KEY="giv"
# GIV_API_MODEL="devstral"

# ## Remote: groq API Configuration
# GIV_API_URL="https://api.groq.com/openai/v1/chat/completions"
# GIV_API_MODEL="compound-beta"
# GIV_API_KEY="${GROQ_API_KEY:-}"


# ## Remote: OpenAI Compatible API Configuration
# GIV_API_MODEL=gpt-4o-mini
# GIV_API_URL=https://api.openai.com/v1/chat/completions
# GIV_API_KEY="${OPENAI_API_KEY:-}"



### Regex pattern to identify TODO comments in code (e.g., 'TODO:(.*)')
GIV_TODO_PATTERN=""

### Comma-separated list of files or glob patterns to search for TODOs (e.g., "*.py,src/**/*.js")
GIV_TODO_FILES="docs/todos.md"

GIV_METADATA_PROJECT_TYPE=custom
GIV_VERSION_FILE="src/config.sh"

### Regex pattern to extract the version string from the version file (e.g., 'version\s*=\s*"([0-9\.]+)"')
GIV_VERSION_PATTERN=""

GIV_PROJECT_TYPE="custom"
GIV_PROJECT_VERSION_FILE="src/lib/system.sh"
GIV_PROJECT_VERSION_PATTERN="version[[:space:]]*=[[:space:]]*([0-9]+\.[0-9]+\.[0-9]+)"
GIV_PROJECT_TITLE="giv"
GIV_PROJECT_DESCRIPTION="cli tool"
GIV_PROJECT_URL="giv is a CLI utility for generating changelogs and summaries."
GIV_API_URL="http://localhost:11434/v1/chat/completions"
GIV_API_MODEL="devstral"
GIV_INITIALIZED="true"
project.title="Test Value With Spaces"
10 changes: 10 additions & 0 deletions .giv/config.x
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
project.type="custom"
project.version_file="src/lib/system.sh"
project.version_pattern="version[[:space:]]*=[[:space:]]*([0-9]+\.[0-9]+\.[0-9]+)"
project.title="giv"
project.description="cli tool"
project.url="giv is a CLI utility for generating changelogs and summaries."
api.url="http://localhost:11434/v1/chat/completions"
api.model="devstral"
api.key="ollama"
initialized="true"
1 change: 1 addition & 0 deletions .shellcheckrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ external-sources=true

# Exclude files under the tests folder
exclude-path=tests/*
disable=SC3043

# # Disable notices about things that are intentionally non-POSIX or acceptable
# disable = \
Expand Down
12 changes: 11 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,27 @@
"giv",
"inplace",
"insec",
"LOCALAPPDATA",
"mktemp",
"MSYS",
"newc",
"newf",
"ollama",
"PATHSPEC",
"pypi",
"pyproject",
"RLENGTH",
"subcmd",
"GIV_SUBCMD",
"toplevel",
"unmatch"
],
"files.exclude": {
"**/.git": true,
"**/.svn": true,
"**/.hg": true,
"**/.DS_Store": true,
"**/Thumbs.db": true
},
"todo-tree.general.tags": [
"BUG",
"HACK",
Expand Down
68 changes: 64 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
## Examples

```bash
# Initialize giv for a new project (interactive setup)
giv init

# Commit message for working tree
giv message

Expand All @@ -36,6 +39,26 @@ giv changelog --todo-files '*.ts' --todo-pattern 'TODO\\(\\w+\\):'
giv release-notes v1.2.0..HEAD \
--api-model some-new-model \
--api-url https://api.example.com/v1/chat/completions

# Configure API settings using dot notation
giv config api.url "https://api.openai.com/v1/chat/completions"
giv config api.model "gpt-4o"
giv config api.key "your-api-key"

# Configure project metadata
giv config project.title "My Project"
giv config project.description "A CLI tool for managing projects"
giv config project.url "https://github.com/user/project"

# List all configuration values
giv config list

# Get specific configuration values
giv config get api.url
giv config api.url # shorthand syntax

# Remove configuration values
giv config unset api.key
```


Expand Down Expand Up @@ -70,6 +93,8 @@ giv <subcommand> [revision] [pathspec] [OPTIONS]
| `changelog` | Create or update `CHANGELOG.md` |
| `release-notes` | Longer notes for a tagged release |
| `announcement` | Marketing-style release announcement |
| `document` | Generate custom content using your own prompt template |
| `config` | Manage configuration values |
| `available-releases` | List script versions |
| `update` | Self-update giv |

Expand Down Expand Up @@ -123,10 +148,45 @@ giv <subcommand> [revision] [pathspec] [OPTIONS]

## Environment Variables

| Variable | Purpose |
| ---------------- | -------------------------------------------------- |
| `GIV_API_KEY` | API key for remote model |
| `GIV_API_URL` | Endpoint default if `--api-url` is omitted |
| Variable | Purpose |
| --------------------- | -------------------------------------------------- |
| `GIV_API_KEY` | API key for remote model |
| `GIV_API_URL` | Remote API endpoint URL |
| `GIV_API_MODEL` | Remote model name |
| `GIV_PROJECT_TITLE` | Project name |
| `GIV_PROJECT_DESCRIPTION` | Project description |
| `GIV_PROJECT_URL` | Project URL |
| `GIV_CONFIG_FILE` | Path to configuration file |

**Configuration Management:**

giv uses a Git-style configuration system. You can manage settings with:

```bash
# Interactive setup (creates .giv/config and prompts for values)
giv init

# List all configuration values
giv config list

# Get a specific value
giv config get api.url
giv config api.url # shorthand syntax

# Set a configuration value
giv config set api.url "https://api.openai.com/v1/chat/completions"
giv config api.url "https://api.openai.com/v1/chat/completions" # shorthand

# Remove a configuration value
giv config unset api.url
```

Configuration is stored in `.giv/config` in your project root and can be overridden with environment variables or command-line flags. The hierarchy is:

1. Command-line arguments (highest priority)
2. Environment variables
3. `.giv/config` file
4. Default values (lowest priority)

## License

Expand Down
109 changes: 109 additions & 0 deletions build/build-packages-container.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
#!/bin/bash
set -euo pipefail

# Container-internal build script
# This script runs inside the giv-packages container and performs the actual build

VERSION="${1:-}"
if [[ -z "$VERSION" ]]; then
echo "ERROR: Version not provided" >&2
exit 1
fi

echo "Building GIV CLI version $VERSION inside container..."

# Set up build environment
mkdir -p .tmp
BUILD_TEMP=$(mktemp -d -p .tmp)
DIST_DIR="./dist/${VERSION}"

echo "Build temp directory: $BUILD_TEMP"
echo "Distribution directory: $DIST_DIR"

# Clean and create dist directory
rm -rf "${DIST_DIR}"
mkdir -p "${DIST_DIR}"

# All necessary tools should be pre-installed in the container
echo "Verifying build tools..."

# Check for required tools
MISSING_TOOLS=()

if ! command -v fpm >/dev/null 2>&1; then
MISSING_TOOLS+=("fpm")
fi

if ! command -v npm >/dev/null 2>&1; then
MISSING_TOOLS+=("npm")
fi

if ! command -v python3 >/dev/null 2>&1; then
MISSING_TOOLS+=("python3")
fi

if ! command -v gem >/dev/null 2>&1; then
MISSING_TOOLS+=("gem")
fi

if [[ ${#MISSING_TOOLS[@]} -gt 0 ]]; then
echo "ERROR: Missing required build tools: ${MISSING_TOOLS[*]}" >&2
echo "The container may not have been built correctly." >&2
exit 1
fi

echo "✓ All required build tools are available"

# Prepare package files
mkdir -p "${BUILD_TEMP}/package"
cp -r src templates docs "${BUILD_TEMP}/package/"
echo "Copied src, templates, docs to ${BUILD_TEMP}/package/"

cp README.md "${BUILD_TEMP}/package/docs"
mv "${BUILD_TEMP}/package/src/giv.sh" "${BUILD_TEMP}/package/src/giv"

# Collect file lists for setup.py
SH_FILES=$(find "${BUILD_TEMP}/package/src" -type f -name '*.sh' -print0 | xargs -0 -I{} bash -c 'printf "src/%s " "$(basename "{}")"')
TEMPLATE_FILES=$(find "${BUILD_TEMP}/package/templates" -type f -print0 | xargs -0 -I{} bash -c 'printf "templates/%s " "$(basename "{}")"')
DOCS_FILES=$(find "${BUILD_TEMP}/package/docs" -type f -print0 | xargs -0 -I{} bash -c 'printf "docs/%s " "$(basename "{}")"')

export SH_FILES TEMPLATE_FILES DOCS_FILES

echo "Building packages..."

# Build each package type
echo "Building npm package..."
./build/npm/build.sh "${VERSION}" "${BUILD_TEMP}"

echo "Building PyPI package..."
./build/pypi/build.sh "${VERSION}" "${BUILD_TEMP}"

echo "Building Homebrew formula..."
./build/homebrew/build.sh "${VERSION}" "${BUILD_TEMP}"

echo "Building Scoop manifest..."
./build/scoop/build.sh "${VERSION}" "${BUILD_TEMP}"

echo "Building Linux packages (deb/rpm)..."
./build/linux/build.sh "${VERSION}" "${BUILD_TEMP}" "deb"
./build/linux/build.sh "${VERSION}" "${BUILD_TEMP}" "rpm"

echo "Building Snap package..."
./build/snap/build.sh "${VERSION}" "${BUILD_TEMP}"

echo "Building Flatpak package..."
./build/flatpak/build.sh "${VERSION}" "${BUILD_TEMP}"

echo "Building Docker image..."
./build/docker/build.sh "${VERSION}" "${BUILD_TEMP}"

# Clean up temp directory
rm -rf "${BUILD_TEMP}"

echo "Build completed successfully!"
echo "Artifacts are available in: ${DIST_DIR}"

# List built artifacts
echo
echo "Built artifacts:"
find "${DIST_DIR}" -type f -exec basename {} \; | sort
Loading
Loading