Core
What a page, a package and an action are, how a package and the lock are built, and which rules the tool that installs packages follows.
About the package
The core is three things: a page, a package and an action. This package explains them to a project and records, as norms, the rules that the tool shtuk follows.
The package puts:
/base/kernel.md— what a page, a package and an action are and what the tool does;/base/package-format.md— the format of a package (package.md) and of the lock (.shtukbase/packages.lock);/base/conventions.md— the page typeConvention: how a base package says what packages of its kind give, expect and may change, and a health check that only informs; the fieldfollows;/norms/rules/core/CORE-R01.md…CORE-R14.md— fourteen norms of the tool, one per rule.
The package has no checks (the conventions of the base packages have their health checks in those packages). The enforcer of each norm is the tool's code and its test; they live in the tool's repository (apps/shtuk/src/, apps/shtuk/test/), not in the project. The norms are derived from the code and tests of tool version 0, nothing beyond them is invented.
Where the boundary is
- Here: the core's concepts, the format of a package and the lock, the rules of install, update, version choice and check.
- The norm collections themselves and the checks of norm form are the package
norms-core. Without it the core's norm pages lie as ordinary pages. - The page
/base/packages.md(the package list) is written by the tool; this package does not put it.
Norms 14
| ID | Norm | Level | Mode | Enforcer |
|---|---|---|---|---|
| CORE-R01 | Install and update lay files. Package code runs then only if the package is from a trusted source and the code is its action marked on: install or on: update. The rest of the package code runs only by the commands check and run. |
MUST | blocks | check shtuk:apps/shtuk/src/trust.ts shtuk:apps/shtuk/src/cli.ts shtuk:apps/shtuk/src/install.ts shtuk:apps/shtuk/src/check.ts shtuk:apps/shtuk/test/install-scripts.test.ts shtuk:apps/shtuk/test/e2e.test.ts |
| CORE-R02 | A package writes only simple relative paths: no "..", no absolute path, no hidden folder (.git, .shtukbase, .github). The folders .git and .shtukbase inside a package are not read. |
MUST | blocks | check shtuk:apps/shtuk/src/manifest.ts shtuk:apps/shtuk/test/e2e.test.ts |
| CORE-R03 | Install, init and update first build the whole plan and only then write. A refusal at any step leaves the project untouched. A trial run (--dry-run) is the same plan without writing. |
MUST | blocks | check shtuk:apps/shtuk/src/install.ts shtuk:apps/shtuk/src/cli.ts shtuk:apps/shtuk/test/e2e.test.ts |
| CORE-R04 | Every project path belongs to one package. An install where a package lays a page that another package already owns, or where two packages lay the same page, refuses entirely. |
MUST | blocks | check shtuk:apps/shtuk/src/install.ts shtuk:apps/shtuk/test/new-style.test.ts |
| CORE-R05 | A page whose text in the project differs from the package text is not overwritten by the tool. It is recorded in the lock as edited and named in the report. |
MUST | blocks | check shtuk:apps/shtuk/src/install.ts shtuk:apps/shtuk/test/e2e.test.ts |
| CORE-R06 | When a new version of a package is installed, a page that has not been touched in the project since the last install is replaced with the new text. An edited one stays as it is, and the report writes "kept N edited". |
MUST | blocks | check shtuk:apps/shtuk/src/install.ts shtuk:apps/shtuk/test/update.test.ts |
| CORE-R07 | A page that is not in the new version of a package is deleted by the tool if it was not edited. An edited one it keeps, stops accounting for, and names in the report. |
MUST | blocks | check shtuk:apps/shtuk/src/install.ts shtuk:apps/shtuk/test/update.test.ts |
| CORE-R08 | A page with the state removed in the lock is not laid again. A page that has simply gone (missing) is laid by the next install. |
MUST | blocks | check shtuk:apps/shtuk/src/install.ts shtuk:apps/shtuk/src/lock.ts shtuk:apps/shtuk/test/e2e.test.ts |
| CORE-R09 | Installing the same package of the same version writes nothing, even on another day. Pages keep the day of the first install. |
MUST | blocks | check shtuk:apps/shtuk/src/install.ts shtuk:apps/shtuk/test/e2e.test.ts shtuk:apps/shtuk/test/new-style.test.ts |
| CORE-R10 | There is no solver: every package gets the highest version that fits all the ranges asked of it. A yanked version is not taken. No suitable one — an error that names who asked for what. A dependency cycle is an error. |
MUST | blocks | check shtuk:apps/shtuk/src/resolve.ts shtuk:apps/shtuk/test/resolve.test.ts |
| CORE-R11 | update without a package number gives every installed package the newest version that its recorded source offers and that the ranges of the packages requiring it allow. With a number — only that package. An install without update keeps the installed version while it still fits. |
MUST | blocks | check shtuk:apps/shtuk/src/resolve.ts shtuk:apps/shtuk/src/cli.ts shtuk:apps/shtuk/test/update.test.ts shtuk:apps/shtuk/test/resolve.test.ts |
| CORE-R12 | If a package of the new kind includes (includes) a package that is in no source, install is an error. A missing requirement (requires) is also an error. Only for the old set (set) a vanished include is a warning. |
MUST | blocks | check shtuk:apps/shtuk/src/resolve.ts shtuk:apps/shtuk/test/new-style.test.ts shtuk:apps/shtuk/test/resolve.test.ts |
| CORE-R13 | A package copy in the registry whose tree hash does not match the one recorded in the registry's index.md is not installed. |
MUST | blocks | check shtuk:apps/shtuk/src/source.ts shtuk:apps/shtuk/test/e2e.test.ts |
| CORE-R14 | shtuk check runs every action with check: true of every installed package from the project root. Code 0 — the norm holds, another code — it is broken; stdout lines are findings. A check that did not answer in 60 seconds has failed. If at least one has failed, shtuk check exits with code 1. |
MUST | blocks | check shtuk:apps/shtuk/src/check.ts shtuk:apps/shtuk/test/new-style.test.ts shtuk:apps/shtuk/test/e2e.test.ts |
"Blocks": the enforcer stops a violation. "Observes": it only notes it. Level MUST means required; SHOULD means yes by default.
Pages 17
They go into the project at these paths.
- /base/
- Conventions of base packages page
- Core: page, package, action page
- Package and lock format page
- /norms/rules/core/
- Package code at install runs only from a trusted source CORE-R01
- A package writes only simple paths inside the project CORE-R02
- First a plan, then a write CORE-R03
- A path has one owner CORE-R04
- An edited page is not overwritten CORE-R05
- At update an untouched page is replaced, an edited one stays CORE-R06
- A page that the new version removed CORE-R07
- A page deleted on purpose does not come back CORE-R08
- A repeated install changes nothing CORE-R09
- Every package gets the highest suitable version CORE-R10
- update takes the newest version the ranges allow CORE-R11
- A missing include is an error CORE-R12
- A changed copy from the registry is rejected CORE-R13
- A check is a package action, its answer is the exit code CORE-R14
Package files 1
They go into .shtukbase/packages/core/; actions run from there.