Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 12 additions & 13 deletions .claude/skills/release/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,24 +56,25 @@ and report the specific reason; do not attempt to fix it silently.
user to push first — the next check depends on it.
5. **Normal branch state.** `git merge-base --is-ancestor main develop` succeeds.
If it fails, this is the hotfix or divergence case: stop.
6. **The two cmemc pins agree.**
6. **cmemc is pinned once, and only in the generated Taskfile.**

```bash
grep -o 'cmem-cmemc[=@]*[0-9.]*' .github/workflows/check.yml src/.gitlab-ci.yml.jinja
grep -n '^ CMEMC_VERSION: [0-9]' src/Taskfile.yaml
grep -n 'cmem-cmemc' .github/workflows/check.yml src/.gitlab-ci.yml.jinja
```

`.github/workflows/check.yml` pins the cmemc that *this repository's* CI
tests with; `src/.gitlab-ci.yml.jinja` pins the cmemc that *generated
packages* will run. They are independent literals with no coupling and
have silently diverged before. If the versions differ, stop: a release in
that state ships packages tested against a different cmemc than they use,
and a published tag cannot be withdrawn.
The first must print exactly one line: `CMEMC_VERSION` is the cmemc
release every generated task runs, locally and in both pipelines. The
second must print nothing. A cmemc install in either pipeline is a second
pin, and when there were two they silently diverged, so a release could
ship packages tested against a different cmemc than they use. If either
check fails, stop: a published tag cannot be withdrawn.

If `grep` reports either file as missing, treat that as a failure of this
If `grep` reports a file as missing, treat that as a failure of this
check rather than a reason to skip it — the generated pipeline has been
renamed before (it gained the `.jinja` suffix in 1.5.0, when the
`marketplace` answer made it a rendered template), and a stale path here
silently compares nothing.
silently checks nothing.

7. **Changelog is ready.** `CHANGELOG.md` contains a `## [Unreleased]` heading
followed by at least one `### Added|Changed|Deprecated|Removed|Fixed|Security`
Expand All @@ -90,9 +91,7 @@ and report the specific reason; do not attempt to fix it silently.

Changes *outside* `src/` — this repository's own `Taskfile.yaml`, `tests/`,
`.github/`, or this skill — are template-internal and are normally not
listed at all. The exception is the cmemc pin in
`.github/workflows/check.yml`, which is bumped in lockstep with the one in
`src/` and is named in the entry the `src/` change earns.
listed at all.

8. **Signing works.** Verify gpg can sign non-interactively *now*, rather than
discovering it cannot after the release commit exists:
Expand Down
16 changes: 6 additions & 10 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,23 +36,19 @@ jobs:
with:
python-version: '3.13'

# A generated package's `task check:offline` runs the checks in `bin/`
# by path through their `uv run --script` shebang, which resolves their
# dependencies from each script's inline PEP 723 metadata. Generated
# packages meet uv in their own pipeline image, which already installs
# cmemc with it; this repository
# installs cmemc with pip, so it has to ask for uv explicitly.
# A generated package needs uv twice over: its `task check:offline` runs
# the checks in `bin/` by path through their `uv run --script` shebang,
# and every task that talks to Corporate Memory runs the cmemc release
# pinned in the generated Taskfile.yaml through uvx. Generated packages
# meet uv in their own pipeline image; this runner has to ask for it.
# No cmemc is installed here for the same reason as there.
- name: Install uv
uses: astral-sh/setup-uv@v7

- name: install copier
run: |
python3 -m pip install --user 'copier>=9.0.0'

- name: install cmemc
run: |
python3 -m pip install --user cmem-cmemc==26.2.1

- name: create projects with default answers and run check
env:
CMEM_BASE_URI: ${{ secrets.CMEM_BASE_URI }}
Expand Down
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,17 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p

## [Unreleased]

### Added

- `task cmemc -- <args>` runs the pinned cmemc release for commands no task wraps

