Skip to content

[deckhouse-cli] Add built-in package command#370

Merged
ldmonster merged 4 commits into
mainfrom
feat/add-package-bootstrapping-command
May 27, 2026
Merged

[deckhouse-cli] Add built-in package command#370
ldmonster merged 4 commits into
mainfrom
feat/add-package-bootstrapping-command

Conversation

@Glitchy-Sheep
Copy link
Copy Markdown
Contributor

Summary

Injected d8 package as a built-in command.

The package command is needed for:

  • scaffold a new module or application skeleton
  • build and push it to a container registry
  • verify package structure against .pkglint.yaml.

How it works

  • The command is a top-level entry point with three subcommands.

  • Internal layout under internal/packagecmd/:

    • pkg/cmd/ - cobra wrappers
    • internal/ - business logic and linters
    • templates/ - //go:embed module/application skeletons and werf stage templates
    • packagecmd.go - thin NewCommand() adapter registered in cmd/d8/root.go

New direct deps in go.mod:

  • github.com/spf13/viper
  • github.com/go-openapi/spec,
  • github.com/go-openapi/swag/yamlutils,
  • golang.org/x/image (webp decoder for icon linter).

Tidy also promoted uuid and mapstructure from indirect.

Before / After

Before: package is a plugin (lazy-loaded) command.

After: package is internal (built-in) command.

Tests

Manual smoke checks:

  • d8 package --help lists bootstrap, build, verify
  • d8 package bootstrap module foo creates a complete module skeleton (charts, docs, hooks, images, openapi, templates, package.yaml, .pkglint.yaml, git init)
  • d8 package bootstrap application foo creates an application skeleton
  • d8 package verify in a generated application package returns 0 errors, 1 warning (missing icon, expected for a bare skeleton)
  • task test passes
  • task lint:check is clean for the new code

- mirror d8-package-plugin layout 1:1: pkg/cmd/, internal/, templates/
- bootstrap/build/verify subcommands; layout/templates/docs/images/oss/icon linters
- add thin packagecmd.go adapter (NewCommand) for cmd/d8/root.go registration
- import paths rewritten: runtime.io/plugins/package/ -> github.com/deckhouse/deckhouse-cli/internal/packagecmd/
- bump go.mod: add viper, go-openapi/spec, swag/yamlutils, golang.org/x/image; tidy promotes uuid, mapstructure
- 2 prealloc fixes for stricter d8-cli linter

Signed-off-by: Roman Berezkin <roman.berezkin@flant.com>
- register packagecmd.NewCommand() in cmd/d8/root.go outside DECKHOUSE_PLUGINS_ENABLED
- drop PackagePluginName constant (no longer wrapped by plugin runner)
- drop redundant "package version" subcommand (use global "d8 --version")

Signed-off-by: Roman Berezkin <roman.berezkin@flant.com>
Signed-off-by: Roman Berezkin <roman.berezkin@flant.com>
@Glitchy-Sheep Glitchy-Sheep self-assigned this May 27, 2026
@Glitchy-Sheep Glitchy-Sheep added the enhancement New feature or request label May 27, 2026
@Glitchy-Sheep Glitchy-Sheep force-pushed the feat/add-package-bootstrapping-command branch 2 times, most recently from 296372a to 32403a7 Compare May 27, 2026 10:35
Signed-off-by: Roman Berezkin <roman.berezkin@flant.com>
@Glitchy-Sheep Glitchy-Sheep marked this pull request as ready for review May 27, 2026 10:49
@Glitchy-Sheep Glitchy-Sheep requested a review from ldmonster as a code owner May 27, 2026 10:49
@ldmonster ldmonster merged commit cf9bf73 into main May 27, 2026
5 checks passed
@ldmonster ldmonster deleted the feat/add-package-bootstrapping-command branch May 27, 2026 15:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants