cli

package
v1.28.0 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2026 License: Apache-2.0 Imports: 57 Imported by: 0

Documentation

Overview

`nucleus generate module <name>` — the package-per-feature slice generator (ADR-022 §4). Where `generate resource` spreads a feature across the layer packages (models/controllers/services/repositories/ modules), this emits ONE self-contained package under internal/<name>/ that carries everything the feature needs: model+storage, controller, mountable module with its own Policies and CSRF exemption, embedded migrations applied through rt.ApplyModuleMigrations, and an embedded page template. Mounting it is the whole integration — no rbac_policy.csv or nucleus.yml edits, no manual migrate step.

Route-table printing and `--with-policy` seeding for the generators (GF-04). The audit measured the first POST against a freshly generated resource as a 403→404→419 ladder: the default-deny authorizer masks the 404 of a guessed path, the generator never said which routes it mounted, and the scaffold's CSRF exemptions do not cover the new API. This file closes the three gaps: the generator prints the exact route table it wired, and --with-policy seeds the anonymous RBAC rows plus the CSRF exemption the way `generate module` already carries them.

Index

Constants

This section is empty.

Variables

View Source
var Version = "dev"

Version is injected at build time in releases via ldflags:

go build -ldflags "-X github.com/jcsvwinston/nucleus/internal/cli.Version=v1.13.0" ./cmd/nucleus

It is deliberately NOT the whole answer. `go install pkg@vX.Y.Z` — the path the README documents and the one every consumer actually uses — passes no ldflags, so this stayed at its placeholder and `nucleus version` answered "dev" for a binary installed at an exact version (QCD-CLI-6). The binary knew: `go version -m` reads the module version out of its own build info. The command just never asked.

In a CLI-first product `version` is the primary evidence of WHICH CLI produced an artifact, so "dev" made a release and a hand-compiled binary indistinguishable. cliVersion falls back to build info, the way the quark CLI in this same suite already did.

Functions

func ContractAliasCommandNames

func ContractAliasCommandNames() []string

ContractAliasCommandNames returns the sorted list of CLI alias names (e.g. "runserver", "makemigrations"). Mirrors ContractPrimaryCommandNames for callers that need to recognise both primary commands and their Django-style aliases — the website CLI overview parity test in contracts/ being one such caller.

func ContractPrimaryCommandNames

func ContractPrimaryCommandNames() []string

ContractPrimaryCommandNames returns the sorted list of primary CLI command names that are considered part of the root command surface contract.

func Run

func Run(args []string, stdin io.Reader, stdout, stderr io.Writer) int

Run executes the CLI command dispatch and returns a process exit code.

Types

This section is empty.

Directories

Path Synopsis
Package scaffold renders the `nucleus new` starter project from a tree of embedded template files instead of inline Go string literals.
Package scaffold renders the `nucleus new` starter project from a tree of embedded template files instead of inline Go string literals.

Jump to

Keyboard shortcuts

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