### Changed

- Generated packages no longer use the locally installed cmemc: every task that runs cmemc - `build`, `check`, `import`, `export`, `delete`, `publish` - runs the release pinned as `CMEMC_VERSION` in `Taskfile.yaml` (26.2.1) through `uvx`, so a package can no longer be built or published with a development version of cmemc
- the generated GitLab pipeline no longer installs cmemc itself and uses the same pinned release, so `Taskfile.yaml` is now the only place the version is set; this repository's GitHub workflow no longer installs cmemc either
- cmemc is no longer a prerequisite of a generated package, uv is; setting `CMEMC` in `.env` (e.g. `CMEMC=cmemc`) runs another cmemc on purpose
- the shipped `package-content`, `build-projects`, `shapes` and `catalog-queries` skills run cmemc commands as `task cmemc -- <args>`

- The `shapes` skill says that a class the package does not own - from a vocabulary it ships unchanged or depends on, such as QUDT or FOAF - gets its icon from a `foaf:depiction` on the package's node shape, so its resources show an icon in Explore without the package changing the source's vocabulary; the `vocabulary` skill's depictions reference points there

## [1.8.0] 2026-10-18
Expand Down
9 changes: 4 additions & 5 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,13 @@ Adding a `tests/<name>.yml` copier answers file automatically adds a test case
- It mutates shared state, so both pipelines serialize it — GitHub Actions via `concurrency: testing_environment`, GitLab via `resource_group: testing-server`. A local run can collide with the nightly 3am GitHub run.
- Generated directories are `git init`-ed by `check:generate:case` on purpose: the generated `task build` has a precondition on `git describe`, because `PACKAGE_VERSION` is derived from it (`v0.0.0-<describe>` when the describe output is not already a `v…` tag).

## cmemc is pinned in two places and drifts
## cmemc is pinned in one place: the generated Taskfile

- `src/.gitlab-ci.yml` — `uv tool install cmem-cmemc@<version>`, the version *generated projects* use.
- `.github/workflows/check.yml` — `pip install cmem-cmemc==<version>`, the version *this repo's* CI uses.
`CMEMC_VERSION` in `src/Taskfile.yaml` is the only cmemc pin. Every generated task runs `{{.CMEMC}}`, which defaults to `uvx --from cmem-cmemc==<version> cmemc`, so a generated package never uses the locally installed cmemc — a package was once built with a development build of cmemc, published with `null`s in its manifest, and broke an older Corporate Memory that installed it. Neither pipeline installs cmemc: the generated GitLab pipeline and this repository's GitHub workflow both run the tasks, and so the pinned release. Bump the version there and note it in `CHANGELOG.md`.

These are independent literals with no coupling; they have silently diverged before. Always update both together, and note the version in `CHANGELOG.md`.
Before this, the version was a literal in `src/.gitlab-ci.yml.jinja` and another in `.github/workflows/check.yml`, and the two silently diverged. Do not reintroduce a cmemc install in either pipeline. A package can set `CMEMC` in `.env` to run another cmemc on purpose; the default is a shell `${CMEMC:-…}` expansion precisely so that `.env` can override it, because a Taskfile `vars:` entry would otherwise win over the environment.

The same split catches tooling generally: the two pipelines install their tools differently, so a dependency the payload needs has to be checked in both. `uv` is the live example — the generated `task check:offline` runs the checks in `bin/` by path through their `uv run --script` shebang, which generated packages get for free because their image already installs cmemc with it, while this repository installs cmemc with pip and had to add `astral-sh/setup-uv` to `.github/workflows/check.yml` explicitly. Confirming a tool exists in one pipeline says nothing about the other.
The two pipelines still install their other tools differently, so a dependency the payload needs has to be checked in both. `uv` is the live example — generated packages get it from their GitLab image, while this repository had to add `astral-sh/setup-uv` to `.github/workflows/check.yml` explicitly. Confirming a tool exists in one pipeline says nothing about the other.

