
Security News
/Research
npm Phishing Email Targets Developers with Typosquatted Domain
A phishing attack targeted developers using a typosquatted npm domain (npnjs.com) to steal credentials via fake login pages - watch out for similar scams.
github.com/omnicli/sdk-go
Go SDK for building Omni commands.
omnicli
is a Go package that provides functionality to help build commands that will be executed by Omni. It offers various utilities and helpers that make it easier to work with Omni's features from within Go.
go get github.com/omnicli/sdk-go
The SDK can read omni-parsed arguments from environment variables into Go structs:
package main
import (
"log"
omnicli "github.com/omnicli/sdk-go"
)
//go:generate omni-metagen-go -struct=Config -output=dist/my-command.metadata.yaml
type Config struct {
// Fields are automatically mapped to kebab-case CLI arguments
InputFile string // maps to --input-file
Verbose bool // maps to --verbose
LogFile *string // maps to --log-file, optional
Workers []string // maps to --workers (array)
// Use tags for custom names or to skip fields
DBHost string `omniarg:"db_host"` // custom name
Internal string `omniarg:"-"` // skip this field
}
func main() {
var cfg Config
_, err := omnicli.ParseArgs(&cfg)
if err != nil {
log.Fatalf("Failed to parse args: %v", err)
}
if cfg.Verbose {
log.Println("Verbose mode enabled")
}
if cfg.InputFile != "" {
log.Printf("Processing file: %s", cfg.InputFile)
}
}
The resulting arguments can be accessed either through the populated struct or through the returned Args
object, which provides type-safe getters for all values.
The argument parser of omni needs to be enabled for your command. This can be done as part of the metadata of your command, which can either be provided as a separate file:
your-repo
└── commands
├── your-command.go
├── your-command.sh
└── your-command.metadata.yaml
# your-command.metadata.yaml
argparser: true
Or as part of your command file wrapper header:
#!/usr/bin/env bash
#
# argparser: true
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
go run "${DIR}"/your-command.go "$@"
The SDK provides a code generation tool omni-metagen-go
that can be used to generate metadata files for your commands. This tool will generate the metadata in YAML format based on the struct you provide. You will still need to indicate the name of the struct and the location of the output file (which should be in the same directory as your command, and named <command>.metadata.yaml
).
You can install the tool by running:
go install github.com/omnicli/sdk-go/cmd/omni-metagen-go@latest
Or by using GitHub releases in omni:
up:
- github-releases:
omnicli/sdk-go: latest
The example above shows how to setup the metadata generation in your Go code. You can then call go generate ./...
to generate the metadata file.
To set up for development:
# Clone the repository
omni clone https://github.com/omnicli/sdk-go.git
# Install dependencies
omni up
# Run tests
omni test
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
/Research
A phishing attack targeted developers using a typosquatted npm domain (npnjs.com) to steal credentials via fake login pages - watch out for similar scams.
Security News
Knip hits 500 releases with v5.62.0, refining TypeScript config detection and updating plugins as monthly npm downloads approach 12M.
Security News
The EU Cyber Resilience Act is prompting compliance requests that open source maintainers may not be obligated or equipped to handle.