# THE FACTORY: FRAMEWORK & MONOREPO BUILD DIRECTIVES You are operating inside the `Factory_Frameworks` monorepo workspace. --- ## 1. THE MONOREPO TOPOLOGY MANIFEST (CRITICAL) The `Factory_Frameworks` workspace is a single master container containing **2 applications** and **10 bedrock frameworks**. Individual framework projects (e.g. `BrowserKit.xcodeproj`, `DriveKit.xcodeproj`) do NOT contain standalone build schemes; all build schemes reside at the master workspace level. ### Master Container: - **Master Workspace:** `/Users/dave/warezfactory/xcode/Factory_Workspaces/Factory_Frameworks/Factory_Frameworks.xcworkspace` - **Monorepo Root Directory:** `/Users/dave/warezfactory/xcode/Factory_Workspaces/Factory_Frameworks/` ### The 2 Embedded Applications (`apps/`): 1. `Framework Manager` ➔ `apps/Framework Manager/` 2. `Framework Test Harness` ➔ `apps/Framework Test Harness/` ### The 10 Bedrock Frameworks (`frameworks/`): 1. `AIKit` ➔ `frameworks/AIKit/` 2. `BrowserKit` ➔ `frameworks/BrowserKit/` 3. `CacheKit` ➔ `frameworks/CacheKit/` 4. `CommerceKit` ➔ `frameworks/CommerceKit/` 5. `DriveKit` ➔ `frameworks/DriveKit/` 6. `FactoryKit` ➔ `frameworks/FactoryKit/` 7. `ServerKit` ➔ `frameworks/ServerKit/` 8. `StreamlineFoundation` ➔ `frameworks/StreamlineFoundation/` 9. `ThemeKit` ➔ `frameworks/ThemeKit/` 10. `WarehouseKit` ➔ `frameworks/WarehouseKit/` --- ## 2. WORKSPACE TARGETING & SCHEME DISCIPLINE ### Option A: Native Xcode MCP (Preferred) 1. **MANDATORY SESSION ORDER (Session First):** You must NEVER invoke `XcodeRead`, `XcodeUpdate`, or `XcodeWrite` before acquiring an active workspace session. Your mandatory first action in any Xcode task is to invoke `XcodeOpenWorkspace` (or `XcodeListWorkspaces`) to establish the `workspaceIdentifier`. Only after the session is active may you issue file inspection or editing calls. 2. **Target the Parent Workspace:** When invoking `XcodeOpenWorkspace`, pass the path to the master workspace file (or project root): `/Users/dave/warezfactory/xcode/Factory_Workspaces/Factory_Frameworks/Factory_Frameworks.xcworkspace` 3. **Switch to Target Scheme:** Call `XcodeSwitchScheme` passing the exact target scheme name (e.g., `DriveKit`, `Framework Test Harness`, `BrowserKit`). 4. **Compile:** Call `BuildProject` and verify diagnostics with `GetBuildLog`. ### Option B: Terminal Fallback (`xcodebuild`) If native MCP is unavailable, execute `xcodebuild` targeting the master `.xcworkspace` file from the monorepo root: ```bash cd /Users/dave/warezfactory/xcode/Factory_Workspaces/Factory_Frameworks && xcodebuild -workspace Factory_Frameworks.xcworkspace -scheme [SchemeName] -destination "platform=macOS,arch=arm64" build ``` - **Omit `-xcconfig`:** Omit the `-xcconfig` flag on terminal builds to prevent SPM concurrency collisions on third-party dependencies. - **NEVER** pass `-project [Framework].xcodeproj` to `xcodebuild` (the project file contains no schemes). --- ## 3. THE TWO-TARGET MONOREPO COMPILATION AIRLOCK (TESTBINARIES) When a task involves modifying a framework and verifying it inside `Framework Test Harness`: 1. **Framework First (Mandatory Intermediate Build):** You MUST modify the framework code, invoke `XcodeSwitchScheme(scheme: "[FrameworkName]")`, and call `BuildProject`. 2. **The `TestBinaries` Drop:** A successful framework build automatically deposits the updated dynamic binary into the workspace's intermediate `TestBinaries/` directory. 3. **Test Harness Second:** ONLY AFTER the framework builds cleanly with zero errors may you invoke `XcodeSwitchScheme(scheme: "Framework Test Harness")` to run the test suite. 4. **FORBIDDEN ACTION:** If `Framework Test Harness` reports missing methods or symbols, **NEVER** edit the framework to add dummy, speculative, or stub methods. Missing symbols mean the Test Harness is linking against a stale binary because Step 1 was skipped or failed. Re-verify Step 1! --- ## 4. RELATIVE PATH DISCIPLINE IN MONOREPOS All relative file paths in blueprints and file operations resolve strictly from the workspace root: - Target framework source: `frameworks/[FrameworkName]/[FrameworkName]/[FileName].swift` - Target app source: `apps/[AppName]/[AppName]/[FileName].swift` - **CANONICAL MONOREPO PREFIXES:** In `Factory_Frameworks`, all source files reside inside `frameworks/` or `apps/`. When passing `filePath` to Xcode MCP tools (`XcodeRead`, `XcodeUpdate`, `XcodeWrite`), you MUST include the parent folder prefix (`frameworks/...` or `apps/...`). Never omit the top-level segment, as Xcode MCP tools resolve paths directly against the master workspace container. - **Git Repositories Per Subproject:** The `Factory_Frameworks` container root does not have a `.git` directory; each embedded app and framework (`frameworks//` and `apps//`) has its own `.git` repository. Run `git` checks inside the target subfolder (e.g., `git -C frameworks/ status -s`) rather than at the workspace root. - Do NOT assume files reside in the working directory root or run exploratory shell `find` commands. --- ## 5. BUILD VERIFICATION ONLY (NO TEST RUNNER CALLS) - **Framework Schemes Are Not Testable:** Individual framework schemes (`AIKit`, `BrowserKit`, `CacheKit`, `CommerceKit`, `DriveKit`, `FactoryKit`, `ServerKit`, `StreamlineFoundation`, `ThemeKit`, `WarehouseKit`) and `Framework Test Harness` do NOT have Xcode unit-test runner schemes configured. - **Do NOT Invoke Xcode Test Runners:** Never call `RunAllTests`, `RunSomeTests`, or `XcodeRunTests` in `Factory_Frameworks` unless explicitly instructed by the prompt. - **Sufficient Gate:** Clean compilation via `BuildProject` and zero in-scope diagnostics in `GetBuildLog` completes verification.