Skip to content

feat: enforce local module dependency boundaries - #10

Merged
Zmnortal merged 1 commit into
mainfrom
codex/dev-2026-11-10-2
Nov 16, 2026
Merged

Zmnortal merged 1 commit into
mainfrom
codex/dev-2026-11-10-2

Conversation

@Zmnortal

Copy link
Copy Markdown
Contributor

Changes

Anatomy can validate directory layout and function exports but cannot currently stop a module from importing another module's private implementation. Add optional dependencies rules to Anatomy definitions so a scan can block or warn on direct local imports between path groups.

  • Share deterministic TypeScript AST analysis across normal CLI checks, Bundle mounts, watch mode, scanAnatomy and the new data-only checkAnatomyDependencies SDK API.
  • Resolve relative paths, directory indices (including import "."), JavaScript-to-TypeScript extension substitution and explicit aliases. Report the rule, original specifier, resolved target and source line/column.
  • Return operational errors for unavailable source, invalid syntax, unresolved local references, computed imports, unsupported direct require calls and paths escaping the virtual root.
  • Enable schemas-to-engine/CLI and engine-to-CLI restrictions in this repository's own contract. Update docs, Skill format guidance, explicit inventories and source roles; prepare package version 0.0.7.

Validation

  • bun run quality passed on the rebased branch: structure/source-role audit, types, lint, 427 tests and builds.
  • Packed Node consumer tests cover SDK/CLI boundary checks, exit codes, and watch blocking/recovery after source-only changes. Existing multi-placeholder tests remain passing.
  • Recorded real-project acceptance on 2026-11-10 covered 985 source files across 24 Service units. The 14 direct violations matched the final manual review's corresponding file, line, specifier and resolved target; the source snapshots matched. This was a scoped sample, not a whole-repository accuracy claim.
  • Diagnostic artifacts remain in ignored root docs/ per repository policy and are not included in the PR.

Scope

Rules check direct local edges, including type-only references and re-export statements, without tracing symbols through public barrel chains or judging wrapper semantics. Workspace aliases must be explicit; unmapped bare imports are external. There is no automatic tsconfig inheritance or package-exports discovery, and target code is never executed. Structural/query-only APIs retain their existing scope.

Based on the latest main; the already-merged multi-placeholder implementation is not repeated in this PR.

@Zmnortal
Zmnortal merged commit 37457e8 into main Nov 16, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant