Skip to content

feat(map,build,review): "must not" rules per folder, enforced by checks (#116) - #124

Merged
rshankras merged 1 commit into
mainfrom
feat/116-must-not-rules
Nov 6, 2026
Merged

rshankras merged 1 commit into
mainfrom
feat/116-must-not-rules

Conversation

@rshankras

Copy link
Copy Markdown
Owner

Closes #116.

In plain words

Agents copy whatever they see and put code wherever it works. Now map suggests a few simple lines each folder must not cross ("Models must not import SwiftUI", "only Payments/ uses StoreKit"), you pick which to keep, and each one becomes a check that fails the moment it's broken.

What changed

  • New tested script templates/_scripts/folder-imports.sh: which frameworks each folder uses, plus direct calls that need no import (URLSession, CKContainer, Product.purchase). --files X lists the files. Skips tests, Pods, build output, and commented-out lines; handles folder names with spaces, @preconcurrency import, import struct Foundation.URL, and new uncommitted files.
  • map Step 5.7 "Folder Rules":
    1. survey
    2. suggest 3–6 rules, each "true today" or "broken in N files" (not suggested if broken almost everywhere: that's the design, not an exception)
    3. ask once which to keep
    4. install each as a SwiftLint rule (one folder, one framework) or a fitness test ("only X may use Y"), proven to pass on the real code and fail on a planted break in a throwaway copy; files already breaking it are listed as known exceptions, and that list only shrinks
    5. write a Folder Rules table in CODEBASE.md: folder | for | must not | enforced by | known exceptions
  • build: agents get the table, never add to the exceptions, and stop and report if a task can't be done without breaking a rule.
  • review: flags new breaks and any growth in an exceptions list (High).
  • expect-red.sh --no-build-check: SwiftLint's rule breaks look like compiler errors, so lint commands need any failure counted as caught.

Tests

11 new script tests (folder-imports ×10, --no-build-check ×1). Planted bugs in folder-imports: 4 of 4 caught. One was missed on the first try, which showed a gap in the test (comments naming an API weren't covered); fixed with a new fixture line and test.

🤖 Generated with Claude Code

…ks (#116)

map surveys framework use per folder (new tested folder-imports.sh),
suggests 3-6 rules, asks which to keep, and installs each as a SwiftLint
rule or fitness test proven green on real code and red on a planted break.
Existing breaks become known exceptions that only shrink. CODEBASE.md gets
a Folder Rules table that build agents follow and review checks.
expect-red.sh gains --no-build-check for lint commands.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@rshankras
rshankras merged commit 0896b0e into main Nov 6, 2026
2 checks passed
@rshankras
rshankras deleted the feat/116-must-not-rules branch November 6, 2026 14:46
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.

feat(map,learn): "must not" rules per folder, enforced by tests

1 participant