Skip to content

Add create-package tool for scaffolding bash packages#1

Merged
punppis merged 3 commits into
mainfrom
copilot/add-create-package-tool
Jan 29, 2026
Merged

Add create-package tool for scaffolding bash packages#1
punppis merged 3 commits into
mainfrom
copilot/add-create-package-tool

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 29, 2026

Adds a root-level create-package script to quickly scaffold new package directories with bash script templates.

Changes

  • New executable: create-package

    • Accepts package names from CLI args or stdin
    • Sanitizes names: lowercase, [a-z0-9-] only, collapses multiple dashes
    • Creates <package>/<package> directory structure with executable script
    • Generated scripts include #!/usr/bin/env bash, set -euo pipefail, and basic template
    • Colored output (red/green) for errors/success
    • Validates against empty names and existing directories
  • Documentation: README.md

    • Usage examples for CLI and piped input
    • Sanitization rules and error handling behavior

Usage

# CLI argument
./create-package "My Tool"
# Creates: my-tool/my-tool

# Stdin
echo "My Tool" | ./create-package

Generated script template:

#!/usr/bin/env bash
set -euo pipefail

echo "Hello from my-tool!"
Original prompt

Add a root-level create-package bash tool to the punppis/linux-utils repository and document it in the root README.md.

Requirements:

  • Add a new executable bash script at repository root named create-package.
  • Script behavior:
    • Accept a package name from either stdin (when piped) or from CLI args ($1/$@).
    • Sanitize the name to lowercase and ensure only [a-z0-9-]* characters remain (letters, numbers, dashes). Convert spaces/underscores to dashes and collapse multiple dashes.
    • If the sanitized name is empty, exit non-zero with a helpful error.
    • If a directory with that name already exists, exit non-zero and print a clear message.
    • Otherwise create a folder named after the package and inside it create a bash script file with the same name and no extension (<package>/<package>), mark it executable.
    • The generated package script should include:
      • shebang #!/bin/bash
      • set -euo pipefail
      • a simple hello message including the package name
  • Add red and green helper functions to create-package for colored output.
  • Update root README.md to include usage instructions and an example for create-package.
  • Ensure compatibility with Debian/Ubuntu/Raspberry Pi environments.

Acceptance criteria:

  • Running ./create-package "My Tool" creates my-tool/my-tool (executable) with the template content.
  • Running echo "My Tool" | ./create-package works.
  • Running with an existing directory fails.
  • README documents usage and describes sanitization rules.

This pull request was created from Copilot chat.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: punppis <6446823+punppis@users.noreply.github.com>
Co-authored-by: punppis <6446823+punppis@users.noreply.github.com>
Copilot AI changed the title [WIP] Add create-package bash tool to repository Add create-package tool for scaffolding bash packages Jan 29, 2026
Copilot AI requested a review from punppis January 29, 2026 21:59
@punppis punppis marked this pull request as ready for review January 29, 2026 22:03
@punppis punppis merged commit 2d173d8 into main Jan 29, 2026
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.

2 participants