magus v0.4.3 is out. See what's new
¶ View markdown source · ✎ Suggest an edit
1 min read

MGS1049: a target runs a manifest-defined script

magus doctor reports this code when a target body runs a script that a manifest defines: pnpm run build, npm test, poe lint, pdm run check. A manifest declares what a package is (its name, dependencies, entry points and tool config); the magusfile declares how the workspace builds, tests and lints it. See Manifests and magusfiles.

Each spell declares the argv prefixes that run a manifest script through mgs_listScriptRunners. Doctor traces each target body's proc\exec calls under the dry-run host and matches every argv against those prefixes, including each command of a sh -c line. It sees the branches the trace takes, not every branch the body could take.

Why

The script's commands, the files they read and the files they write live in the manifest. magus hashes none of them into the target's cache key, so an edit to the script replays a stale result, and the affected set misses the projects the script touches.

Resolution

The finding names the target, the argv, the script and the spell whose runner matched.

  • Move the steps into the target. Call the spell op that runs the tool (typescript["tsc"](ctx, {...})), or proc\exec the tool itself (proc\exec("pnpm", ["exec", "vite", "build"])), and delete the script from the manifest.
  • Keep [project.scripts] and bin. They name executables the package installs, not steps the workspace runs, and no runner matches them.
MGS1049magusfilemanifestscriptsdoctorcache
Last updated (479ce5c7)
Glossary

Workspace

The magus root directory that owns a set of projects and shared config; the unit magus operates over. See workspace.

Project

A directory magus recognizes as a unit of work (it has a magusfile); the unit of caching, scheduling, and dependency tracking. See workspace.

Magusfile

The magusfile.buzz that declares a project's targets (as export funs) and binds its spells. See targets.

Target

A named operation (build, test, ...) you invoke with magus run <target>; it may compose a spell's tool-native operations and depend on other targets. See targets.

Op

A single tool-native command a target composes (long form: operation); the middle of the work hierarchy (Spell to Op to Target). See operations.

Spell

A language/runtime adapter (e.g. go, md) that maps generic targets onto a toolchain's real commands. See spells.

Manifest

The file that declares what a package is: its name, dependencies, entry points and tool config (go.mod, package.json, pyproject.toml, Cargo.toml). How the workspace builds, tests and lints the package belongs in the magusfile, not in the manifest's scripts. See spells.

Cache

The content-addressed store magus consults before running a target, so unchanged work is skipped. See cache.

Affected

The set of projects touched by a change; magus affected <target> runs a target only over them. See affected.

CI

An ordinary magusfile-defined target you compose yourself with magus\needs: magus does not hardcode its stages. Magus.RunCI treats it specially only in that it strips the rw charm, it is the anchor magus affected ci keys off, and a selected scope with no project declaring it is a load error rather than a silent no-op. See targets.

Trace

OpenTelemetry's name for one whole magus invocation; every target it runs is a span beneath it. See telemetry.

Run

One target executing under one magus invocation, such as magus run test web or magus affected ci. A run keeps its captured output behind an output reference. Every magus run is a run whether or not any job asked for it; see Job for how the two relate.

Conventions

This page uses none of the site's convention markers. The full set is on the conventions page.