Compare commits
6 Commits
v2025.0630
...
v2025.0719
Author | SHA1 | Date | |
---|---|---|---|
0ba6227412 | |||
f5ba2e719b | |||
73c94f34f6 | |||
af4cbbcab0 | |||
a415eb0f91 | |||
83d6cf1603 |
23
.kiro/steering/product.md
Normal file
23
.kiro/steering/product.md
Normal file
@ -0,0 +1,23 @@
|
||||
# Product Overview
|
||||
|
||||
This repository contains **getpkg** - a command-line package manager for the dropshell ecosystem, along with a collection of developer tools.
|
||||
|
||||
## Core Product
|
||||
- **getpkg**: Package manager that installs tools to `~/.getpkg/` with symlinks in `~/.local/bin/getpkg/`
|
||||
- Supports multiple architectures (x86_64, aarch64, universal)
|
||||
- Tools are published to and downloaded from `getpkg.xyz`
|
||||
|
||||
## Tool Collection
|
||||
The repository includes several utility tools:
|
||||
- **bb64**: Bash-compatible base64 encoder/decoder with custom character set
|
||||
- **dehydrate**: Converts files/directories to C++ source code for embedding
|
||||
- **whatsdirty**: Git repository status checker
|
||||
- **sos**: Simple object storage client
|
||||
- **gp**: Git push utility
|
||||
|
||||
## Key Features
|
||||
- Cross-platform tool distribution
|
||||
- Automated installation with PATH setup
|
||||
- Bash completion support
|
||||
- Architecture-aware downloads with fallbacks
|
||||
- Publishing system with authentication tokens
|
72
.kiro/steering/structure.md
Normal file
72
.kiro/steering/structure.md
Normal file
@ -0,0 +1,72 @@
|
||||
# Project Structure
|
||||
|
||||
## Repository Layout
|
||||
```
|
||||
├── buildtestpublish_all.sh # Master build script for all projects
|
||||
├── clean.sh # Global cleanup script
|
||||
├── README.md # Main project documentation
|
||||
└── <tool-name>/ # Individual tool directories
|
||||
```
|
||||
|
||||
## Tool Directory Structure
|
||||
|
||||
### C++ Projects (CMake-based)
|
||||
```
|
||||
<tool-name>/
|
||||
├── CMakeLists.txt # CMake configuration
|
||||
├── build.sh # Build script
|
||||
├── test.sh # Test script
|
||||
├── clean.sh # Cleanup script
|
||||
├── publish.sh # Publishing script
|
||||
├── install.sh # Installation script
|
||||
├── README.md # Tool documentation
|
||||
├── Dockerfile.dropshell-build # Docker build configuration
|
||||
├── src/ # Source code
|
||||
│ ├── <tool>.cpp # Main source file
|
||||
│ ├── version.hpp.in # Version template
|
||||
│ └── ... # Additional sources
|
||||
├── build/ # Build artifacts (generated)
|
||||
├── output/ # Final executables (generated)
|
||||
└── .vscode/ # VS Code configuration
|
||||
```
|
||||
|
||||
### Shell Script Projects
|
||||
```
|
||||
<tool-name>/
|
||||
├── <tool-name> # Executable shell script
|
||||
├── build.sh # Build script (may be no-op)
|
||||
├── test.sh # Test script
|
||||
├── clean.sh # Cleanup script
|
||||
├── publish.sh # Publishing script
|
||||
└── setup_script.sh # Post-install setup (optional)
|
||||
```
|
||||
|
||||
## Standard Files
|
||||
|
||||
### Required Scripts
|
||||
- **build.sh**: Builds the project (Docker for C++, no-op for shell)
|
||||
- **test.sh**: Runs project tests
|
||||
- **clean.sh**: Removes build artifacts
|
||||
- **publish.sh**: Publishes to getpkg.xyz registry
|
||||
|
||||
### Optional Files
|
||||
- **install.sh**: System-wide installation script
|
||||
- **setup_script.sh**: Post-install setup for getpkg
|
||||
- **cmake_prebuild.sh**: Pre-build setup for CMake projects
|
||||
|
||||
### Generated Directories
|
||||
- **build/**: CMake build artifacts (C++ projects)
|
||||
- **output/**: Final executables ready for distribution
|
||||
- **test_*/**: Test-specific directories
|
||||
|
||||
## Naming Conventions
|
||||
- Tool directories match executable names
|
||||
- C++ source files typically match project name
|
||||
- Version templates use `.hpp.in` extension
|
||||
- Docker files use `Dockerfile.dropshell-build` pattern
|
||||
- Test directories prefixed with `test_`
|
||||
|
||||
## Configuration Files
|
||||
- **.gitignore**: Standard ignore patterns for build artifacts
|
||||
- **.vscode/**: VS Code workspace settings
|
||||
- **CMakeLists.txt**: Follows standard template with PROJECT_NAME parameter
|
70
.kiro/steering/tech.md
Normal file
70
.kiro/steering/tech.md
Normal file
@ -0,0 +1,70 @@
|
||||
# Technology Stack
|
||||
|
||||
## Build System
|
||||
- **CMake 3.16+** with Ninja generator for C++ projects
|
||||
- **Docker** containerized builds using `gitea.jde.nz/public/dropshell-build-base:latest`
|
||||
- **Static linking** for all C++ executables (`-static` flag)
|
||||
|
||||
## Languages & Standards
|
||||
- **C++23** standard for all C++ projects
|
||||
- **Bash** for shell scripts and simple tools
|
||||
- **Shell scripts** follow `set -euo pipefail` pattern
|
||||
|
||||
## Dependencies
|
||||
- **nlohmann_json** for JSON handling in C++ projects
|
||||
- **CPR (static)** for HTTP requests in getpkg
|
||||
- Custom modules in `/usr/local/share/cmake/Modules`
|
||||
|
||||
## Common Build Patterns
|
||||
|
||||
### C++ Projects (CMake)
|
||||
```bash
|
||||
# Standard build command
|
||||
cmake -G Ninja -S . -B ./build -DCMAKE_BUILD_TYPE=Debug -DPROJECT_NAME=<project>
|
||||
cmake --build ./build
|
||||
```
|
||||
|
||||
### Docker Build (for C++ tools)
|
||||
```bash
|
||||
# Uses Dockerfile.dropshell-build pattern
|
||||
docker build -t <project>-build -f Dockerfile.dropshell-build --build-arg PROJECT=<project> --output ./output .
|
||||
```
|
||||
|
||||
### Shell Tools
|
||||
- No build step required
|
||||
- Executable shell scripts with proper shebang
|
||||
- Use `chmod +x` for permissions
|
||||
|
||||
## Common Commands
|
||||
|
||||
### Build
|
||||
```bash
|
||||
./build.sh # Build individual project
|
||||
./buildtestpublish_all.sh # Build all projects
|
||||
```
|
||||
|
||||
### Test
|
||||
```bash
|
||||
./test.sh # Run tests for individual project
|
||||
```
|
||||
|
||||
### Clean
|
||||
```bash
|
||||
./clean.sh # Clean build artifacts
|
||||
```
|
||||
|
||||
### Publish
|
||||
```bash
|
||||
./publish.sh # Publish to getpkg.xyz (requires SOS_WRITE_TOKEN)
|
||||
```
|
||||
|
||||
## Version Management
|
||||
- Automatic timestamp-based versioning: `YYYY.MMDD.HHMM`
|
||||
- Version configured via `version.hpp.in` template files
|
||||
- Pre-build scripts (`cmake_prebuild.sh`) for additional setup
|
||||
|
||||
## Environment Variables
|
||||
- `CMAKE_BUILD_TYPE`: Debug/Release (default: Debug)
|
||||
- `SOS_WRITE_TOKEN`: Authentication for publishing
|
||||
- `NO_CACHE`: Skip Docker cache when set to "true"
|
||||
- `PROJECT`: Project name for build scripts
|
278
README.md
278
README.md
@ -1,192 +1,86 @@
|
||||
# getpkg - Package Manager for Dropshell Tools
|
||||
|
||||
getpkg is a command-line package manager that simplifies tool installation, management, and publishing for the dropshell ecosystem. Tools are installed to `~/.getpkg/` with executable symlinks in `~/.local/bin/getpkg/` and automatically added to your PATH with bash completion.
|
||||
|
||||
## Installation
|
||||
|
||||
Install getpkg with a single command:
|
||||
|
||||
```bash
|
||||
curl https://getbin.xyz/getpkg-install | bash
|
||||
```
|
||||
|
||||
After installation, restart your shell or run `source ~/.bashrc` to enable the new PATH and completion settings.
|
||||
|
||||
## Basic Usage
|
||||
|
||||
### Installing Tools
|
||||
|
||||
Install any tool from the getpkg registry:
|
||||
|
||||
```bash
|
||||
# Install a tool
|
||||
getpkg install whatsdirty
|
||||
```
|
||||
|
||||
### Managing Installed Tools
|
||||
|
||||
```bash
|
||||
# List all available commands
|
||||
getpkg help
|
||||
|
||||
# Update all installed tools
|
||||
getpkg update
|
||||
|
||||
# Uninstall a tool
|
||||
getpkg uninstall whatsdirty
|
||||
|
||||
# Check getpkg version
|
||||
getpkg version
|
||||
```
|
||||
|
||||
## Available Commands
|
||||
|
||||
### Core Package Management
|
||||
|
||||
- **`getpkg install <tool_name>`** - Install or update a tool
|
||||
- **`getpkg uninstall <tool_name>`** - Remove an installed tool
|
||||
- **`getpkg update`** - Update getpkg and all installed tools
|
||||
|
||||
### Publishing (Requires SOS_WRITE_TOKEN)
|
||||
|
||||
- **`getpkg publish <tool_name[:ARCH]> <folder>`** - Upload a tool to getpkg.xyz
|
||||
- **`getpkg unpublish <tool_name[:ARCH]>`** - Remove a published tool
|
||||
- **`getpkg unpublish <hash>`** - Remove a published tool by hash
|
||||
|
||||
### Development Tools
|
||||
|
||||
- **`getpkg create <tool_name> <directory>`** - Create a new tool project
|
||||
- **`getpkg hash <file_or_directory>`** - Calculate hash of files/directories
|
||||
|
||||
### Information
|
||||
|
||||
- **`getpkg list`** - List all available packages with status
|
||||
- **`getpkg clean`** - Clean up orphaned configs and symlinks
|
||||
- **`getpkg version`** - Show getpkg version
|
||||
- **`getpkg help`** - Show detailed help
|
||||
- **`getpkg autocomplete`** - Show available commands for completion
|
||||
|
||||
## How It Works
|
||||
|
||||
### Installation Process
|
||||
|
||||
When you install a tool, getpkg:
|
||||
|
||||
1. **Downloads** the tool archive from getpkg.xyz
|
||||
2. **Extracts** it to `~/.getpkg/<tool_name>/`
|
||||
3. **Creates symlinks** for all executables in `~/.local/bin/getpkg/`
|
||||
4. **Ensures PATH** includes `~/.local/bin/getpkg` (one-time setup)
|
||||
5. **Enables completion** for the tool
|
||||
6. **Runs setup** if a `setup_script.sh` exists
|
||||
7. **Stores metadata** in `~/.config/getpkg/<tool_name>.json`
|
||||
|
||||
### Architecture Support
|
||||
|
||||
getpkg supports multiple architectures:
|
||||
- `x86_64` (Intel/AMD 64-bit)
|
||||
- `aarch64` (ARM 64-bit)
|
||||
- `universal` (cross-platform tools)
|
||||
|
||||
Tools are automatically downloaded for your architecture, with fallback to universal versions.
|
||||
|
||||
### File Locations
|
||||
|
||||
- **Tool files**: `~/.getpkg/<tool_name>/` (actual tool installation)
|
||||
- **Executable symlinks**: `~/.local/bin/getpkg/` (in your PATH)
|
||||
- **Configuration**: `~/.config/getpkg/`
|
||||
- **PATH setup**: `~/.bashrc_getpkg` (sourced by `~/.bashrc`)
|
||||
|
||||
## Examples
|
||||
|
||||
### Installing Popular Tools
|
||||
|
||||
```bash
|
||||
# Install available tools
|
||||
getpkg install dehydrate # File to C++ code generator
|
||||
getpkg install bb64 # Bash base64 encoder/decoder
|
||||
|
||||
# Development tools (for repository development)
|
||||
getpkg install whatsdirty # Check git repo status
|
||||
getpkg install sos # Simple object storage client
|
||||
getpkg install gp # Git push utility
|
||||
```
|
||||
|
||||
### Publishing Your Own Tools
|
||||
|
||||
```bash
|
||||
# Set your publishing token
|
||||
export SOS_WRITE_TOKEN="your-token-here"
|
||||
|
||||
# Create a new tool project
|
||||
getpkg create mytool ./mytool-project
|
||||
|
||||
# Publish architecture-specific build
|
||||
getpkg publish mytool:x86_64 ./build/
|
||||
|
||||
# Publish universal tool
|
||||
getpkg publish mytool ./build/
|
||||
|
||||
# Remove published tool
|
||||
getpkg unpublish mytool:x86_64
|
||||
```
|
||||
|
||||
### Development Workflow
|
||||
|
||||
```bash
|
||||
# Create tool structure
|
||||
getpkg create awesome-tool ./awesome-tool
|
||||
cd awesome-tool
|
||||
|
||||
# Build your tool...
|
||||
# Add executable to the directory
|
||||
|
||||
# Test locally
|
||||
./awesome-tool --version
|
||||
|
||||
# Publish when ready
|
||||
getpkg publish awesome-tool:x86_64 .
|
||||
```
|
||||
|
||||
## Environment Variables
|
||||
|
||||
- **`SOS_WRITE_TOKEN`** - Authentication token for publishing tools
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Tool Not Found
|
||||
If a tool isn't found after installation, ensure your shell has loaded the new PATH:
|
||||
```bash
|
||||
source ~/.bashrc
|
||||
```
|
||||
|
||||
### Permission Issues
|
||||
getpkg installs to your home directory and doesn't require root access. If you encounter permission issues, check that `~/.local/bin/` is writable.
|
||||
|
||||
### Network Issues
|
||||
All tools are downloaded from `getpkg.xyz`. Ensure you have internet connectivity and the domain is accessible.
|
||||
|
||||
## Development
|
||||
|
||||
### Building getpkg
|
||||
|
||||
```bash
|
||||
# Build debug version
|
||||
cd getpkg && ./build.sh
|
||||
|
||||
# Run tests
|
||||
cd getpkg && ./test.sh
|
||||
|
||||
# Publish (requires SOS_WRITE_TOKEN)
|
||||
cd getpkg && ./publish.sh
|
||||
```
|
||||
|
||||
### Tool Development
|
||||
|
||||
When creating tools for getpkg:
|
||||
|
||||
1. Create a directory with your tool binary
|
||||
2. Optionally include a `setup_script.sh` for post-install setup
|
||||
3. The tool should support `version` and `autocomplete` subcommands
|
||||
4. Use `getpkg publish` to upload to the registry
|
||||
|
||||
For more details, see the development documentation in each tool's directory.
|
||||
# getpkg - Simple Package Manager
|
||||
|
||||
getpkg is a command-line package manager that makes it easy to install and manage developer tools. Tools are automatically installed to your home directory and added to your PATH.
|
||||
|
||||
## Quick Start
|
||||
|
||||
Install getpkg with one command:
|
||||
|
||||
```bash
|
||||
curl https://getbin.xyz/getpkg-install | bash
|
||||
```
|
||||
|
||||
After installation, restart your shell or run:
|
||||
```bash
|
||||
source ~/.bashrc
|
||||
```
|
||||
|
||||
## Basic Commands
|
||||
|
||||
### Install Tools
|
||||
```bash
|
||||
getpkg install <tool_name> # Install a tool
|
||||
getpkg list # See all available tools
|
||||
getpkg update # Update all installed tools
|
||||
```
|
||||
|
||||
### Manage Tools
|
||||
```bash
|
||||
getpkg uninstall <tool_name> # Remove a tool
|
||||
getpkg version # Check getpkg version
|
||||
getpkg help # Show all commands
|
||||
```
|
||||
|
||||
## Popular Tools
|
||||
|
||||
Install these useful developer tools:
|
||||
|
||||
```bash
|
||||
getpkg install bb64 # Bash-compatible base64 encoder/decoder
|
||||
getpkg install dehydrate # Convert files to C++ source code
|
||||
getpkg install whatsdirty # Check git repository status
|
||||
getpkg install sos # Simple object storage client
|
||||
getpkg install gp # Git push utility
|
||||
```
|
||||
|
||||
## How It Works
|
||||
|
||||
When you install a tool:
|
||||
1. Downloads from getpkg.xyz
|
||||
2. Installs to `~/.getpkg/<tool_name>/`
|
||||
3. Creates shortcuts in `~/.local/bin/getpkg/`
|
||||
4. Adds to your PATH automatically
|
||||
5. Enables bash completion
|
||||
|
||||
## File Locations
|
||||
|
||||
- **Installed tools**: `~/.getpkg/<tool_name>/`
|
||||
- **Shortcuts**: `~/.local/bin/getpkg/` (in your PATH)
|
||||
- **Settings**: `~/.config/getpkg/`
|
||||
|
||||
## Architecture Support
|
||||
|
||||
getpkg automatically downloads the right version for your system:
|
||||
- Intel/AMD 64-bit (`x86_64`)
|
||||
- ARM 64-bit (`aarch64`)
|
||||
- Universal (works everywhere)
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
**Tool not found after install?**
|
||||
```bash
|
||||
source ~/.bashrc
|
||||
```
|
||||
|
||||
**Permission errors?**
|
||||
getpkg installs to your home directory - no root access needed.
|
||||
|
||||
**Network issues?**
|
||||
Check your internet connection to `getpkg.xyz`.
|
||||
|
||||
## Need Help?
|
||||
|
||||
```bash
|
||||
getpkg help # Show detailed help
|
||||
getpkg list # See what's available
|
||||
```
|
@ -109,7 +109,7 @@ function buildtestpublish() {
|
||||
# Add to projects list
|
||||
PROJECTS+=("$TOOLNAME")
|
||||
|
||||
#cd "$dir" || echo "Failed to cd to $dir"
|
||||
cd "$dir" || echo "Failed to cd to $dir"
|
||||
|
||||
subtitle "🔨 BUILDING $TOOLNAME_UPPER 🔨"
|
||||
if dothis build "$dir" "$TOOLNAME"; then
|
||||
|
@ -3,7 +3,7 @@ set -euo pipefail
|
||||
|
||||
# Get script directory - handle different execution contexts
|
||||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
|
||||
PROJECT="$(basename "$(dirname "${SCRIPT_DIR}")")"
|
||||
PROJECT="$(basename "${SCRIPT_DIR}")"
|
||||
|
||||
# Debug output for CI
|
||||
echo "${PROJECT} build script running from: ${SCRIPT_DIR}"
|
||||
|
@ -70,6 +70,18 @@ ls -la "$OUTPUT_DIR" 2>/dev/null || echo "Output directory not found"
|
||||
if [ ! -f "$DEHYDRATE" ]; then
|
||||
echo -e "${RED}Error: dehydrate binary not found at $DEHYDRATE${NC}"
|
||||
echo "Please run ./build.sh first to build dehydrate"
|
||||
|
||||
if [ -n "${GITEA_CONTAINER_NAME:-}" ]; then
|
||||
echo "Checking if build directory exists..."
|
||||
BUILD_DIR="${GITHUB_WORKSPACE}/dehydrate/build"
|
||||
if [ -d "$BUILD_DIR" ]; then
|
||||
echo "Build directory exists, checking contents:"
|
||||
ls -la "$BUILD_DIR"
|
||||
else
|
||||
echo "Build directory $BUILD_DIR does not exist"
|
||||
fi
|
||||
fi
|
||||
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
192
getpkg/README.md
Normal file
192
getpkg/README.md
Normal file
@ -0,0 +1,192 @@
|
||||
# getpkg - Package Manager for Dropshell Tools
|
||||
|
||||
getpkg is a command-line package manager that simplifies tool installation, management, and publishing for the dropshell ecosystem. Tools are installed to `~/.getpkg/` with executable symlinks in `~/.local/bin/getpkg/` and automatically added to your PATH with bash completion.
|
||||
|
||||
## Installation
|
||||
|
||||
Install getpkg with a single command:
|
||||
|
||||
```bash
|
||||
curl https://getbin.xyz/getpkg-install | bash
|
||||
```
|
||||
|
||||
After installation, restart your shell or run `source ~/.bashrc` to enable the new PATH and completion settings.
|
||||
|
||||
## Basic Usage
|
||||
|
||||
### Installing Tools
|
||||
|
||||
Install any tool from the getpkg registry:
|
||||
|
||||
```bash
|
||||
# Install a tool
|
||||
getpkg install whatsdirty
|
||||
```
|
||||
|
||||
### Managing Installed Tools
|
||||
|
||||
```bash
|
||||
# List all available commands
|
||||
getpkg help
|
||||
|
||||
# Update all installed tools
|
||||
getpkg update
|
||||
|
||||
# Uninstall a tool
|
||||
getpkg uninstall whatsdirty
|
||||
|
||||
# Check getpkg version
|
||||
getpkg version
|
||||
```
|
||||
|
||||
## Available Commands
|
||||
|
||||
### Core Package Management
|
||||
|
||||
- **`getpkg install <tool_name>`** - Install or update a tool
|
||||
- **`getpkg uninstall <tool_name>`** - Remove an installed tool
|
||||
- **`getpkg update`** - Update getpkg and all installed tools
|
||||
|
||||
### Publishing (Requires SOS_WRITE_TOKEN)
|
||||
|
||||
- **`getpkg publish <tool_name[:ARCH]> <folder>`** - Upload a tool to getpkg.xyz
|
||||
- **`getpkg unpublish <tool_name[:ARCH]>`** - Remove a published tool
|
||||
- **`getpkg unpublish <hash>`** - Remove a published tool by hash
|
||||
|
||||
### Development Tools
|
||||
|
||||
- **`getpkg create <tool_name> <directory>`** - Create a new tool project
|
||||
- **`getpkg hash <file_or_directory>`** - Calculate hash of files/directories
|
||||
|
||||
### Information
|
||||
|
||||
- **`getpkg list`** - List all available packages with status
|
||||
- **`getpkg clean`** - Clean up orphaned configs and symlinks
|
||||
- **`getpkg version`** - Show getpkg version
|
||||
- **`getpkg help`** - Show detailed help
|
||||
- **`getpkg autocomplete`** - Show available commands for completion
|
||||
|
||||
## How It Works
|
||||
|
||||
### Installation Process
|
||||
|
||||
When you install a tool, getpkg:
|
||||
|
||||
1. **Downloads** the tool archive from getpkg.xyz
|
||||
2. **Extracts** it to `~/.getpkg/<tool_name>/`
|
||||
3. **Creates symlinks** for all executables in `~/.local/bin/getpkg/`
|
||||
4. **Ensures PATH** includes `~/.local/bin/getpkg` (one-time setup)
|
||||
5. **Enables bash completion** for the tool
|
||||
6. **Runs setup** if a `setup_script.sh` exists
|
||||
7. **Stores metadata** in `~/.config/getpkg/<tool_name>.json`
|
||||
|
||||
### Architecture Support
|
||||
|
||||
getpkg supports multiple architectures:
|
||||
- `x86_64` (Intel/AMD 64-bit)
|
||||
- `aarch64` (ARM 64-bit)
|
||||
- `universal` (cross-platform tools)
|
||||
|
||||
Tools are automatically downloaded for your architecture, with fallback to universal versions.
|
||||
|
||||
### File Locations
|
||||
|
||||
- **Tool files**: `~/.getpkg/<tool_name>/` (actual tool installation)
|
||||
- **Executable symlinks**: `~/.local/bin/getpkg/` (in your PATH)
|
||||
- **Configuration**: `~/.config/getpkg/`
|
||||
- **PATH setup**: `~/.bashrc_getpkg` (sourced by `~/.bashrc`)
|
||||
|
||||
## Examples
|
||||
|
||||
### Installing Popular Tools
|
||||
|
||||
```bash
|
||||
# Install available tools
|
||||
getpkg install dehydrate # File to C++ code generator
|
||||
getpkg install bb64 # Bash base64 encoder/decoder
|
||||
|
||||
# Development tools (for repository development)
|
||||
getpkg install whatsdirty # Check git repo status
|
||||
getpkg install sos # Simple object storage client
|
||||
getpkg install gp # Git push utility
|
||||
```
|
||||
|
||||
### Publishing Your Own Tools
|
||||
|
||||
```bash
|
||||
# Set your publishing token
|
||||
export SOS_WRITE_TOKEN="your-token-here"
|
||||
|
||||
# Create a new tool project
|
||||
getpkg create mytool ./mytool-project
|
||||
|
||||
# Publish architecture-specific build
|
||||
getpkg publish mytool:x86_64 ./build/
|
||||
|
||||
# Publish universal tool
|
||||
getpkg publish mytool ./build/
|
||||
|
||||
# Remove published tool
|
||||
getpkg unpublish mytool:x86_64
|
||||
```
|
||||
|
||||
### Development Workflow
|
||||
|
||||
```bash
|
||||
# Create tool structure
|
||||
getpkg create awesome-tool ./awesome-tool
|
||||
cd awesome-tool
|
||||
|
||||
# Build your tool...
|
||||
# Add executable to the directory
|
||||
|
||||
# Test locally
|
||||
./awesome-tool --version
|
||||
|
||||
# Publish when ready
|
||||
getpkg publish awesome-tool:x86_64 .
|
||||
```
|
||||
|
||||
## Environment Variables
|
||||
|
||||
- **`SOS_WRITE_TOKEN`** - Authentication token for publishing tools
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Tool Not Found
|
||||
If a tool isn't found after installation, ensure your shell has loaded the new PATH:
|
||||
```bash
|
||||
source ~/.bashrc
|
||||
```
|
||||
|
||||
### Permission Issues
|
||||
getpkg installs to your home directory and doesn't require root access. If you encounter permission issues, check that `~/.local/bin/` is writable.
|
||||
|
||||
### Network Issues
|
||||
All tools are downloaded from `getpkg.xyz`. Ensure you have internet connectivity and the domain is accessible.
|
||||
|
||||
## Development
|
||||
|
||||
### Building getpkg
|
||||
|
||||
```bash
|
||||
# Build debug version
|
||||
cd getpkg && ./build.sh
|
||||
|
||||
# Run tests
|
||||
cd getpkg && ./test.sh
|
||||
|
||||
# Publish (requires SOS_WRITE_TOKEN)
|
||||
cd getpkg && ./publish.sh
|
||||
```
|
||||
|
||||
### Tool Development
|
||||
|
||||
When creating tools for getpkg:
|
||||
|
||||
1. Create a directory with your tool binary
|
||||
2. Optionally include a `setup_script.sh` for post-install setup
|
||||
3. The tool should support `version` and `autocomplete` subcommands
|
||||
4. Use `getpkg publish` to upload to the registry
|
||||
|
||||
For more details, see the development documentation in each tool's directory.
|
@ -3,7 +3,7 @@ set -euo pipefail
|
||||
|
||||
# Get script directory - handle different execution contexts
|
||||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
|
||||
PROJECT="$(basename "$(dirname "${SCRIPT_DIR}")")"
|
||||
PROJECT="$(basename "${SCRIPT_DIR}")"
|
||||
|
||||
# Debug output for CI
|
||||
echo "${PROJECT} build script running from: ${SCRIPT_DIR}"
|
||||
|
@ -1150,6 +1150,85 @@ void show_help() {
|
||||
std::cout << " ~/.local/bin/getpkg/ Installed tool binaries" << std::endl;
|
||||
}
|
||||
|
||||
int autocomplete_command(int argc, char* argv[]) {
|
||||
std::vector<std::string> args(argv + 2, argv + argc);
|
||||
|
||||
// If no arguments, return all commands
|
||||
if (args.empty()) {
|
||||
std::cout << "install\n";
|
||||
std::cout << "uninstall\n";
|
||||
std::cout << "publish\n";
|
||||
std::cout << "unpublish\n";
|
||||
std::cout << "update\n";
|
||||
std::cout << "version\n";
|
||||
std::cout << "create\n";
|
||||
std::cout << "hash\n";
|
||||
std::cout << "list\n";
|
||||
std::cout << "clean\n";
|
||||
std::cout << "help\n";
|
||||
return 0;
|
||||
}
|
||||
|
||||
const std::string& subcommand = args[0];
|
||||
|
||||
// Handle autocompletion for specific commands
|
||||
if (subcommand == "install") {
|
||||
// For install, we could suggest popular packages or recently published ones
|
||||
// For now, just return empty (no specific completions)
|
||||
return 0;
|
||||
} else if (subcommand == "uninstall") {
|
||||
// For uninstall, list installed tools
|
||||
std::filesystem::path configDir = std::filesystem::path(std::getenv("HOME")) / ".config" / "getpkg";
|
||||
if (std::filesystem::exists(configDir)) {
|
||||
for (const auto& entry : std::filesystem::directory_iterator(configDir)) {
|
||||
if (entry.path().extension() == ".json") {
|
||||
std::string toolName = entry.path().stem().string();
|
||||
std::cout << toolName << "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
} else if (subcommand == "publish") {
|
||||
// For publish, suggest architecture suffixes after tool name
|
||||
if (args.size() >= 2) {
|
||||
// If we have tool_name already, suggest architectures
|
||||
std::cout << "x86_64\n";
|
||||
std::cout << "aarch64\n";
|
||||
std::cout << "universal\n";
|
||||
}
|
||||
return 0;
|
||||
} else if (subcommand == "unpublish") {
|
||||
// For unpublish, list installed tools (similar to uninstall)
|
||||
std::filesystem::path configDir = std::filesystem::path(std::getenv("HOME")) / ".config" / "getpkg";
|
||||
if (std::filesystem::exists(configDir)) {
|
||||
for (const auto& entry : std::filesystem::directory_iterator(configDir)) {
|
||||
if (entry.path().extension() == ".json") {
|
||||
std::string toolName = entry.path().stem().string();
|
||||
std::cout << toolName << "\n";
|
||||
// Also suggest with architecture suffixes
|
||||
std::cout << toolName << ":x86_64\n";
|
||||
std::cout << toolName << ":aarch64\n";
|
||||
std::cout << toolName << ":universal\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
} else if (subcommand == "create") {
|
||||
// For create, no specific completions (tool name and directory are user-defined)
|
||||
return 0;
|
||||
} else if (subcommand == "hash") {
|
||||
// For hash, suggest file extensions
|
||||
if (args.size() >= 2) {
|
||||
std::cout << "*.tgz\n";
|
||||
std::cout << "*.tar.gz\n";
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// No specific completions for other commands
|
||||
return 0;
|
||||
}
|
||||
|
||||
} // end anonymous namespace
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
@ -1169,19 +1248,7 @@ int main(int argc, char* argv[]) {
|
||||
} else if (command == "update") {
|
||||
return update_tool(argc, argv);
|
||||
} else if (command == "autocomplete") {
|
||||
std::vector<std::string> args(argv + 2, argv + argc);
|
||||
if (args.empty()) std::cout << R"(install
|
||||
uninstall
|
||||
publish
|
||||
unpublish
|
||||
update
|
||||
version
|
||||
create
|
||||
hash
|
||||
list
|
||||
clean
|
||||
help
|
||||
)";
|
||||
return autocomplete_command(argc, argv);
|
||||
} else if (command == "version") {
|
||||
std::cout << dropshell::VERSION << std::endl;
|
||||
} else if (command == "create") {
|
||||
|
@ -25,6 +25,7 @@ GETPKG="${SCRIPT_DIR}/../getpkg/output/getpkg"
|
||||
TOOLDIR="${SCRIPT_DIR}/tool"
|
||||
mkdir -p "${TOOLDIR}"
|
||||
cp "${SCRIPT_DIR}/whatsdirty" "${TOOLDIR}/whatsdirty"
|
||||
cp "${SCRIPT_DIR}/setup_script.sh" "${TOOLDIR}/"
|
||||
|
||||
# publish universal tool.
|
||||
"${GETPKG}" publish "whatsdirty" "${TOOLDIR}"
|
||||
|
Reference in New Issue
Block a user