---
title: "MGS1049: a target runs a manifest-defined script"
description: Fires when a target body runs a script a manifest defines, such as pnpm run build or poe lint. The script's steps, inputs and outputs live in the manifest, where the cache key and the affected set cannot see them.
tags: [MGS1049, magusfile, manifest, scripts, doctor, cache]
---

# 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](../../../concepts/spells.md#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.