## Generated package anatomy

Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ Everything else is the same for both types - the repository layout, the
- Python 3.10+
- Copier >= 9.0.0: `pip install copier` or `uv tool install copier`
- [uv](https://docs.astral.sh/uv/), which runs the generated package's offline
checks and its Claude Code hooks through their script headers
checks and its Claude Code hooks through their script headers, and the cmemc
release its tasks are pinned to through `uvx`

## Usage

Expand Down
4 changes: 2 additions & 2 deletions src/.gitlab-ci.yml.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ default:
image: docker-registry.eccenca.com/eccenca-python:v3.13.13
# no job can be interrupted in case a new commit is pushed
interruptible: false
before_script:
- uv tool install --reinstall cmem-cmemc@26.2.1
# No cmemc is installed here: the tasks run the release pinned in
# Taskfile.yaml (CMEMC_VERSION) through uvx, the same one a local build uses.

variables:
GIT_SUBMODULE_STRATEGY: recursive
Expand Down
8 changes: 5 additions & 3 deletions src/README.md.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@

## Development

Prerequisites: [task](https://taskfile.dev/), cmemc for the tasks that talk to
Corporate Memory, and [uv](https://docs.astral.sh/uv/), which runs the offline checks in `bin/` and the
Claude Code hooks in `.claude/hooks/` through their script headers.
Prerequisites: [task](https://taskfile.dev/) and [uv](https://docs.astral.sh/uv/). uv runs the offline checks in `bin/` and the
Claude Code hooks in `.claude/hooks/` through their script headers, and it runs cmemc: every task that
talks to Corporate Memory uses the cmemc release pinned in `Taskfile.yaml` (`CMEMC_VERSION`), not an installed
cmemc, so that a package is never built or published with a development version. Use `task cmemc -- <args>`
for cmemc commands no task wraps. To run another cmemc on purpose, set e.g. `CMEMC=cmemc` in `.env`.

- Run [task](https://taskfile.dev/) to see all major development tasks.
- This repository was created with [this copier template](https://github.com/eccenca/cmem-package-template).
Expand Down
46 changes: 39 additions & 7 deletions src/Taskfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,16 @@ vars:
sh: git describe --tags --always --dirty 2>/dev/null || echo ""
PACKAGE_VERSION:
sh: echo {{if regexMatch "^v.*" .GIT_DESCRIBE}}{{.GIT_DESCRIBE}}{{else}}v0.0.0-{{.GIT_DESCRIBE}}{{end}}
# Every task runs this cmemc release, never whatever cmemc happens to be
# installed: a development build of cmemc can write a manifest that an
# older Corporate Memory cannot install, and a package built with it reaches
# the marketplace as easily as any other. The GitLab pipeline runs these
# tasks too, so this is the only place the version is pinned.
CMEMC_VERSION: 26.2.1
# Set CMEMC in .env to run another cmemc on purpose, e.g. `CMEMC=cmemc` for
# the installed one while testing a cmemc change. The default is expanded by
# the shell at run time, which is what lets .env override it.
CMEMC: ${CMEMC:-uvx --from cmem-cmemc=={{.CMEMC_VERSION}} cmemc}

includes:
custom:
Expand All @@ -38,11 +48,15 @@ tasks:

check:
desc: Run whole test suite
preconditions:
- &cmemc_runner
sh: '[ -n "$CMEMC" ] || command -v uvx'
msg: "The tasks run a pinned cmemc release through uv. Install it: https://docs.astral.sh/uv/"
cmds:
- task: check:offline
- task: build
- cmemc package install --replace --input {{.DIST_DIR}}/{{.PACKAGE_ID}}-{{.PACKAGE_VERSION}}.cpa
- cmemc package uninstall {{.PACKAGE_ID}}
- '{{.CMEMC}} package install --replace --input {{.DIST_DIR}}/{{.PACKAGE_ID}}-{{.PACKAGE_VERSION}}.cpa'
- '{{.CMEMC}} package uninstall {{.PACKAGE_ID}}'

check:offline:
desc: Check shipped RDF without a Corporate Memory connection
Expand Down Expand Up @@ -74,11 +88,12 @@ tasks:
preconditions:
- sh: git describe --tags --always --dirty 2>/dev/null
msg: "Package directory must be a git repository. Run: git init; git add .; git commit -m 'init'"
- *cmemc_runner
deps:
- clean
cmds:
- >
cmemc package build {{.PACKAGE_DIR}}
{{.CMEMC}} package build {{.PACKAGE_DIR}}
--output-dir {{.DIST_DIR}}
--version {{.PACKAGE_VERSION}}

Expand All @@ -93,20 +108,26 @@ tasks:
SHACL service answer HTTP 500 for every graph on that deployment. They
run before the installed package is deleted, so a failed check leaves
the instance as it was.
preconditions:
- *cmemc_runner
cmds:
- task: check:offline
- task: delete
- cmemc package install --input {{.PACKAGE_DIR}}
- '{{.CMEMC}} package install --input {{.PACKAGE_DIR}}'

export:
desc: Export package content from Corporate Memory
preconditions:
- *cmemc_runner
cmds:
- cmemc package export --replace --extract {{.PACKAGE_ID}}
- '{{.CMEMC}} package export --replace --extract {{.PACKAGE_ID}}'

delete:
desc: Delete (uninstall) package from Corporate Memory
preconditions:
- *cmemc_runner
cmds:
- cmd: cmemc package uninstall {{.PACKAGE_ID}}
- cmd: '{{.CMEMC}} package uninstall {{.PACKAGE_ID}}'
ignore_error: true

publish:
Expand All @@ -116,6 +137,17 @@ tasks:
msg: >
No package archive for version {{.PACKAGE_VERSION}} found in
{{.DIST_DIR}}. Run 'task build' first.
- *cmemc_runner
cmds:
- cmemc package publish {{.DIST_DIR}}/{{.PACKAGE_ID}}-{{.PACKAGE_VERSION}}.cpa
- '{{.CMEMC}} package publish {{.DIST_DIR}}/{{.PACKAGE_ID}}-{{.PACKAGE_VERSION}}.cpa'

cmemc:
desc: Run the pinned cmemc, e.g. task cmemc -- -c my-instance graph list
summary: |
Runs the same cmemc release the other tasks use, with everything after
`--` passed on. Use it instead of an installed cmemc for the commands no
task wraps, so that they too run the release this package is built with.
preconditions:
- *cmemc_runner
cmds:
- '{{.CMEMC}} {{.CLI_ARGS}}'
13 changes: 10 additions & 3 deletions src/{{ '.claude' }}/rules/copier-template.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,16 @@ shared state on whichever deployment those point at. Know which deployment you
are aimed at before running it, and do not run it concurrently with a pipeline
doing the same thing.

**The generated tasks invoke `cmemc` without `-c`**, so they act on the
default connection. Drop to the bare `cmemc` commands with an explicit `-c`
when that is not the instance you mean.
**The generated tasks run a pinned cmemc release**, `CMEMC_VERSION` in
`Taskfile.yaml`, through `uvx` - never the cmemc installed on the machine. A
development build of cmemc once wrote a manifest an older Corporate Memory
could not install, and the package was published that way. Run other cmemc
commands as `task cmemc -- <args>` for the same reason, and do not set
`CMEMC` in `.env` for a build that will be published.

**The generated tasks invoke cmemc without `-c`**, so they act on the
default connection. Use `task cmemc -- -c <connection> ...` with an explicit
`-c` when that is not the instance you mean.

`task check:offline` is the exception: it runs the checks in `bin/` over the
shipped RDF and touches no deployment at all, so it is always safe to run.
Expand Down
9 changes: 7 additions & 2 deletions src/{{ '.claude' }}/skills/package-content/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ Once it has happened, every later install fails with "Another process locked
the package project", and nothing about the message suggests that the cause is
a previous run rather than the package.

`cmemc` 26.2.1 carries `--ignore-lock` on both `package install` and
The pinned cmemc release carries `--ignore-lock` on both `package install` and
`package uninstall` for exactly this. The manual equivalent is deleting
`mp-lock.json` from the `marketplace-packages` project over the workspace files
API.
Expand Down Expand Up @@ -204,9 +204,14 @@ success.
A build into a temporary directory catches every manifest and content problem:

```bash
cmemc package build <package_dir> --output-dir /tmp/pkg-check --version v0.0.0-test --replace
task cmemc -- package build <package_dir> --output-dir /tmp/pkg-check --version v0.0.0-test --replace
```

`task cmemc` runs the cmemc release the package's tasks are pinned to, so the
check builds with the same cmemc a release would; an installed cmemc may be a
different version, and a development build of it has written manifests an
older Corporate Memory cannot install.

**A clean build is not a validation pass.** `package build` checks the manifest
against the directory and ignores RDF syntax errors entirely - a `.ttl` that no
parser accepts builds happily and fails at install. `task check:offline` parses
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ hand-edited files destroys them and leaves the server's untouched state in their
place, uncommitted and without an error. The order is:

```bash
cmemc project import <package_dir>/build/<project-id> <project-id> # your edits go up
cmemc project export --extract --replace --without-userdata \
--output-dir <package_dir>/build <project-id> # the result comes back
task cmemc -- project import <package_dir>/build/<project-id> <project-id> # your edits go up
task cmemc -- project export --extract --replace --without-userdata \
--output-dir <package_dir>/build <project-id> # the result comes back
```

**`--without-userdata` is not optional in practice.** Without it, `config.xml`
Expand Down Expand Up @@ -110,16 +110,16 @@ package ships, so a test fixture inserted beforehand is wiped by the install
that was supposed to test it.

```bash
cmemc workflow execute --wait <project-id>:<workflow-id>
cmemc query execute <file.sparql> --accept text/csv
task cmemc -- workflow execute --wait <project-id>:<workflow-id>
task cmemc -- query execute <file.sparql> --accept text/csv
```

**`--wait` is what makes this a test.** Without it cmemc sends the start signal
and returns, so the command exits 0 whether the workflow succeeded or failed,
and the query on the next line reads a graph that is still being written.

A workflow is addressed as `<project-id>:<workflow-id>`; `cmemc workflow list`
shows what is there. There is no `cmemc project execute`.
A workflow is addressed as `<project-id>:<workflow-id>`; `task cmemc -- workflow list`
shows what is there. There is no `project execute` command.

If `cmem-build` is connected as an MCP server it can inspect projects, tasks,
datasets and workflows directly, which is faster than reading exported XML. Note
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,6 @@ untested combination, and it is the one that has failed: such a placeholder was
built, installed and removed again because its picker never filled. Check a
custom key in the query editor before shipping it.

`cmemc query open <iri>` opens a query in the editor to check a picker, but its
`--catalog-graph` defaults to `https://ns.eccenca.com/data/queries/`. Pass the
package's own shapes graph, or it will not find the query.
`task cmemc -- query open <iri>` opens a query in the editor to check a picker,
but its `--catalog-graph` defaults to `https://ns.eccenca.com/data/queries/`.
Pass the package's own shapes graph, or it will not find the query.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ things that are invisible until after an install:
## Validating against the instance

```sh
cmemc -c <connection> graph validation execute <graph-iri> --wait --inspect
task cmemc -- -c <connection> graph validation execute <graph-iri> --wait --inspect
```

Run this over every graph the change could touch after any edit to the
Expand Down
Loading