pk-tools

module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 8, 2026 License: Apache-2.0

README

pk-tools

Go Reference CI

pk-tools provides the shared CLI and terminal-UI primitives for the OSS PlatformKit family: root-command assembly, JSON output helpers, context-aware command visibility, and terminal-aware status and table rendering. It deliberately ships reusable command-shell behavior only — product-specific commands live in downstream applications and compose these packages.

Install

go get github.com/septagon-oss/pk-tools@v0.1.0

Usage

package main

import (
	"github.com/septagon-oss/pk-tools/pkg/cliapp"
	"github.com/spf13/cobra"
)

func main() {
	root := cliapp.NewRoot(cliapp.RootOptions{
		Use:     "demo",
		Short:   "Demo CLI built on pk-tools primitives",
		Version: "v0.1.0",
		Commands: []*cobra.Command{
			{Use: "greet", RunE: func(cmd *cobra.Command, _ []string) error {
				cmd.Println("hello from pk-tools")
				return nil
			}},
		},
	})

	if err := cliapp.Execute(root); err != nil {
		panic(err)
	}
}

Current Surface

  • pkg/cliapp — root *cobra.Command assembly via NewRoot/RootOptions, Execute, argument helpers (HasArg, ShowAllCommands, AddHiddenBoolFlag), and JSON output helpers (WriteJSON, SortedMapKeys).
  • pkg/tui — terminal-aware Renderer with Info/Success/Warn/Error status lines, Table rendering, CommandStart banners, and a configurable Palette with NO_COLOR-aware color detection.
  • pkg/scaffoldexperimental code generators (module, entity, feature, project). Not part of the supported v0.1.0 surface yet: the default import roots are placeholders pending a public-split rework. Use at your own risk.
  • cmd/pk — the pk developer CLI (doctor, verify, explain modules) built on these primitives.

Verify

make verify   # go test + go vet + staticcheck + race

License

Apache-2.0. See LICENSE.

Directories

Path Synopsis
cmd
pk command
Package main implements the `pk` OSS developer CLI for PlatformKit.
Package main implements the `pk` OSS developer CLI for PlatformKit.
pkg
cliapp
Package cliapp provides composable Cobra application primitives.
Package cliapp provides composable Cobra application primitives.
scaffold
Package scaffold provides standalone code generation for platformkit modules, entities, and features.
Package scaffold provides standalone code generation for platformkit modules, entities, and features.
tui
Package tui contains terminal-aware rendering primitives for PlatformKit CLIs.
Package tui contains terminal-aware rendering primitives for PlatformKit CLIs.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL