Skip to content

feat(cli)!: reorganize add/remove commands - #574

Merged
andrius-puksta-sensmetry merged 1 commit into
sensmetry:mainfrom
andrius-puksta-sensmetry:pr/reorganize-add-remove
Sep 29, 2026
Merged

andrius-puksta-sensmetry merged 1 commit into
sensmetry:mainfrom
andrius-puksta-sensmetry:pr/reorganize-add-remove

Conversation

@andrius-puksta-sensmetry

Copy link
Copy Markdown
Collaborator

Change arguments and fold experimental commands into the non-experimental ones.

Also made file parsers use stricter types where possible.

Comment thread sysand/src/cli.rs
Comment thread sysand/src/commands/add.rs Outdated
vytautas-astrauskas-sensmetry added a commit that referenced this pull request Sep 29, 2026
- Python `add` takes `lock`, `sync` and `prune` (all `True` by default)
  instead of `no_lock`, `no_sync` and `no_prune`, avoiding double
  negation.
- Removing by publisher and name, in Python and in `sysand remove
  <publisher>/<name>`, removes the project's usages of every kind: index,
  directory and KPAR usages, and a `pkg:sysand` resource usage. Each field
  matches spelled as the usage spells it, or normalized, as #574 does for
  the CLI. Python can now remove directory and KPAR usages, so the Python
  special cases for "cannot remove them yet" are gone.
- Every typed usage kind (directory, KPAR, index) now rejects keys it
  does not define, not only index usages, so a future field such as a
  constraint on a directory usage is never silently dropped. Resource
  usages, the shape KerML specifies, keep ignoring unknown keys, since
  existing manifests carry extra keys in them. Index protocol §14 and
  RELEASE.md say so.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Change arguments and fold `experimental` commands into the
non-experimental ones.

Also made file parsers use stricter types where possible.

Signed-off-by: Andrius Pukšta <andrius.puksta@sensmetry.com>
@andrius-puksta-sensmetry
andrius-puksta-sensmetry merged commit c89bc76 into sensmetry:main Sep 29, 2026
2 checks passed
andrius-puksta-sensmetry added a commit that referenced this pull request Oct 1, 2026
An index usage names a project by publisher and name, and has to spell
them exactly as the project does. `add` now accepts two spellings: the
project's own, which is checked, and the fully normalized one (lowercase,
hyphens for spaces), which takes the project's spelling.

- When locking, a normalized usage is first resolved by identifier as a
  placeholder, then written with the spelling of the project locked.
  Any other spelling is checked by the lock, as before.
- With `--no-lock`, the spelling is checked against, or taken from, the
  versions installed in the local environment that match the version
  constraint, without any network request. It fails when none is
  installed, or when those installed disagree on the spelling.
- A clash with a usage of another kind is reported before anything is
  looked up.

The lock's spelling error now says outright that the usage resolved but
was rejected for its spelling, and which spelling to use.

An index usage has to spell a project's publisher and name exactly as
the project does, so every version of a project in an index has to
spell them the same way. `sysand index add` now refuses a version
spelled differently from the versions already in the index (yanked ones
included, removed ones left out), and any version of a project whose
existing versions already disagree.

The index protocol records one spelling per project as a server
obligation.

`add` now runs `sysand add` itself: after declaring the usage it locks
and syncs, unless `no_lock` or `no_sync`, and restores `.project.json`
if either fails. It takes `no_lock`, `no_sync`, `no_prune`, `resolution`
and `auth`, and checks and recovers the spelling of index usages the way
the CLI does. With `no_lock=True`, it only edits `.project.json`, and an
index usage needs a matching version installed in the environment.

`version_constraint` stays required.

- Python `add` takes `lock`, `sync` and `prune` (all `True` by default)
  instead of `no_lock`, `no_sync` and `no_prune`, avoiding double
  negation.
- Removing by publisher and name, in Python and in `sysand remove
  <publisher>/<name>`, removes the project's usages of every kind: index,
  directory and KPAR usages, and a `pkg:sysand` resource usage. Each field
  matches spelled as the usage spells it, or normalized, as #574 does for
  the CLI. Python can now remove directory and KPAR usages, so the Python
  special cases for "cannot remove them yet" are gone.
- Every typed usage kind (directory, KPAR, index) now rejects keys it
  does not define, not only index usages, so a future field such as a
  constraint on a directory usage is never silently dropped. Resource
  usages, the shape KerML specifies, keep ignoring unknown keys, since
  existing manifests carry extra keys in them. Index protocol §14 and
  RELEASE.md say so.

Co-authored-by: Andrius Pukšta <andrius.puksta@sensmetry.com>
Signed-off-by: vytautas-astrauskas-sensmetry <vytautas.astrauskas@sensmetry.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
andrius-puksta-sensmetry added a commit that referenced this pull request Oct 1, 2026
An index usage names a project by publisher and name, and has to spell
them exactly as the project does. `add` now accepts two spellings: the
project's own, which is checked, and the fully normalized one
(lowercase,
hyphens for spaces), which takes the project's spelling.

- When locking, a normalized usage is first resolved by identifier as a
  placeholder, then written with the spelling of the project locked.
  Any other spelling is checked by the lock, as before.
- With `--no-lock`, the spelling is checked against, or taken from, the
  versions installed in the local environment that match the version
  constraint, without any network request. It fails when none is
  installed, or when those installed disagree on the spelling.
- A clash with a usage of another kind is reported before anything is
  looked up.

The lock's spelling error now says outright that the usage resolved but
was rejected for its spelling, and which spelling to use.

An index usage has to spell a project's publisher and name exactly as
the project does, so every version of a project in an index has to
spell them the same way. `sysand index add` now refuses a version
spelled differently from the versions already in the index (yanked ones
included, removed ones left out), and any version of a project whose
existing versions already disagree.

The index protocol records one spelling per project as a server
obligation.

`add` now runs `sysand add` itself: after declaring the usage it locks
and syncs, unless `no_lock` or `no_sync`, and restores `.project.json`
if either fails. It takes `no_lock`, `no_sync`, `no_prune`, `resolution`
and `auth`, and checks and recovers the spelling of index usages the way
the CLI does. With `no_lock=True`, it only edits `.project.json`, and an
index usage needs a matching version installed in the environment.

`version_constraint` stays required.

- Python `add` takes `lock`, `sync` and `prune` (all `True` by default)
  instead of `no_lock`, `no_sync` and `no_prune`, avoiding double
  negation.
- Removing by publisher and name, in Python and in `sysand remove
  <publisher>/<name>`, removes the project's usages of every kind:
index,
  directory and KPAR usages, and a `pkg:sysand` resource usage. Each
field
  matches spelled as the usage spells it, or normalized, as #574 does
for
  the CLI. Python can now remove directory and KPAR usages, so the
Python
  special cases for "cannot remove them yet" are gone.
- Every typed usage kind (directory, KPAR, index) now rejects keys it
  does not define, not only index usages, so a future field such as a
  constraint on a directory usage is never silently dropped. Resource
  usages, the shape KerML specifies, keep ignoring unknown keys, since
  existing manifests carry extra keys in them. Index protocol §14 and
  RELEASE.md say so.

Co-authored-by: Andrius Pukšta <andrius.puksta@sensmetry.com>
Signed-off-by: Vytautas Astrauskas <vytautas.astrauskas@sensmetry.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

2 participants