importguard

command
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 24, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Command importguard enforces cross-leaf isolation between the four commands/internal/* composition leaves established by plan root-command-decomposition (t13a + t13a-pre + t13b + t15).

Background: outsider-prevention is now handled by Go's built-in internal/ package convention — only code rooted at or below commands/ may import commands/internal/lifecycle (etc.). The Go compiler enforces that for us. What the compiler does NOT enforce is sibling isolation: commands/internal/lifecycle is free, as far as Go is concerned, to import commands/internal/mcp. This tool exists solely to forbid those cross-leaf edges.

Contract:

  • commands/internal/lifecycle, commands/internal/mcp, commands/internal/settings, commands/internal/rules are leaf composition targets. They MUST NOT import each other.

Test files inside each leaf share the same import budget as their owning package — the policy is applied at the importing-package level, not the file level.

Usage: importguard [packages...] Defaults to "./..." when no package patterns are supplied. The tool exits non-zero (and prints the violation list) the moment any forbidden cross-leaf edge appears, which is what the CI job in .github/workflows/test.yml keys off.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL