Skip to content
Beskid Platform specification

Beskid

Jump to a Beskid service

Beskid

Jump to a Beskid service

Package kinds

Platform spec feature

Package kinds

Spec standingStandard

Owner
Piotr Mikstacki
Submitter
Piotr Mikstacki

What this feature specifies

The packageKind field on beskid.package.v1 — discriminates library, template, and tool packages, each with a normative validator profile, dashboard surface, and CLI routing. tool is Standard as of D-TOOL-PCKG-0004 (this feature) — the previous Reserved status (D-TOOL-PCKG-0002) is superseded.

Implementation anchors

  • pckg/src/Server/Services/PackageKinds.cs — kind constants and IsSupported / IsTemplate / IsTool predicates
  • pckg/src/Server/Services/PackageArtifactValidator.cs — per-kind validator profiles (library / template / tool)
  • pckg/src/Server/Services/PackagePublishDocumentation.cs — exempts template and tool from structured api.json requirements
  • pckg/src/Server/Components/Pages/PackageDetails.razor(.cs) — Fluent UI dashboard routing (badge, install-instructions card, hidden Documentation / Source tabs for template and tool)
  • compiler/crates/beskid_pckg/src/pack.rs and cli.rs — Rust PackProfile (Library / Template / Tool), detect_pack_profile_with_override, strip_tool_pack_excludes, and beskid pckg pack --package-kind {auto,tool}

Contract statement

Every published beskid.package.v1 artifact must declare its role through packageKind. Kinds drive validator profiles, registry UI routing, and CLI behavior. Unknown packageKind values must be rejected at publish time with a structured BadRequest diagnostic, never a 500.

project.type on Project.proj is the project-tree analogue (Host, Mod, Template, …); packageKind is the registry artifact analogue—they are related but not interchangeable.

Normative kinds

packageKindPurposeapi.json requirement.beskid/template.jsonPrimary CLI
library (default)Beskid source package consumed as dependencyRequired when server policy mandates api.jsonForbiddenbeskid pckg pack, consumer beskid fetch
templateScaffold package for beskid newForbidden in artifact body; structured docs hidden in UIRequiredbeskid new install, beskid new <shortName>
toolCLI / developer-tool binaries and CLI-only packages distributed via pckgOptional — server does not require it, validator does not reject its absenceForbidden (tool and template are mutually exclusive)beskid pckg pack --package-kind tool, consumer beskid pckg download <name> --version <v> --output <path>

Unknown packageKind values must be rejected at publish time. The server must reject a tool artifact that contains .beskid/template.json (and vice versa) with a deterministic message naming the conflicting file.

Validator profile per kind

The pckg server applies the kind-specific validator profile during publish:

  • library — when the server enforces structured docs, the artifact must carry .beskid/docs/api.json; the artifact must not carry .beskid/template.json.
  • template — the artifact must carry .beskid/template.json and must not carry .beskid/docs/api.json (server treats template-kind artifacts as scaffold-only; the dashboard hides the Documentation and Source tabs).
  • tool — the artifact may omit .beskid/docs/api.json entirely (no docs-required diagnostic fires); it must not carry .beskid/template.json. The dashboard renders a Tool package Fluent badge and an install-instructions card with the registry download command (beskid pckg download …).

All kinds remain subject to the shared safeguards: zip-bomb / path-traversal guards, package-id authorization, and per-package owner gating.

CLI routing

The Beskid CLI surfaces packageKind through beskid pckg pack --package-kind {auto, tool}:

  • auto (default) — reproduces the historical manifest-driven detection. Project.proj with type = Template packs a template artifact (template summary copied from .beskid/template.json); any other manifest or a missing manifest packs a library artifact.
  • tool — packs a tool artifact even when Project.proj is absent, which is the expected layout for CLI-only tool packages. --package-kind tool must reject template projects (manifest with type = Template) so a template payload is never silently lost; the error message must name --package-kind tool so users can correct it.

tool pack runs strip generated .beskid/docs/** entries from the artifact (strip_tool_pack_excludes); tool package.json omits documentation.apiJson and the schema version pointer.

Consumers download tool artifacts with beskid pckg download <name> --version <v> --output <path>; the dashboard install card surfaces the exact command (e.g. beskid pckg download beskid-fmt-extra --version 0.1.0 --output ./beskid-fmt-extra.bpk).

Project.type alignment

project.typeTypical packageKind when published
(absent) / Hostlibrary (or tool via --package-kind tool for CLI-only packages with no Project.proj)
Modlibrary
Templatetemplate

A library package must not publish with type: Template on Project.proj. A template package must include .beskid/template.json. A tool package must not include .beskid/template.json; it does not require Project.proj at all.

Versioning

All kinds share: registry-assigned publish semver, immutability per version, yank, checksum verification, and download URLs.

Decisions

  • D-TOOL-PCKG-0001 — Explicit packageKind field on beskid.package.v1 (see adr/0001-explicit-package-kind-field.mdx).
  • D-TOOL-PCKG-0002Superseded. tool packageKind no longer reserved; see adr/0002-tool-kind-reserved.mdx for the historical record and adr/0004-tool-kind-standard.mdx for the active decision.
  • D-TOOL-PCKG-0003beskid.templates.* identity prefix for template packages (see adr/0003-beskid-templates-prefix.mdx).
  • D-TOOL-PCKG-0004tool packageKind is Standard with a normative validator profile, CLI override, and dashboard routing (adr/0004-tool-kind-standard.mdx).

Use the ADRs tab to expand each decision.

Verification and traceability

  • pckg/src/Server.Tests/Unit/PackageArtifactValidatorTests.csValidateAsync_Accepts_Tool_Artifact_Without_Api_Json, ValidateAsync_Accepts_Tool_Artifact_With_Optional_Api_Json, ValidateAsync_Rejects_Tool_With_Template_Json, ValidateAsync_Rejects_Unknown_Package_Kind.
  • pckg/src/Server.Tests/Unit/PackagePublishDocumentationTests.csEnsureStructuredApiDoc_skips_tool_packages.
  • pckg/src/Server.Tests/Integration/ToolPackagePublishIntegrationTests.cs — end-to-end tool publish with structured docs absent, kind persisted on the version summary.
  • compiler/crates/beskid_pckg/src/pack.rs tests — pack_profile_helpers_track_variant, build_package_json_tool_profile_omits_api_doc_pointer, strip_tool_pack_excludes_removes_generated_docs, detect_pack_profile_with_override_forces_tool_when_no_manifest, detect_pack_profile_with_override_rejects_template_project, detect_pack_profile_auto_matches_legacy_behavior.
  • compiler/crates/beskid_pckg/src/cli.rs tests — pack_args_default_package_kind_is_auto, pack_args_package_kind_tool_flag_parses, pack_args_package_kind_rejects_unknown_value.
  • Template packages — the template packageKind.
  • pckg client contract — publish / download surface used by tool packages.
  • Formatter — representative tool delivered via beskid format (a possible future packageKind: tool distribution candidate).
  • api.json contract — applies to library packages; does not apply to tool artifacts.