Skip to content

cli/manifest: add manifest and lock data model#1305

Open
bigbes wants to merge 1 commit into
v3from
bigbes/tntp-8220-manifest
Open

cli/manifest: add manifest and lock data model#1305
bigbes wants to merge 1 commit into
v3from
bigbes/tntp-8220-manifest

Conversation

@bigbes

@bigbes bigbes commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator

Introduce cli/manifest, the data layer for tt packages: Go types for the manifest (app.manifest.toml) and lock (app.manifest.lock), TOML read/write, structural validation, format-version handling and manifest_hash. No git, no dependency resolution, no .rocks/ - only the standard library and the TOML library.

  • Manifest/Package/Platform with the platform constraint parsed into semver part and [ce]/[ee] flavor (Constraint via TextMarshaler).
  • Dependency decodes both the short (bare constraint string) and long (table) forms from one map via go-toml's unstable.Unmarshaler.
  • Lock serializes to the [lock.products.] table tree through an internal wire struct (go-toml does not split dotted struct tags).
  • Validate() does structural checks; format-version rules split unknown fields (warn on newer minor, fail otherwise, refuse newer major) from unknown enum values (always fail). manifest_hash is SHA-256 of the raw file bytes.

Closes TNTP-8220

@bigbes bigbes force-pushed the bigbes/tntp-8220-manifest branch from a9110ef to ab294f8 Compare June 18, 2026 12:25
Comment thread cli/manifest/constraint.go Outdated
Comment on lines +63 to +79
open := strings.LastIndex(s, "[")
if open < 0 {
return fmt.Errorf("invalid version constraint %q: unbalanced %q", s, "[")
}
flavor := s[open+1 : len(s)-1]
version := s[:open]
switch flavor {
case "ce", "ee":
default:
return fmt.Errorf("invalid version constraint %q: unknown flavor %q (want [ce] or [ee])", s, flavor)
}
if version == "" {
return fmt.Errorf("invalid version constraint %q: missing version before flavor", s)
}
c.Version = version
c.Flavor = flavor
return nil

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, add a newlines for better readability.

// UnmarshalTOML implements the go-toml unstable.Unmarshaler interface so a
// dependency can decode from either a bare string or a table. The decoder must
// have EnableUnmarshalerInterface set (ParseManifest/ParseLock do).
func (d *Dependency) UnmarshalTOML(node *unstable.Node) error {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And here.

Comment thread cli/manifest/manifest.go
Description string `toml:"description,omitempty"`
License string `toml:"license,omitempty"`
LicenseFiles []string `toml:"license_files,omitempty"`
Include []string `toml:"include,omitempty"`

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For what is this field?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's for an additional files to be passed with result artefact, like README or whatsnot expected by the user.

Introduce cli/manifest, the data layer for tt packages: Go types for the
manifest (app.manifest.toml) and lock (app.manifest.lock), TOML read/write,
structural validation, format-version handling and manifest_hash. No git, no
dependency resolution, no .rocks/ - only the standard library and the TOML
library.

* Manifest/Package/Platform with the platform constraint parsed into
  semver part and [ce]/[ee] flavor (Constraint via TextMarshaler).
* Dependency decodes both the short (bare constraint string) and long
  (table) forms from one map via go-toml's unstable.Unmarshaler.
* Lock serializes to the [lock.products.<name>] table tree through an
  internal wire struct (go-toml does not split dotted struct tags).
* Validate() does structural checks; format-version rules split unknown
  fields (warn on newer minor, fail otherwise, refuse newer major) from
  unknown enum values (always fail). manifest_hash is SHA-256 of the raw
  file bytes.

Closes TNTP-8220
@bigbes bigbes force-pushed the bigbes/tntp-8220-manifest branch from da0d62c to ad39626 Compare June 23, 2026 18:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants