// `AppSources`, the walk many source sweeps in this target share. It lived in// SourceGuardTests.swift until those sweeps moved to vitest// (scripts/__tests__/swift-sweep-source-guard.test.ts, whose// helpers/swift-source-sweep.ts `appSources()` is this walk's twin); the Swift// suites that still read the tree use it from here.importFoundationimport XCTest/// Every Swift source of this app — the package's `Sources/**` AND the Xcode/// project's `App/**`.////// `App/` matters and is easy to forget: it is where the `@main` struct, the/// three extensions' principal classes and any future `AppDelegate` live, and/// it is exactly the place a `URLSession` or a whole-body read would first be/// written.enumAppSources {staticfunc all() throws -> [(name: String, text: String)] {var found = trySourceSweep.swiftSources()let app = SourceSweep.repoRoot.appendingPathComponent("apps/cotton/App")let walker = FileManager.default.enumerator(at: app, includingPropertiesForKeys: nil)whilelet url = walker?.nextObject() as? URL {guard url.pathExtension == "swift"else { continue }let text = tryString(contentsOf: url, encoding: .utf8)// Named with the target's directory — `App/Cotton/…`, `App/ShareExtension/…`// — so two targets' files of one name stay two.let relative = url.path.replacingOccurrences(of: app.path + "/", with: "") found.append(("App/" + relative, text)) }return found.sorted { $0.0 < $1.0 } }/// The last path component of a name from `all()`.////// Names are RELATIVE PATHS under `Sources` — "CottonKit/Boundary+4h.swift"/// — so a guard that wants "every Boundary file" must not ask the whole/// name for a prefix: it matches nothing and the guard passes while/// sweeping zero files.staticfunc fileName(_ name: String) -> String {String(name.split(separator: "/").last ?? Substring(name)) }}