
Security News
npm ‘is’ Package Hijacked in Expanding Supply Chain Attack
The ongoing npm phishing campaign escalates as attackers hijack the popular 'is' package, embedding malware in multiple versions.
github.com/jrschumacher/adder
🐍 Documentation-driven CLI generator for Cobra based Go applications
Adder generates type-safe CLI commands from markdown documentation, providing a clean separation between command structure and business logic.
Via Go Install:
go install github.com/jrschumacher/adder/cmd@latest
Via GitHub Releases:
# Download binary for your platform from:
# https://github.com/jrschumacher/adder/releases
Create docs/man/hello.md
:
---
title: Say hello to someone
command:
name: hello [name]
arguments:
- name: name
description: Name of the person to greet
required: true
type: string
flags:
- name: capitalize
description: Capitalize the greeting
type: bool
---
# Say hello to someone
Greet someone with a friendly hello message.
adder generate -i docs/man -o generated -p generated
func (h *HelloHandler) HandleHello(cmd *cobra.Command, req *generated.HelloRequest) error {
greeting := fmt.Sprintf("Hello, %s!", req.Arguments.Name)
if req.Flags.Capitalize {
greeting = strings.ToUpper(greeting)
}
fmt.Println(greeting)
return nil
}
handler := &HelloHandler{}
helloCmd := generated.NewHelloCommand(handler)
rootCmd.AddCommand(helloCmd)
Adder creates clean, type-safe structures:
// Separate arguments from flags for clarity
type HelloRequestArguments struct {
Name string `json:"name" validate:"required"`
}
type HelloRequestFlags struct {
Capitalize bool `json:"capitalize"`
}
type HelloRequest struct {
Arguments HelloRequestArguments `json:"arguments"`
Flags HelloRequestFlags `json:"flags"`
}
// Handler receives full command access
type HelloHandler interface {
HandleHello(cmd *cobra.Command, req *HelloRequest) error
}
Adder preserves your documentation structure:
docs/man/ generated/
├── auth/ ├── auth/
│ └── login.md → │ └── login_generated.go
└── policy/ └── policy/
└── create.md → └── create_generated.go
This prevents naming conflicts between commands like auth create
and policy create
.
Feature | Benefit |
---|---|
Type Safety | Compile-time validation prevents runtime errors |
Documentation-First | Single source of truth in readable format |
Performance | No runtime parsing of embedded docs |
Clean Architecture | Handler interfaces promote testability |
Organized Output | Directory structure prevents naming conflicts |
Command Access | Full *cobra.Command capabilities available |
Adder is built with production use in mind:
Adder includes comprehensive testing:
# Run all tests
make test
# Run with coverage
make test-coverage
# Run linting
make lint
# Run all CI checks locally
make ci-test
Test Categories:
Local Development:
# Build the CLI
make build
# Build for all platforms (uses GitHub Actions)
make build-all
# Generate example commands
make generate-example
# Self-generate CLI commands (dogfooding)
make generate-self
$ hello-example hello "Adder" --capitalize
HELLO, ADDER!
$ adder generate --input docs/man --output generated --package generated
🐍 Generating CLI commands from docs/man to generated...
🔍 Validating documentation...
✅ Code generation completed!
📊 Generated 3 commands with 5 flags and 2 arguments
Adder uses automated releases with release-please and GoReleaser:
Use conventional commits for automatic versioning:
feat:
→ minor version bumpfix:
→ patch version bumpBREAKING CHANGE:
→ major version bumpWe welcome contributions!
Getting Started:
make ci-test
to validateCode Quality:
MIT License - see LICENSE file for details.
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The ongoing npm phishing campaign escalates as attackers hijack the popular 'is' package, embedding malware in multiple versions.
Security News
A critical flaw in the popular npm form-data package could allow HTTP parameter pollution, affecting millions of projects until patched versions are adopted.
Security News
Bun 1.2.19 introduces isolated installs for smoother monorepo workflows, along with performance boosts, new tooling, and key compatibility fixes.