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

MGS5003: command op never exits

A command op runs a known watch tool with --watch (for example tsc --watch, vitest --watch, or npx tsc --watch). A command op is meant to run to completion, but a watcher never terminates, so the run would hang waiting for it. magus rejects it at resolution.

[MGS5003] command op "typecheck" runs a watcher with "--watch": a command op runs to completion, so a never-exiting watch process hangs the run. Make this a service op instead.
  see: .../MGS5003.md

Why

This is the mirror image of MGS5002: the argv contradicts the op's declared kind. There, a service (long-running) op detaches; here, a command (run to completion) op never exits. Both are the same bug from opposite ends - the argv lies about the kind - and both are errors with no flag-level suppression, because the fix is to change the kind, not silence the check.

The check is scoped to known watch tools (tsc, vitest, jest, vite, webpack, rollup, esbuild, cargo-watch), looking through common runners (npx, pnpm, yarn, bunx) to the tool they invoke, so a --watch that means something else on an unrelated tool is not misread.

Fix

Make it a service op. A watcher is a long-running process, which is exactly what a service op models: magus forks it in the foreground, blocks on it, and can attach a readiness probe and a stop command. Return a Service{command = ...} instead of a Command.

MGS5003servicescommand opwatchward
Last updated (b022d75e)
Glossary

Operation

A single tool-native command a target composes; the middle of the work hierarchy (Spell to Operation to Target). See operations.

Ward

A coded diagnostic that inspects a resolved op and nudges or blocks an anti-pattern before it runs. See wards.

Service

A long-running or shared process magus manages across runs, distinct from a one-shot target. See services.

Conventions

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