Skip to content

Add git-ops project slice command group (create, list, inspect)#60

Merged
edvgui merged 9 commits into
masterfrom
issue/slice-create-command
Jun 4, 2026
Merged

Add git-ops project slice command group (create, list, inspect)#60
edvgui merged 9 commits into
masterfrom
issue/slice-create-command

Conversation

@edvgui

@edvgui edvgui commented Jun 2, 2026

Copy link
Copy Markdown
Owner

Add three new commands to manage individual slices of a project from the cli:

  • git-ops project slice create: scaffold a new source slice file containing a placeholder for each required property of the store's schema, recursing into mandatory embedded relations.
  • git-ops project slice list: list the slices of one or all stores, as a table or as json, with the version they would be assigned during an update compile.
  • git-ops project slice inspect: dump the fully-resolved merged view of a single slice as json.

Each command triggers a dedicated compile mode during which no slice is emitted in the model, the command logic runs in a finalizer which sends its result back to the cli process through a temporary output file. The compile output is redirected to stderr so the command result on stdout stays clean for piping.

Also guard the merge of deleted slices against source slices that never had any active version, which previously raised a KeyError.

Add three new commands to manage individual slices of a project from
the cli:

- `git-ops project slice create`: scaffold a new source slice file
  containing a placeholder for each required property of the store's
  schema, recursing into mandatory embedded relations.
- `git-ops project slice list`: list the slices of one or all stores,
  as a table or as json, with the version they would be assigned
  during an update compile.
- `git-ops project slice inspect`: dump the fully-resolved merged view
  of a single slice as json.

Each command triggers a dedicated compile mode during which no slice is
emitted in the model, the command logic runs in a finalizer which sends
its result back to the cli process through a temporary output file.
The compile output is redirected to stderr so the command result on
stdout stays clean for piping.

Also guard the merge of deleted slices against source slices that never
had any active version, which previously raised a KeyError.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@edvgui edvgui self-assigned this Jun 2, 2026
edvgui and others added 7 commits June 2, 2026 21:54
The scaffold of a new slice now also contains the non-required
properties of the store's schema, pre-filled with their default value,
so the created file shows every available property.  Model-only
attributes (marked with exclude_if) stay out of the scaffold, as they
are not part of the slice source files.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Scaffolding a store whose schema has a mandatory embedded relation with
a default factory (e.g. container: Container = Field(default_factory=Container))
failed when the embedded object has required properties of its own: the
factory call raised a validation error.

Embedded relations with a single embedded slice annotation are now
always scaffolded recursively, even when the field has a default, the
same way the entity schema always treats them as mandatory relations.
Other default values are serialized through pydantic, so embedded
objects nested in a default value are written like slice files, and a
default that can not be constructed falls back to the placeholder.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Pass a logging configuration to the slice command compiles (through the
INMANTA_LOGGING_COMPILER_CONTENT environment variable defined by
inmanta-core) which sends all the compiler logs to stderr.  The compiler
no longer logs anything on stdout, which only carries the result of the
slice command.  The stdout redirection to stderr is kept as a safety net
for anything writing to stdout outside of the logging framework.

The logging configuration is only applied when the user didn't configure
the compiler logging themselves, through one of the environment
variables recognized by inmanta-core.  A --logging-config argument
passed to the compile takes precedence over it in any case.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The logging configuration passed to the slice command compiles now
mirrors the default console logging of the compiler: the logs sent to
stderr keep their colors when stderr is a tty.  The FORCE_TTY
environment variable, recognized by inmanta-core, is also set in that
case, so the rest of the compile output (error summary, explainers)
keeps its styling even though it now goes through a pipe.

The compile output is streamed to stderr through that pipe, and the
success/failure banner of the compile summary is dropped on the way.
The error message of a failed compile is preserved.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@edvgui edvgui marked this pull request as ready for review June 4, 2026 17:58
@edvgui edvgui merged commit 4877526 into master Jun 4, 2026
7 checks passed
@edvgui edvgui deleted the issue/slice-create-command branch June 4, 2026 18:03
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.

1 participant